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

Merge pull request #103 from weseek/master

release v1.2.6
Yuki Takei 8 лет назад
Родитель
Сommit
f9660d38c4

+ 5 - 0
CHANGES.md

@@ -1,6 +1,11 @@
 CHANGES
 ========
 
+## 1.2.6
+
+* Fix: The problem that page_list widget doesn't show the picture of revision.author
+* Fix: Change implementation of Bootstrap3 toggle switch for admin pages
+
 ## 1.2.5
 
 * Feature: crowi-plus Simplified Behavior

+ 10 - 6
lib/models/page.js

@@ -631,12 +631,22 @@ module.exports = function(crowi) {
     var sortOpt = {};
     sortOpt[opt.sort] = opt.desc;
 
+    var isPopulateRevisionBody = option.isPopulateRevisionBody || false;
+
     return new Promise(function(resolve, reject) {
       var q = Page.generateQueryToListByStartWith(path, userData, option)
         .sort(sortOpt)
         .skip(opt.offset)
         .limit(opt.limit);
 
+      // retrieve revision data
+      if (isPopulateRevisionBody) {
+        q = q.populate('revision');
+      }
+      else {
+        q = q.populate('revision', '-body');  // exclude body
+      }
+
       q.exec()
         .then(function(pages) {
           Page.populate(pages, {path: 'revision.author', model: 'User', select: User.USER_PUBLIC_FIELDS})
@@ -650,7 +660,6 @@ module.exports = function(crowi) {
     var Page = this;
     var pathCondition = [];
     var includeDeletedPage = option.includeDeletedPage || false;
-    var isPopulateRevision = option.isPopulateRevision || false;
 
     var queryReg = new RegExp('^' + path);
     pathCondition.push({path: queryReg});
@@ -681,11 +690,6 @@ module.exports = function(crowi) {
       });
     }
 
-    // retrieve revision data
-    if (isPopulateRevision) {
-      q = q.populate('revision');
-    }
-
     return q;
   }
 

+ 2 - 2
lib/routes/page.js

@@ -107,7 +107,7 @@ module.exports = function(crowi, app) {
     var queryOptions = {
       offset: offset,
       limit : limit + 1,
-      isPopulateRevision: Config.isEnabledTimeline(config),
+      isPopulateRevisionBody: Config.isEnabledTimeline(config),
     };
 
     var renderVars = {
@@ -172,7 +172,7 @@ module.exports = function(crowi, app) {
     var queryOptions = {
       offset: offset,
       limit : limit + 1,
-      isPopulateRevision: Config.isEnabledTimeline(config),
+      isPopulateRevisionBody: Config.isEnabledTimeline(config),
     };
 
     var renderVars = {

+ 2 - 22
lib/views/admin/app.html

@@ -277,11 +277,11 @@
           <label for="settingForm[plugin:isEnabledPlugins]" class="col-xs-3 control-label">プラグインを読み込む</label>
           <div class="col-xs-6">
             <div class="btn-group btn-toggle" data-toggle="buttons">
-              <label class="btn {% if settingForm['plugin:isEnabledPlugins'] %}btn-primary active{% else %}btn-default{% endif %}">
+              <label class="btn btn-default {% if settingForm['plugin:isEnabledPlugins'] %}active{% endif %}" data-active-class="primary">
                 <input name="settingForm[plugin:isEnabledPlugins]" value="true" type="radio"
                     {% if true === settingForm['plugin:isEnabledPlugins'] %}checked{% endif %}> 有効
               </label>
-              <label class="btn {% if !settingForm['plugin:isEnabledPlugins'] %}btn-primary active{% else %}btn-default{% endif %}">
+              <label class="btn btn-default {% if !settingForm['plugin:isEnabledPlugins'] %}active{% endif %}" data-active-class="primary">
                 <input name="settingForm[plugin:isEnabledPlugins]" value="false" type="radio"
                     {% if !settingForm['plugin:isEnabledPlugins'] %}checked{% endif %}> 無効
               </label>
@@ -351,26 +351,6 @@
       });
     });
 
-    // Bootstrap 3 Toggle Switch Snippet
-    // http://www.bootply.com/92189
-    $('.btn-toggle').click(function() {
-      $(this).find('.btn').toggleClass('active');
-
-      if ($(this).find('.btn-primary').length>0) {
-        $(this).find('.btn').toggleClass('btn-primary');
-      }
-      if ($(this).find('.btn-danger').length>0) {
-        $(this).find('.btn').toggleClass('btn-danger');
-      }
-      if ($(this).find('.btn-success').length>0) {
-        $(this).find('.btn').toggleClass('btn-success');
-      }
-      if ($(this).find('.btn-info').length>0) {
-        $(this).find('.btn').toggleClass('btn-info');
-      }
-
-      $(this).find('.btn').toggleClass('btn-default');
-    });
   </script>
 
 </div>

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

@@ -153,11 +153,11 @@
           <label for="settingForm[customize:isEnabledTimeline]" class="col-xs-3 control-label">タイムライン表示機能</label>
           <div class="col-xs-9">
             <div class="btn-group btn-toggle" data-toggle="buttons">
-              <label class="btn {% if settingForm['customize:isEnabledTimeline'] %}btn-primary active{% else %}btn-default{% endif %}">
+              <label class="btn btn-default {% if settingForm['customize:isEnabledTimeline'] %}active{% endif %}" data-active-class="primary">
                 <input name="settingForm[customize:isEnabledTimeline]" value="true" type="radio"
                     {% if true === settingForm['customize:isEnabledTimeline'] %}checked{% endif %}> 有効
               </label>
-              <label class="btn {% if !settingForm['customize:isEnabledTimeline'] %}btn-primary active{% else %}btn-default{% endif %}">
+              <label class="btn btn-default {% if !settingForm['customize:isEnabledTimeline'] %}active{% endif %}" data-active-class="primary">
                 <input name="settingForm[customize:isEnabledTimeline]" value="false" type="radio"
                     {% if !settingForm['customize:isEnabledTimeline'] %}checked{% endif %}> 無効
               </label>
@@ -290,26 +290,6 @@
       }
     });
 
