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

modify default layout type and behavior type to 'growi' from 'crowi-plus'

Yuki Takei 8 лет назад
Родитель
Сommit
0d2943277d

+ 3 - 3
lib/models/config.js

@@ -29,8 +29,8 @@ module.exports = function(crowi) {
     // overwrite
     config['app:fileUpload'] = true;
     config['security:isEnabledPassport'] = true;
-    config['customize:behavior'] = 'crowi-plus';
-    config['customize:layout'] = 'crowi-plus';
+    config['customize:behavior'] = 'growi';
+    config['customize:layout'] = 'growi';
     config['customize:isSavedStatesOfTabChanges'] = false;
 
     return config;
@@ -64,7 +64,7 @@ module.exports = function(crowi) {
       'security:passport-ldap:groupSearchFilter' : undefined,
       'security:passport-ldap:groupDnProperty' : undefined,
 
-      'aws:bucket'          : 'crowi',
+      'aws:bucket'          : 'growi',
       'aws:region'          : 'ap-northeast-1',
       'aws:accessKeyId'     : '',
       'aws:secretAccessKey' : '',

+ 21 - 21
lib/routes/page.js

@@ -70,11 +70,11 @@ module.exports = function(crowi, app) {
   actions.pageListShowWrapper = function(req, res) {
     const behaviorType = Config.behaviorType(config);
 
-    if ('crowi-plus' === behaviorType) {
-      return actions.pageListShowForCrowiPlus(req, res);
+    if (!behaviorType || 'crowi' === behaviorType) {
+      return actions.pageListShow(req, res);
     }
     else {
-      return actions.pageListShow(req, res);
+      return actions.pageListShowForCrowiPlus(req, res);
     }
   }
   /**
@@ -83,11 +83,11 @@ module.exports = function(crowi, app) {
   actions.pageShowWrapper = function(req, res) {
     const behaviorType = Config.behaviorType(config);
 
-    if ('crowi-plus' === behaviorType) {
-      return actions.pageShowForCrowiPlus(req, res);
+    if (!behaviorType || 'crowi' === behaviorType) {
+      return actions.pageShow(req, res);
     }
     else {
-      return actions.pageShow(req, res);
+      return actions.pageShowForCrowiPlus(req, res);
     }
   }
   /**
@@ -96,13 +96,13 @@ module.exports = function(crowi, app) {
   actions.trashPageListShowWrapper = function(req, res) {
     const behaviorType = Config.behaviorType(config);
 
-    if ('crowi-plus' === behaviorType) {
-      // redirect to '/trash'
-      return res.redirect('/trash');
+    if (!behaviorType || 'crowi' === behaviorType) {
+      // Crowi behavior for '/trash/*'
+      return actions.deletedPageListShow(req, res);
     }
-    // official Crowi behavior for '/trash/*'
     else {
-      return actions.deletedPageListShow(req, res);
+      // redirect to '/trash'
+      return res.redirect('/trash');
     }
   }
   /**
@@ -111,14 +111,14 @@ module.exports = function(crowi, app) {
   actions.trashPageShowWrapper = function(req, res) {
     const behaviorType = Config.behaviorType(config);
 
-    if ('crowi-plus' === behaviorType) {
-      // official Crowi behavior for '/trash/*'
-      return actions.deletedPageListShow(req, res);
-    }
-    else {
+    if (!behaviorType || 'crowi' === behaviorType) {
       // redirect to '/trash/'
       return res.redirect('/trash/');
     }
+    else {
+      // Crowi behavior for '/trash/*'
+      return actions.deletedPageListShow(req, res);
+    }
 
   }
   /**
@@ -127,13 +127,13 @@ module.exports = function(crowi, app) {
   actions.deletedPageListShowWrapper = function(req, res) {
     const behaviorType = Config.behaviorType(config);
 
-    if ('crowi-plus' === behaviorType) {
-      const path = '/trash' + getPathFromRequest(req);
-      return res.redirect(path);
+    if (!behaviorType || 'crowi' === behaviorType) {
+      // Crowi behavior for '/trash/*'
+      return actions.deletedPageListShow(req, res);
     }
-    // official Crowi behavior for '/trash/*'
     else {
-      return actions.deletedPageListShow(req, res);
+      const path = '/trash' + getPathFromRequest(req);
+      return res.redirect(path);
     }
   }
 

+ 6 - 4
lib/views/admin/customize.html

@@ -82,11 +82,12 @@
       <fieldset>
         <legend>{{ t('customize_page.Behavior') }}</legend>
 
+        {% set isBehaviorGrowi = 'growi' === settingForm['customize:behavior'] || 'crowi-plus' === settingForm['customize:behavior'] %}
         <div class="form-group">
           <div class="col-xs-6">
             <h4>
               <input type="radio" name="settingForm[customize:behavior]" value="crowi"
-                  {% if !settingForm['customize:behavior'] || 'crowi' === settingForm['customize:behavior'] %}checked="checked"{% endif %}>
+                  {% if !isBehaviorGrowi %}checked="checked"{% endif %}>
               Official Crowi Behavior
             </h4>
             <ul>
@@ -102,7 +103,7 @@
           <div class="col-xs-6">
             <h4>
               <input type="radio" name="settingForm[customize:behavior]" value="crowi-plus"
-                  {% if 'crowi-plus' === settingForm['customize:behavior'] %}checked="checked"{% endif %}>
+                  {% if isBehaviorGrowi %}checked="checked"{% endif %}>
               crowi-plus Simplified Behavior <small class="text-success">(Recommended)</small>
             </h4>
             <ul>
@@ -128,11 +129,12 @@
       <fieldset>
         <legend>{{ t('customize_page.Layout') }}</legend>
 
+        {% set isLayoutGrowi = 'growi' === settingForm['customize:layout'] || 'crowi-plus' === settingForm['customize:layout'] %}
         <div class="form-group">
           <div class="col-xs-6">
             <h4>
               <input type="radio" name="settingForm[customize:layout]" value="crowi"
-                  {% if !settingForm['customize:layout'] || 'crowi' === settingForm['customize:layout'] %}checked="checked"{% endif %}>
+                  {% if !isLayoutGrowi %}checked="checked"{% endif %}>
               Official Crowi Classic Layout
             </h4>
             <a href="/images/admin/customize/layout-classic.gif" class="ss-container">
@@ -150,7 +152,7 @@
           <div class="col-xs-6">
             <h4>
               <input type="radio" name="settingForm[customize:layout]" value="crowi-plus"
-                  {% if 'crowi-plus' === settingForm['customize:layout'] %}checked="checked"{% endif %}>
+                  {% if isLayoutGrowi %}checked="checked"{% endif %}>
               crowi-plus Enhanced Layout <small class="text-success">(Recommended)</small>
             </h4>
             <a href="/images/admin/customize/layout-crowi-plus.gif" class="ss-container">

+ 3 - 3
lib/views/customlayout-selector/not_found.html

@@ -1,5 +1,5 @@
-{% if 'crowi-plus' === layoutType() %}
-  {% include '../layout-growi/not_found.html' %}
-{% else %}
+{% if !layoutType() || 'crowi' === layoutType() %}
   {% include '../layout-crowi/not_found.html' %}
+{% else %}
+  {% include '../layout-growi/not_found.html' %}
 {% endif %}

+ 3 - 3
lib/views/customlayout-selector/page.html

@@ -1,5 +1,5 @@
-{% if 'crowi-plus' === layoutType() %}
-  {% include '../layout-growi/page.html' %}
-{% else %}
+{% if !layoutType() || 'crowi' === layoutType() %}
   {% include '../layout-crowi/page.html' %}
+{% else %}
+  {% include '../layout-growi/page.html' %}
 {% endif %}

+ 3 - 3
lib/views/customlayout-selector/page_list.html

@@ -1,5 +1,5 @@
-{% if 'crowi-plus' === layoutType() %}
-  {% include '../layout-growi/page_list.html' %}
-{% else %}
+{% if !layoutType() || 'crowi' === layoutType() %}
   {% include '../layout-crowi/page_list.html' %}
+{% else %}
+  {% include '../layout-growi/page_list.html' %}
 {% endif %}

+ 3 - 3
lib/views/customlayout-selector/user_page.html

@@ -1,5 +1,5 @@
-{% if 'crowi-plus' === layoutType() %}
-  {% include '../layout-growi/user_page.html' %}
-{% else %}
+{% if !layoutType() || 'crowi' === layoutType() %}
   {% include '../layout-crowi/user_page.html' %}
+{% else %}
+  {% include '../layout-growi/user_page.html' %}
 {% endif %}

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

@@ -33,7 +33,7 @@
 
   </div>
 
-  {% if 'crowi-plus' === behaviorType() %}
+  {% if 'growi' === behaviorType() || 'crowi-plus' === behaviorType() %}
   <div class="row page-list m-t-30">
     <div class="col-md-12">
       {% include '../widget/page_list_and_timeline.html' %}

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

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

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

@@ -111,8 +111,7 @@ gh/highlightjs/cdn-release@9.12.0/build/languages/yaml.min.js
 {% block html_body %}
 <body
   class="main-container content-wrapper {% block html_base_css %}{% endblock %}
-      {% if 'crowi' === layoutType() %}crowi{% endif %}
-      {% if 'crowi-plus' === layoutType() %}growi{% endif %}"
+      {% if !layoutType() || 'crowi' === layoutType() %}crowi{% else %}growi{% endif %}"
   data-me="{{ user._id.toString() }}"
   data-plugin-enabled="{{ isEnabledPlugins() }}"
   {% block html_base_attr %}{% endblock %}

+ 1 - 1
resource/js/components/Page/RevisionPath.js

@@ -22,7 +22,7 @@ export default class RevisionPath extends React.Component {
 
     // whether set link to '/'
     const behaviorType = this.props.crowi.getConfig()['behaviorType'];
-    const isLinkToListPage = ('crowi-plus' !== behaviorType);
+    const isLinkToListPage = (!behaviorType || 'crowi' === behaviorType);
     this.setState({ isLinkToListPage });
 
     // generate pages obj

+ 6 - 6
resource/js/components/PageComments.js

@@ -22,7 +22,7 @@ export default class PageComments extends React.Component {
       // desc order array
       comments: [],
 
-      isLayoutTypeCrowiPlus: false,
+      isLayoutTypeGrowi: false,
 
       // for deleting comment
       commentToDelete: undefined,
@@ -53,7 +53,7 @@ export default class PageComments extends React.Component {
     const pageId = this.props.pageId;
 
     const layoutType = this.props.crowi.getConfig()['layoutType'];
-    this.setState({isLayoutTypeCrowiPlus: 'crowi-plus' === layoutType});
+    this.setState({isLayoutTypeGrowi: 'crowi-plus' === layoutType || 'growi' === layoutType});
 
     // get data (desc order array)
     this.props.crowi.apiGet('/comments.get', {page_id: pageId})
@@ -134,7 +134,7 @@ export default class PageComments extends React.Component {
     let olderComments = [];
 
     let comments = this.state.comments;
-    if (this.state.isLayoutTypeCrowiPlus) {
+    if (this.state.isLayoutTypeGrowi) {
       // replace with asc order array
       comments = comments.slice().reverse();  // non-destructive reverse
     }
@@ -176,7 +176,7 @@ export default class PageComments extends React.Component {
     );
 
     // generate toggle elements
-    const iconForNewer = (this.state.isLayoutTypeCrowiPlus)
+    const iconForNewer = (this.state.isLayoutTypeGrowi)
       ? <i className="fa fa-angle-double-down"></i>
       : <i className="fa fa-angle-double-up"></i>;
     const toggleNewer = (newerElements.length === 0)
@@ -186,7 +186,7 @@ export default class PageComments extends React.Component {
           {iconForNewer} Comments for Newer Revision {iconForNewer}
         </a>
       );
-    const iconForOlder = (this.state.isLayoutTypeCrowiPlus)
+    const iconForOlder = (this.state.isLayoutTypeGrowi)
       ? <i className="fa fa-angle-double-up"></i>
       : <i className="fa fa-angle-double-down"></i>;
     const toggleOlder = (olderElements.length === 0)
@@ -198,7 +198,7 @@ export default class PageComments extends React.Component {
       );
 
     // layout blocks
-    const commentsElements = (this.state.isLayoutTypeCrowiPlus)
+    const commentsElements = (this.state.isLayoutTypeGrowi)
       ? (
         <div>
           {olderBlock}