mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-10-24 03:58:33 -04:00
Mise à jour nom thèmes + chargement robuste des thèmes
Renomme : default -> Origine En cas de thème introuvable, charge le thème par défaut, sinon le premier disponible. https://github.com/marienfressinaud/FreshRSS/issues/120
This commit is contained in:
1 parent
7516549f60
commit
f720d41cbf
28 files changed
+42
-20
No files matched your search
@@ -157,7 +157,11 @@ class FreshRSS_configure_Controller extends Minz_ActionController {
|
||||
'scroll' => Minz_Request::param('mark_scroll', false),
|
||||
'reception' => Minz_Request::param('mark_upon_reception', false),
|
||||
));
|
||||
$this->view->conf->_theme(Minz_Request::param('theme', 'default'));
|
||||
$themeId = Minz_Request::param('theme', '');
|
||||
if ($themeId == '') {
|
||||
$themeId = FreshRSS_Themes::defaultTheme;
|
||||
}
|
||||
$this->view->conf->_theme($themeId);
|
||||
$this->view->conf->_topline_read(Minz_Request::param('topline_read', false));
|
||||
$this->view->conf->_topline_favorite(Minz_Request::param('topline_favorite', false));
|
||||
$this->view->conf->_topline_date(Minz_Request::param('topline_date', false));
|
||||
|
||||
+2
-3
@@ -114,11 +114,10 @@ class FreshRSS extends Minz_FrontController {
|
||||
}
|
||||
|
||||
private function loadStylesAndScripts ($loginOk) {
|
||||
$theme = FreshRSS_Themes::get_infos($this->conf->theme);
|
||||
$theme = FreshRSS_Themes::load($this->conf->theme);
|
||||
if ($theme) {
|
||||
FreshRSS_Themes::setThemeId($this->conf->theme);
|
||||
foreach($theme['files'] as $file) {
|
||||
Minz_View::appendStyle (Minz_Url::display ('/themes/' . $theme['path'] . '/' . $file . '?' . @filemtime(PUBLIC_PATH . '/themes/' . $theme['path'] . '/' . $file)));
|
||||
Minz_View::appendStyle (Minz_Url::display ('/themes/' . $theme['id'] . '/' . $file . '?' . @filemtime(PUBLIC_PATH . '/themes/' . $theme['path'] . '/' . $file)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ class FreshRSS_Configuration {
|
||||
'scroll' => false,
|
||||
'reception' => false,
|
||||
),
|
||||
'theme' => 'default',
|
||||
'theme' => 'Origine',
|
||||
'shortcuts' => array(
|
||||
'mark_read' => 'r',
|
||||
'mark_favorite' => 'f',
|
||||
|
||||
+23
-5
@@ -3,13 +3,17 @@
|
||||
class FreshRSS_Themes extends Minz_Model {
|
||||
private static $themesUrl = '/themes/';
|
||||
private static $defaultIconsUrl = '/themes/icons/';
|
||||
public static $defaultTheme = 'Origine';
|
||||
|
||||
public static function get() {
|
||||
$themes_list = array_diff(
|
||||
public static function getList() {
|
||||
return array_values(array_diff(
|
||||
scandir(PUBLIC_PATH . self::$themesUrl),
|
||||
array('..', '.')
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
public static function get() {
|
||||
$themes_list = self::getList();
|
||||
$list = array();
|
||||
foreach ($themes_list as $theme_dir) {
|
||||
$theme = self::get_infos($theme_dir);
|
||||
@@ -28,7 +32,7 @@ class FreshRSS_Themes extends Minz_Model {
|
||||
$content = file_get_contents($json_filename);
|
||||
$res = json_decode($content, true);
|
||||
if ($res && isset($res['files']) && is_array($res['files'])) {
|
||||
$res['path'] = $theme_id;
|
||||
$res['id'] = $theme_id;
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
@@ -39,12 +43,26 @@ class FreshRSS_Themes extends Minz_Model {
|
||||
private static $themeIconsUrl;
|
||||
private static $themeIcons;
|
||||
|
||||
public static function setThemeId($theme_id) {
|
||||
public static function load($theme_id) {
|
||||
$infos = self::get_infos($theme_id);
|
||||
if (!$infos) {
|
||||
if ($theme_id !== self::$defaultTheme) { //Fall-back to default theme
|
||||
return self::load(self::$defaultTheme);
|
||||
}
|
||||
$themes_list = self::getList();
|
||||
if (!empty($themes_list)) {
|
||||
if ($theme_id !== $themes_list[0]) { //Fall-back to first theme
|
||||
return self::load($themes_list[0]);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
self::$themeIconsUrl = self::$themesUrl . $theme_id . '/icons/';
|
||||
self::$themeIcons = is_dir(PUBLIC_PATH . self::$themeIconsUrl) ? array_fill_keys(array_diff(
|
||||
scandir(PUBLIC_PATH . self::$themeIconsUrl),
|
||||
array('..', '.')
|
||||
), 1) : array();
|
||||
return $infos;
|
||||
}
|
||||
|
||||
public static function icon($name, $urlOnly = false) {
|
||||
|
||||
@@ -21,9 +21,10 @@
|
||||
<div class="form-group">
|
||||
<label class="group-name" for="theme"><?php echo Minz_Translate::t ('theme'); ?></label>
|
||||
<div class="group-controls">
|
||||
<select name="theme" id="theme">
|
||||
<select name="theme" id="theme" required="">
|
||||
<option></option>
|
||||
<?php foreach ($this->themes as $theme) { ?>
|
||||
<option value="<?php echo $theme['path']; ?>"<?php echo $this->conf->theme === $theme['path'] ? ' selected="selected"' : ''; ?>>
|
||||
<option value="<?php echo $theme['id']; ?>"<?php echo $this->conf->theme === $theme['id'] ? ' selected="selected"' : ''; ?>>
|
||||
<?php echo $theme['name'] . ' — ' . Minz_Translate::t ('by') . ' ' . $theme['author']; ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "Dark",
|
||||
"author": "AD",
|
||||
"description": "Le coté obscur du thème “Origine”",
|
||||
"version": 0.1,
|
||||
"files": ["global.css", "freshrss.css"]
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "Default",
|
||||
"name": "Origine",
|
||||
"author": "Marien Fressinaud",
|
||||
"description": "Le thème par défaut pour FreshRSS",
|
||||
"version": 0.1,
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"name": "Dark",
|
||||
"author": "AD",
|
||||
"description": "Le coté obscur du thème par défaut pour FreshRSS",
|
||||
"version": 0.1,
|
||||
"files": ["global.css", "freshrss.css"]
|
||||
}
|
||||
Reference in new issue
Block a user