-    // Bootstrap 3 Toggle Switch Snippet
-    // http://www.bootply.com/92189
-    $('.btn-toggle').click(function() {
-      $(this).find('.btn').toggleClass('active');
-
-      if ($(this).find('.btn-primary').length>0) {
-        $(this).find('.btn').toggleClass('btn-primary');
-      }
-      if ($(this).find('.btn-danger').length>0) {
-        $(this).find('.btn').toggleClass('btn-danger');
-      }
-      if ($(this).find('.btn-success').length>0) {
-        $(this).find('.btn').toggleClass('btn-success');
-      }
-      if ($(this).find('.btn-info').length>0) {
-        $(this).find('.btn').toggleClass('btn-info');
-      }
-
-      $(this).find('.btn').toggleClass('btn-default');
-    });
   </script>
 
 </div>

+ 4 - 27
lib/views/admin/markdown.html

@@ -47,11 +47,11 @@
           </label>
           <div class="col-xs-5">
             <div class="btn-group btn-toggle" data-toggle="buttons">
-              <label class="btn {% if markdownSetting['markdown:isEnabledLinebreaks'] %}btn-primary active{% else %}btn-default{% endif %}">
+              <label class="btn btn-default {% if markdownSetting['markdown:isEnabledLinebreaks'] %}active{% endif %}" data-active-class="primary">
                 <input name="markdownSetting[markdown:isEnabledLinebreaks]" value="true" type="radio"
                     {% if true === markdownSetting['markdown:isEnabledLinebreaks'] %}checked{% endif %}> 有効
               </label>
