Просмотр исходного кода

WIP: impl theme switcher

apply saved theme
Yuki Takei 8 лет назад
Родитель
Сommit
d0fdc082d9
3 измененных файлов с 8 добавлено и 3 удалено
  1. 5 0
      lib/util/swigFunctions.js
  2. 2 2
      lib/views/admin/customize.html
  3. 1 1
      lib/views/layout/layout.html

+ 5 - 0
lib/util/swigFunctions.js

@@ -109,6 +109,11 @@ module.exports = function(crowi, app, req, locals) {
     return Config.customHeader(config);
   }
 
+  locals.theme = function() {
+    var config = crowi.getConfig()
+    return Config.theme(config);
+  }
+
   locals.behaviorType = function() {
     var config = crowi.getConfig()
     return Config.behaviorType(config);

+ 2 - 2
lib/views/admin/customize.html

@@ -3,8 +3,8 @@
 {% block html_title %}{{ t('Customize') }} {% endblock %}
 
 {% block style_css_block %}
-<link rel="stylesheet" href="{{ webpack_asset('style').css }}">
-<link rel="stylesheet" id="jssDefault" {# append id for theme selector #} href="{{ webpack_asset('style-theme-default').css }}">
+  <link rel="stylesheet" href="{{ webpack_asset('style').css }}">
+  <link rel="stylesheet" id="jssDefault" {# append id for theme selector #} href="{{ webpack_asset('style-theme-' + theme()).css }}">
 {% endblock %}
 
 {% block html_additional_headers %}

+ 1 - 1
lib/views/layout/layout.html

@@ -81,7 +81,7 @@ gh/highlightjs/cdn-release@9.12.0/build/languages/yaml.min.js
   <!-- styles -->
   {% block style_css_block %}
   <link rel="stylesheet" href="{{ webpack_asset('style').css }}">
-  <link rel="stylesheet" href="{{ webpack_asset('style-theme-default').css }}">
+  <link rel="stylesheet" href="{{ webpack_asset('style-theme-' + theme()).css }}">
   {% endblock %}
 
   <!-- Google Fonts -->