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

behaviorType, layoutType, highlightJsStyle, highlightJsStyleBorder, isEnabledTimeline

mizozobu 6 лет назад
Родитель
Сommit
8595c31001

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

@@ -194,26 +194,6 @@ module.exports = function(crowi, app, req, locals) {
     return customizeService.generateCustomTitle(page);
     return customizeService.generateCustomTitle(page);
   };
   };
 
 
-  locals.behaviorType = function() {
-    return configManager.getConfig('crowi', 'customize:behavior');
-  };
-
-  locals.layoutType = function() {
-    return configManager.getConfig('crowi', 'customize:layout');
-  };
-
-  locals.highlightJsStyle = function() {
-    return configManager.getConfig('crowi', 'customize:highlightJsStyle');
-  };
-
-  locals.highlightJsStyleBorder = function() {
-    return configManager.getConfig('crowi', 'customize:highlightJsStyleBorder');
-  };
-
-  locals.isEnabledTimeline = function() {
-    return configManager.getConfig('crowi', 'customize:isEnabledTimeline');
-  };
-
   locals.parentPath = function(path) {
   locals.parentPath = function(path) {
     if (path === '/') {
     if (path === '/') {
       return path;
       return path;

+ 2 - 2
src/server/views/admin/customize.html

@@ -307,7 +307,7 @@
             <div class="col-xs-9">
             <div class="col-xs-9">
               <select class="form-control selectpicker" name="settingForm[customize:highlightJsStyle]" onChange="selectHighlightJsStyle(event)" {% if noCdn() %}disabled{% endif %}>
               <select class="form-control selectpicker" name="settingForm[customize:highlightJsStyle]" onChange="selectHighlightJsStyle(event)" {% if noCdn() %}disabled{% endif %}>
                 {% for key in Object.keys(highlightJsCssSelectorOptions) %}
                 {% for key in Object.keys(highlightJsCssSelectorOptions) %}
-                  <option value={{key}} {% if key == highlightJsStyle() %} selected {% endif %}>{{highlightJsCssSelectorOptions[key].name}}</option>
+                  <option value={{key}} {% if key == getConfig('crowi', 'customize:highlightJsStyle') %} selected {% endif %}>{{highlightJsCssSelectorOptions[key].name}}</option>
                 {% endfor %}
                 {% endfor %}
               </select>
               </select>
               <p class="help-block text-warning">{{ t('customize_page.nocdn_desc') }}</p>
               <p class="help-block text-warning">{{ t('customize_page.nocdn_desc') }}</p>
@@ -331,7 +331,7 @@
           </div>
           </div>
 
 
           <div id="highlightJsCssContainer">
           <div id="highlightJsCssContainer">
-            {{ cdnHighlightJsStyleTag(highlightJsStyle()) }}
+            {{ cdnHighlightJsStyleTag(getConfig('crowi', 'customize:highlightJsStyle')) }}
           </div>
           </div>
 
 
           <p class="help-block">
           <p class="help-block">

+ 2 - 2
src/server/views/customlayout-selector/forbidden.html

@@ -1,6 +1,6 @@
-{% if !layoutType() || 'crowi' === layoutType() %}
+{% if !getConfig('crowi', 'customize:layout') || 'crowi' === getConfig('crowi', 'customize:layout') %}
   {% include '../layout-crowi/forbidden.html' %}
   {% include '../layout-crowi/forbidden.html' %}
-{% elseif !layoutType() || 'kibela' === layoutType()%}
+{% elseif !getConfig('crowi', 'customize:layout') || 'kibela' === getConfig('crowi', 'customize:layout')%}
   {% include '../layout-kibela/forbidden.html' %}
   {% include '../layout-kibela/forbidden.html' %}
 {% else %}
 {% else %}
   {% include '../layout-growi/forbidden.html' %}
   {% include '../layout-growi/forbidden.html' %}

+ 2 - 2
src/server/views/customlayout-selector/not_creatable.html

@@ -1,6 +1,6 @@
-{% if !layoutType() || 'crowi' === layoutType() %}
+{% if !getConfig('crowi', 'customize:layout') || 'crowi' === getConfig('crowi', 'customize:layout') %}
   {% include '../layout-crowi/not_creatable.html' %}
   {% include '../layout-crowi/not_creatable.html' %}
-{% elseif !layoutType() || 'kibela' === layoutType()%}
+{% elseif !getConfig('crowi', 'customize:layout') || 'kibela' === getConfig('crowi', 'customize:layout')%}
   {% include '../layout-kibela/not_creatable.html' %}
   {% include '../layout-kibela/not_creatable.html' %}
 {% else %}
 {% else %}
   {% include '../layout-growi/not_creatable.html' %}
   {% include '../layout-growi/not_creatable.html' %}

+ 2 - 2
src/server/views/customlayout-selector/not_found.html

@@ -1,6 +1,6 @@
-{% if !layoutType() || 'crowi' === layoutType() %}
+{% if !getConfig('crowi', 'customize:layout') || 'crowi' === getConfig('crowi', 'customize:layout') %}
   {% include '../layout-crowi/not_found.html' %}
   {% include '../layout-crowi/not_found.html' %}
-{% elseif !layoutType() || 'kibela' === layoutType()%}
+{% elseif !getConfig('crowi', 'customize:layout') || 'kibela' === getConfig('crowi', 'customize:layout')%}
   {% include '../layout-kibela/not_found.html' %}
   {% include '../layout-kibela/not_found.html' %}
 {% else %}
 {% else %}
   {% include '../layout-growi/not_found.html' %}
   {% include '../layout-growi/not_found.html' %}

+ 2 - 2
src/server/views/customlayout-selector/page.html

@@ -1,6 +1,6 @@
-{% if !layoutType() || 'crowi' === layoutType() %}
+{% if !getConfig('crowi', 'customize:layout') || 'crowi' === getConfig('crowi', 'customize:layout') %}
   {% include '../layout-crowi/page.html' %}
   {% include '../layout-crowi/page.html' %}
-{% elseif !layoutType() || 'kibela' === layoutType()%}
+{% elseif !getConfig('crowi', 'customize:layout') || 'kibela' === getConfig('crowi', 'customize:layout')%}
   {% include '../layout-kibela/page.html' %}
   {% include '../layout-kibela/page.html' %}
 {% else %}
 {% else %}
   {% include '../layout-growi/page.html' %}
   {% include '../layout-growi/page.html' %}

+ 2 - 2
src/server/views/customlayout-selector/page_list.html

@@ -1,6 +1,6 @@
-{% if !layoutType() || 'crowi' === layoutType() %}
+{% if !getConfig('crowi', 'customize:layout') || 'crowi' === getConfig('crowi', 'customize:layout') %}
   {% include '../layout-crowi/page_list.html' %}
   {% include '../layout-crowi/page_list.html' %}
-{% elseif !layoutType() || 'kibela' === layoutType()%}
+{% elseif !getConfig('crowi', 'customize:layout') || 'kibela' === getConfig('crowi', 'customize:layout')%}
   {% include '../layout-kibela/page_list.html' %}
   {% include '../layout-kibela/page_list.html' %}
 {% else %}
 {% else %}
   {% include '../layout-growi/page_list.html' %}
   {% include '../layout-growi/page_list.html' %}

+ 2 - 2
src/server/views/customlayout-selector/user_page.html

@@ -1,6 +1,6 @@
-{% if !layoutType() || 'crowi' === layoutType() %}
+{% if !getConfig('crowi', 'customize:layout') || 'crowi' === getConfig('crowi', 'customize:layout') %}
   {% include '../layout-crowi/user_page.html' %}
   {% include '../layout-crowi/user_page.html' %}
-{% elseif !layoutType() || 'kibela' === layoutType()%}
+{% elseif !getConfig('crowi', 'customize:layout') || 'kibela' === getConfig('crowi', 'customize:layout')%}
   {% include '../layout-kibela/user_page.html' %}
   {% include '../layout-kibela/user_page.html' %}
 {% else %}
 {% else %}
   {% include '../layout-growi/user_page.html' %}
   {% include '../layout-growi/user_page.html' %}

+ 1 - 1
src/server/views/layout-growi/page.html

@@ -34,7 +34,7 @@
 
 
   </div>
   </div>
 
 
-  {% if 'growi' === behaviorType() || 'crowi-plus' === behaviorType() %}
+  {% if 'growi' === getConfig('crowi', 'customize:behavior') || 'crowi-plus' === getConfig('crowi', 'customize:behavior') %}
   <div class="row page-list hidden-print m-t-30">
   <div class="row page-list hidden-print m-t-30">
     <div class="col-md-10">
     <div class="col-md-10">
       {% include '../widget/page_list_and_timeline.html' %}
       {% include '../widget/page_list_and_timeline.html' %}

+ 1 - 1
src/server/views/layout-growi/user_page.html

@@ -58,7 +58,7 @@
 
 
   </div>
   </div>
 
 
-  {% if 'growi' === behaviorType() || 'crowi-plus' === behaviorType() %}
+  {% if 'growi' === getConfig('crowi', 'customize:behavior') || 'crowi-plus' === getConfig('crowi', 'customize:behavior') %}
   <div class="row page-list hidden-print m-t-30">
   <div class="row page-list hidden-print m-t-30">
     <div class="col-md-10">
     <div class="col-md-10">
       {% include '../widget/page_list_and_timeline.html' %}
       {% include '../widget/page_list_and_timeline.html' %}

+ 1 - 1
src/server/views/layout-growi/widget/header.html

@@ -41,7 +41,7 @@
       </ul>
       </ul>
       {% endif %}
       {% endif %}
 
 
-      {% if not page and not forbidden and ('/' === path or 'crowi' === behaviorType()) and not isUserPageList(path) and !isTrashPage() %}
+      {% if not page and not forbidden and ('/' === path or 'crowi' === getConfig('crowi', 'customize:behavior')) and not isUserPageList(path) and !isTrashPage() %}
         {% if '/' === path.slice(-1) %}
         {% if '/' === path.slice(-1) %}
           {% include '../../widget/create_portal.html' %}
           {% include '../../widget/create_portal.html' %}
         {% endif %}
         {% endif %}

+ 1 - 1
src/server/views/layout-kibela/page.html

@@ -30,7 +30,7 @@
 
 
 </div>
 </div>
 
 
-  {% if 'growi' === behaviorType() || 'crowi-plus' === behaviorType() %}
+  {% if 'growi' === getConfig('crowi', 'customize:behavior') || 'crowi-plus' === getConfig('crowi', 'customize:behavior') %}
   <div class="row page-list p-t-10 m-t-30 m-b-30 round-corner">
   <div class="row page-list p-t-10 m-t-30 m-b-30 round-corner">
     <div class="col-md-10">
     <div class="col-md-10">
       {% include '../widget/page_list_and_timeline.html' %}
       {% include '../widget/page_list_and_timeline.html' %}

+ 1 - 1
src/server/views/layout-kibela/user_page.html

@@ -51,7 +51,7 @@
 
 
   </div>
   </div>
 
 
-  {% if 'growi' === behaviorType() || 'crowi-plus' === behaviorType() %}
+  {% if 'growi' === getConfig('crowi', 'customize:behavior') || 'crowi-plus' === getConfig('crowi', 'customize:behavior') %}
   <div class="row page-list m-t-30">
   <div class="row page-list m-t-30">
     <div class="col-xs-12">
     <div class="col-xs-12">
       {% include '../widget/page_list_and_timeline_kibela.html' %}
       {% include '../widget/page_list_and_timeline_kibela.html' %}

+ 1 - 1
src/server/views/layout-kibela/widget/header.html

@@ -41,7 +41,7 @@
         </div>
         </div>
       </li>
       </li>
     </ul>
     </ul>
-    {% endif %} {% if not page and ('/' === path or 'crowi' === behaviorType()) and not isUserPageList(path) and !isTrashPage()
+    {% endif %} {% if not page and ('/' === path or 'crowi' === getConfig('crowi', 'customize:behavior')) and not isUserPageList(path) and !isTrashPage()
     %} {% if '/' === path.slice(-1) %} {% include '../../widget/create_portal.html' %} {% endif %} {% endif %}
     %} {% if '/' === path.slice(-1) %} {% include '../../widget/create_portal.html' %} {% endif %} {% endif %}
 
 
   </div>
   </div>

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

@@ -49,7 +49,7 @@
   {% endif %}
   {% endif %}
 
 
   {{ cdnStyleTagsByGroup('basis') }}
   {{ cdnStyleTagsByGroup('basis') }}
-  {{ cdnHighlightJsStyleTag(highlightJsStyle()) }}
+  {{ cdnHighlightJsStyleTag(getConfig('crowi', 'customize:highlightJsStyle')) }}
 
 
   {% block html_additional_headers %}{% endblock %}
   {% block html_additional_headers %}{% endblock %}
 
 
@@ -62,7 +62,7 @@
 {% block html_body %}
 {% block html_body %}
 <body
 <body
   class="main-container content-wrapper {% block html_base_css %}{% endblock %}
   class="main-container content-wrapper {% block html_base_css %}{% endblock %}
-      {% if !layoutType() || 'crowi' === layoutType() %}crowi{% elseif !layoutType() || 'kibela' === layoutType() %}kibela{% else %}growi{% endif %}"
+      {% if !getConfig('crowi', 'customize:layout') || 'crowi' === getConfig('crowi', 'customize:layout') %}crowi{% elseif !getConfig('crowi', 'customize:layout') || 'kibela' === getConfig('crowi', 'customize:layout') %}kibela{% else %}growi{% endif %}"
   data-me="{{ user._id.toString() }}"
   data-me="{{ user._id.toString() }}"
   data-is-admin="{{ user.admin }}"
   data-is-admin="{{ user.admin }}"
   data-plugin-enabled="{{ getConfig('crowi', 'plugin:isEnabledPlugins') }}"
   data-plugin-enabled="{{ getConfig('crowi', 'plugin:isEnabledPlugins') }}"

+ 1 - 1
src/server/views/page_presentation.html

@@ -32,7 +32,7 @@
     <title>{{ path|path2name }} | {{ path }}</title>
     <title>{{ path|path2name }} | {{ path }}</title>
 
 
     {{ cdnStyleTagsByGroup('basis') }}
     {{ cdnStyleTagsByGroup('basis') }}
-    {{ cdnHighlightJsStyleTag(highlightJsStyle()) }}
+    {{ cdnHighlightJsStyleTag(getConfig('crowi', 'customize:highlightJsStyle')) }}
 
 
     <style>
     <style>
       {{ customCss() }}
       {{ customCss() }}

+ 2 - 2
src/server/views/widget/page_content.html

@@ -21,7 +21,7 @@
 
 
   {% include 'page_alerts.html' %}
   {% include 'page_alerts.html' %}
 
 
-  {% if !layoutType() || 'kibela' === layoutType() %}
+  {% if !getConfig('crowi', 'customize:layout') || 'kibela' === getConfig('crowi', 'customize:layout') %}
     {% include 'page_tabs_kibela.html' %}
     {% include 'page_tabs_kibela.html' %}
   {% else %}
   {% else %}
     {% include 'page_tabs.html' %}
     {% include 'page_tabs.html' %}
@@ -40,7 +40,7 @@
         </div>
         </div>
         <div id="page" class="m-t-15"></div>
         <div id="page" class="m-t-15"></div>
       </div>
       </div>
-    {% elseif 'crowi' === behaviorType() %}
+    {% elseif 'crowi' === getConfig('crowi', 'customize:behavior') %}
       <div class="tab-pane active" id="cancel-creating-portal">
       <div class="tab-pane active" id="cancel-creating-portal">
       </div>
       </div>
     {% endif %}
     {% endif %}

+ 2 - 2
src/server/views/widget/page_list_and_timeline.html

@@ -1,7 +1,7 @@
 <div class="page-list-container">
 <div class="page-list-container">
   <ul class="nav nav-tabs">
   <ul class="nav nav-tabs">
       <li class="active"><a href="#view-list" data-toggle="tab">{{ t('List View') }}</a></li>
       <li class="active"><a href="#view-list" data-toggle="tab">{{ t('List View') }}</a></li>
-      {% if isEnabledTimeline() %}
+      {% if getConfig('crowi', 'customize:isEnabledTimeline') %}
       <li><a href="#view-timeline" data-toggle="tab">{{ t('Timeline View') }}</a></li>
       <li><a href="#view-timeline" data-toggle="tab">{{ t('Timeline View') }}</a></li>
       {% endif %}
       {% endif %}
   </ul>
   </ul>
@@ -23,7 +23,7 @@
     </div>
     </div>
 
 
     {# timeline view #}
     {# timeline view #}
-    {% if isEnabledTimeline() %}
+    {% if getConfig('crowi', 'customize:isEnabledTimeline') %}
     <div class="tab-pane m-t-30" id="view-timeline" data-shown=0>
     <div class="tab-pane m-t-30" id="view-timeline" data-shown=0>
       {% for page in pages %}
       {% for page in pages %}
       <div class="timeline-body" id="id-{{ page.id }}" data-page-id="{{ page.id }}" data-page-path="{{ page.path }}" data-revision="{{ page.revision.toString() }}">
       <div class="timeline-body" id="id-{{ page.id }}" data-page-id="{{ page.id }}" data-page-path="{{ page.path }}" data-revision="{{ page.revision.toString() }}">

+ 2 - 2
src/server/views/widget/page_list_and_timeline_kibela.html

@@ -1,7 +1,7 @@
 <div class="page-list-container">
 <div class="page-list-container">
   <ul class="nav nav-tabs customtab">
   <ul class="nav nav-tabs customtab">
       <li class="active"><a href="#view-list" data-toggle="tab">{{ t('List View') }}</a></li>
       <li class="active"><a href="#view-list" data-toggle="tab">{{ t('List View') }}</a></li>
-      {% if isEnabledTimeline() %}
+      {% if getConfig('crowi', 'customize:isEnabledTimeline') %}
       <li><a href="#view-timeline" data-toggle="tab">{{ t('Timeline View') }}</a></li>
       <li><a href="#view-timeline" data-toggle="tab">{{ t('Timeline View') }}</a></li>
       {% endif %}
       {% endif %}
   </ul>
   </ul>
@@ -23,7 +23,7 @@
     </div>
     </div>
 
 
     {# timeline view #}
     {# timeline view #}
-    {% if isEnabledTimeline() %}
+    {% if getConfig('crowi', 'customize:isEnabledTimeline') %}
     <div class="tab-pane m-t-30" id="view-timeline" data-shown=0>
     <div class="tab-pane m-t-30" id="view-timeline" data-shown=0>
       {% for page in pages %}
       {% for page in pages %}
       <div class="timeline-body" id="id-{{ page.id }}" data-page-id="{{ page.id }}" data-page-path="{{ page.path }}" data-revision="{{ page.revision._id }}">
       <div class="timeline-body" id="id-{{ page.id }}" data-page-id="{{ page.id }}" data-page-path="{{ page.path }}" data-revision="{{ page.revision._id }}">