-              <label class="btn {% if !markdownSetting['markdown:isEnabledLinebreaks'] %}btn-primary active{% else %}btn-default{% endif %}">
+              <label class="btn btn-default {% if !markdownSetting['markdown:isEnabledLinebreaks'] %}active{% endif %}" data-active-class="primary">
                 <input name="markdownSetting[markdown:isEnabledLinebreaks]" value="false" type="radio"
                     {% if !markdownSetting['markdown:isEnabledLinebreaks'] %}checked{% endif %}> 無効
               </label>
@@ -66,11 +66,11 @@
           </label>
           <div class="col-xs-5">
             <div class="btn-group btn-toggle" data-toggle="buttons">
-              <label class="btn {% if markdownSetting['markdown:isEnabledLinebreaksInComments'] %}btn-primary active{% else %}btn-default{% endif %}">
+              <label class="btn btn-default {% if markdownSetting['markdown:isEnabledLinebreaksInComments'] %}active{% endif %}" data-active-class="primary">
                 <input name="markdownSetting[markdown:isEnabledLinebreaksInComments]" value="true" type="radio"
                     {% if true === markdownSetting['markdown:isEnabledLinebreaksInComments'] %}checked{% endif %}> 有効
               </label>
-              <label class="btn {% if !markdownSetting['markdown:isEnabledLinebreaksInComments'] %}btn-primary active{% else %}btn-default{% endif %}">
+              <label class="btn btn-default {% if !markdownSetting['markdown:isEnabledLinebreaksInComments'] %}active{% endif %}" data-active-class="primary">
                 <input name="markdownSetting[markdown:isEnabledLinebreaksInComments]" value="false" type="radio"
                     {% if !markdownSetting['markdown:isEnabledLinebreaksInComments'] %}checked{% endif %}> 無効
               </label>
@@ -91,29 +91,6 @@
     </div>
   </div>
 
-  <script>
-    // Bootstrap 3 Toggle Switch Snippet
-    // http://www.bootply.com/92189
-    $('.btn-toggle').click(function() {
-      $(this).find('.btn').toggleClass('active');
-
-      if ($(this).find('.btn-primary').length>0) {
-        $(this).find('.btn').toggleClass('btn-primary');
-      }
-      if ($(this).find('.btn-danger').length>0) {
-        $(this).find('.btn').toggleClass('btn-danger');
-      }
-      if ($(this).find('.btn-success').length>0) {
-        $(this).find('.btn').toggleClass('btn-success');
-      }
-      if ($(this).find('.btn-info').length>0) {
-        $(this).find('.btn').toggleClass('btn-info');
-      }
-
-      $(this).find('.btn').toggleClass('btn-default');
-    });
-  </script>
-
 </div>
 {% endblock content_main %}
 

+ 1 - 1
lib/views/crowi-plus/new_page.html

@@ -38,7 +38,7 @@
         {% block content_main_before %}
         <h2 class="text-muted">
           <i class="fa fa-info-circle" aria-hidden="true"></i>
-          Page is not exists
+          Page is not found
         </h2>
         {% endblock %}
 

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "crowi-plus",
-  "version": "1.2.5-RC",
+  "version": "1.2.6-RC",
   "description": "Enhanced Crowi",
   "tags": [
     "wiki",

+ 17 - 0
resource/css/_admin.scss

@@ -1,3 +1,6 @@
+// import crowi variable
+@import 'utilities';
+
 .crowi { // {{{
 
   .admin-user-menu {
@@ -14,4 +17,18 @@
     }
   }
 
+  // Toggle Twitter Bootstrap button class when active
+  // https://jsfiddle.net/ms040m01/3/
+  .btn-group.btn-toggle {
+    .btn.active[data-active-class="primary"] {
+      color: $btn-primary-color;
+      background-color: darken($btn-primary-bg, 10%);
+      border-color: $btn-primary-border;
+
+      &:hover {
+        background-color: darken($btn-primary-bg, 15%);
+      }
+    }
+  }
+
 } // }}}