Browse Source

GC-2000 abolish theme method

Yuki Takei 6 years ago
parent
commit
d3fdc4bc72

+ 0 - 5
src/server/models/config.js

@@ -460,11 +460,6 @@ module.exports = function(crowi) {
     return getValueForCrowiNS(config, key);
     return getValueForCrowiNS(config, key);
   };
   };
 
 
-  configSchema.statics.theme = function(config) {
-    const key = 'customize:theme';
-    return getValueForCrowiNS(config, key);
-  };
-
   configSchema.statics.customTitle = function(config, page) {
   configSchema.statics.customTitle = function(config, page) {
     validateCrowi();
     validateCrowi();
 
 

+ 0 - 5
src/server/util/swigFunctions.js

@@ -225,11 +225,6 @@ module.exports = function(crowi, app, req, locals) {
     return Config.customHeader(config);
     return Config.customHeader(config);
   };
   };
 
 
-  locals.theme = function() {
-    const config = crowi.getConfig();
-    return Config.theme(config);
-  };
-
   locals.customTitle = function(page) {
   locals.customTitle = function(page) {
     const config = crowi.getConfig();
     const config = crowi.getConfig();
     return Config.customTitle(config, page);
     return Config.customTitle(config, page);

+ 4 - 11
src/server/views/admin/customize.html

@@ -3,18 +3,11 @@
 {% block html_title %}{{ customTitle(t('Customize')) }} {% endblock %}
 {% block html_title %}{{ customTitle(t('Customize')) }} {% endblock %}
 
 
 {% block theme_css_block %}
 {% block theme_css_block %}
-  {% if 'kibela' === layoutType() %}
-    {% if env === 'development' %}
-      <script src="{{ webpack_asset('styles/theme-kibela.js') }}"></script>
-    {% else %}
-      <link rel="stylesheet" href="{{ webpack_asset('styles/theme-kibela.css') }}">
-    {% endif %}
+  {% set themeName = getConfig('crowi', 'customize:theme') %}
+  {% if env === 'development' %}
+    <script src="{{ webpack_asset('styles/theme-' + themeName + '.js') }}"></script>
   {% else %}
   {% else %}
-    {% if env === 'development' %}
-      <script src="{{ webpack_asset('styles/theme-' + theme() + '.js') }}"></script>
-    {% else %}
-    <link rel="stylesheet" id="jssDefault" {# append id for theme selector #} href="{{ webpack_asset('styles/theme-' + theme() + '.css') }}">
-    {% endif %}
+  <link rel="stylesheet" id="jssDefault" {# append id for theme selector #} href="{{ webpack_asset('styles/theme-' + themeName + '.css') }}">
   {% endif %}
   {% endif %}
 {% endblock %}
 {% endblock %}
 
 

+ 3 - 2
src/server/views/layout/layout.html

@@ -40,11 +40,12 @@
 
 
   <!-- styles -->
   <!-- styles -->
   {% include '../widget/headers/styles-for-app.html' %}
   {% include '../widget/headers/styles-for-app.html' %}
-  {% if 'kibela' === layoutType() %}
+  {% if 'kibela' === getConfig('crowi', 'customize:layout') %}
     {% include '../widget/headers/styles-theme-kibela.html' %}
     {% include '../widget/headers/styles-theme-kibela.html' %}
   {% else %}
   {% else %}
     {% block theme_css_block %}
     {% block theme_css_block %}
-      {% include '../widget/headers/styles-theme.html' with {theme: theme()} %}
+      {% set themeName = getConfig('crowi', 'customize:theme') %}
+      {% include '../widget/headers/styles-theme.html' with {themeName: themeName} %}
     {% endblock %}
     {% endblock %}
   {% endif %}
   {% endif %}