aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-10-07 11:31:12 +0200
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-10-07 11:31:12 +0200
commit879e9fcd76f65107390bffa7d8c8999cb6c6a853 (patch)
tree1e23ae8521c48e8b02c594988fdde5443aed4252
parent71282fb72f8d113953aef5eb7be111a14ece3f22 (diff)
Fix issue #165: @import CSS enlevés
Implique une modification des fichiers metadata.json pour les thèmes : ajout d'un champ "files" répertoriant les fichiers CSS à utiliser
-rw-r--r--app/App_FrontController.php14
-rwxr-xr-xapp/controllers/configureController.php2
-rw-r--r--app/models/RSSThemes.php13
-rw-r--r--public/themes/default/metadata.json3
-rw-r--r--public/themes/default/style.css3
-rw-r--r--public/themes/flat-design/metadata.json3
-rw-r--r--public/themes/flat-design/style.css2
7 files changed, 24 insertions, 16 deletions
diff --git a/app/App_FrontController.php b/app/App_FrontController.php
index 920e3baa8..844956cf9 100644
--- a/app/App_FrontController.php
+++ b/app/App_FrontController.php
@@ -10,13 +10,13 @@ class App_FrontController extends FrontController {
$this->loadLibs ();
$this->loadModels ();
- Session::init (); // lancement de la session doit se faire après chargement des modèles sinon bug (pourquoi ?)
+ Session::init ();
+ RSSThemes::init ();
+ Translate::init ();
$this->loadParamsView ();
$this->loadStylesAndScripts ();
$this->loadNotifications ();
-
- Translate::init ();
}
private function loadLibs () {
@@ -51,8 +51,12 @@ class App_FrontController extends FrontController {
}
private function loadStylesAndScripts () {
- $theme = $this->conf->theme();
- View::appendStyle (Url::display ('/themes/' . $theme . '/style.css'));
+ $theme = RSSThemes::get_infos($this->conf->theme());
+ if ($theme) {
+ foreach($theme["files"] as $file) {
+ View::appendStyle (Url::display ('/themes/' . $theme['path'] . '/' . $file));
+ }
+ }
View::appendStyle (Url::display ('/themes/printer/style.css'), 'print');
if (login_is_conf ($this->conf)) {
View::appendScript ('https://login.persona.org/include.js');
diff --git a/app/controllers/configureController.php b/app/controllers/configureController.php
index c1e79d73e..1c4b92e77 100755
--- a/app/controllers/configureController.php
+++ b/app/controllers/configureController.php
@@ -147,8 +147,6 @@ class configureController extends ActionController {
}
public function displayAction () {
- RSSThemes::init();
-
if (Request::isPost ()) {
$current_token = $this->view->conf->token ();
diff --git a/app/models/RSSThemes.php b/app/models/RSSThemes.php
index 291b295e3..83db85acf 100644
--- a/app/models/RSSThemes.php
+++ b/app/models/RSSThemes.php
@@ -23,10 +23,11 @@ class RSSThemes extends Model {
isset($res['name']) &&
isset($res['author']) &&
isset($res['description']) &&
- isset($res['version'])) {
+ isset($res['version']) &&
+ isset($res['files']) && is_array($res['files'])) {
$theme = $res;
$theme['path'] = $theme_dir;
- self::$list[] = $theme;
+ self::$list[$theme_dir] = $theme;
}
}
}
@@ -35,4 +36,12 @@ class RSSThemes extends Model {
public static function get() {
return self::$list;
}
+
+ public static function get_infos($theme_id) {
+ if (isset(self::$list[$theme_id])) {
+ return self::$list[$theme_id];
+ }
+
+ return false;
+ }
} \ No newline at end of file
diff --git a/public/themes/default/metadata.json b/public/themes/default/metadata.json
index 0fe31fd90..a69eab7ee 100644
--- a/public/themes/default/metadata.json
+++ b/public/themes/default/metadata.json
@@ -2,5 +2,6 @@
"name": "Default",
"author": "Marien Fressinaud",
"description": "Le thème par défaut pour FreshRSS",
- "version": 0.1
+ "version": 0.1,
+ "files": ["global.css", "freshrss.css", "fallback.css"]
} \ No newline at end of file
diff --git a/public/themes/default/style.css b/public/themes/default/style.css
deleted file mode 100644
index 7e4f386d9..000000000
--- a/public/themes/default/style.css
+++ /dev/null
@@ -1,3 +0,0 @@
-@import url('global.css');
-@import url('freshrss.css');
-@import url('fallback.css');
diff --git a/public/themes/flat-design/metadata.json b/public/themes/flat-design/metadata.json
index 3147ea53b..6b94d11c2 100644
--- a/public/themes/flat-design/metadata.json
+++ b/public/themes/flat-design/metadata.json
@@ -2,5 +2,6 @@
"name": "Flat design",
"author": "Marien Fressinaud",
"description": "Thème plat pour FreshRSS",
- "version": 0.1
+ "version": 0.1,
+ "files": ["global.css", "freshrss.css"]
} \ No newline at end of file
diff --git a/public/themes/flat-design/style.css b/public/themes/flat-design/style.css
deleted file mode 100644
index c9d8551f4..000000000
--- a/public/themes/flat-design/style.css
+++ /dev/null
@@ -1,2 +0,0 @@
-@import url('global.css');
-@import url('freshrss.css'); \ No newline at end of file