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

Merge pull request #29 from weseek/rc/1.0.x

release v1.0.2
Yuki Takei 9 лет назад
Родитель
Сommit
aa9cc5f727

+ 2 - 4
README.md

@@ -1,15 +1,13 @@
 ![Crowi](http://res.cloudinary.com/hrscywv4p/image/upload/c_limit,f_auto,h_900,q_80,w_1200/v1/199673/https_www_filepicker_io_api_file_VpYEP32ZQyCZ85u6XCXo_zskpra.png)
 
 <p align="center">
-  <a href="https://heroku.com/deploy?template=https://github.com/weseek/crowi-plus/tree/v1.0.1"><img src="https://www.herokucdn.com/deploy/button.png"></a>
+  <a href="https://heroku.com/deploy?template=https://github.com/weseek/crowi-plus/tree/v1.0.2"><img src="https://www.herokucdn.com/deploy/button.png"></a>
 </p>
 
 
-crowi-plus
+crowi-plus [![Chat on Slack](https://crowi-plus-slackin.weseek.co.jp/badge.svg)](https://crowi-plus-slackin.weseek.co.jp/)
 ===========
 
-[Chat on Slack](https://crowi-plus.slack.com/)
-
 [![wercker status](https://app.wercker.com/status/39cdc49d067d65c39cb35d52ceae6dc1/s/master "wercker status")](https://app.wercker.com/project/byKey/39cdc49d067d65c39cb35d52ceae6dc1)
 [![dependencies status](https://david-dm.org/weseek/crowi-plus.svg)](https://david-dm.org/weseek/crowi-plus)
 [![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE)

+ 43 - 37
lib/models/page.js

@@ -593,8 +593,6 @@ module.exports = function(crowi) {
   pageSchema.statics.findListByStartWith = function(path, userData, option) {
     var Page = this;
     var User = crowi.model('User');
-    var pathCondition = [];
-    var includeDeletedPage = option.includeDeletedPage || false
 
     if (!option) {
       option = {sort: 'updatedAt', desc: -1, offset: 0, limit: 50};
@@ -607,52 +605,60 @@ module.exports = function(crowi) {
     };
     var sortOpt = {};
     sortOpt[opt.sort] = opt.desc;
-    var queryReg = new RegExp('^' + path);
-    var sliceOption = option.revisionSlice || {$slice: 1};
-
-    pathCondition.push({path: queryReg});
-    if (path.match(/\/$/)) {
-      debug('Page list by ending with /, so find also upper level page');
-      pathCondition.push({path: path.substr(0, path.length -1)});
-    }
 
     return new Promise(function(resolve, reject) {
-      // FIXME: might be heavy
-      var q = Page.find({
-        redirectTo: null,
-        $or: [
-          {grant: null},
-          {grant: GRANT_PUBLIC},
-          {grant: GRANT_RESTRICTED, grantedUsers: userData._id},
-          {grant: GRANT_SPECIFIED, grantedUsers: userData._id},
-          {grant: GRANT_OWNER, grantedUsers: userData._id},
-        ],})
+      var q = Page.generateQueryToListByStartWith(path, userData, option)
         .populate('revision')
-        .and({
-          $or: pathCondition
-        })
         .sort(sortOpt)
         .skip(opt.offset)
         .limit(opt.limit);
 
-      if (!includeDeletedPage) {
-        q.and({
-          $or: [
-            {status: null},
-            {status: STATUS_PUBLISHED},
-          ],
-        });
-      }
-
       q.exec()
-      .then(function(pages) {
-        Page.populate(pages, {path: 'revision.author', model: 'User', select: User.USER_PUBLIC_FIELDS})
-        .then(resolve)
-        .catch(reject);
-      })
+        .then(function(pages) {
+          Page.populate(pages, {path: 'revision.author', model: 'User', select: User.USER_PUBLIC_FIELDS})
+          .then(resolve)
+          .catch(reject);
+        })
     });
   };
 
+  pageSchema.statics.generateQueryToListByStartWith = function(path, userData, option) {
+    var Page = this;
+    var pathCondition = [];
+    var includeDeletedPage = option.includeDeletedPage || false;
+
+    var queryReg = new RegExp('^' + path);
+    pathCondition.push({path: queryReg});
+    if (path.match(/\/$/)) {
+      debug('Page list by ending with /, so find also upper level page');
+      pathCondition.push({path: path.substr(0, path.length -1)});
+    }
+
+    var q = Page.find({
+      redirectTo: null,
+      $or: [
+        {grant: null},
+        {grant: GRANT_PUBLIC},
+        {grant: GRANT_RESTRICTED, grantedUsers: userData._id},
+        {grant: GRANT_SPECIFIED, grantedUsers: userData._id},
+        {grant: GRANT_OWNER, grantedUsers: userData._id},
+      ],})
+      .and({
+        $or: pathCondition
+      });
+
+    if (!includeDeletedPage) {
+      q.and({
+        $or: [
+          {status: null},
+          {status: STATUS_PUBLISHED},
+        ],
+      });
+    }
+
+    return q;
+  }
+
   pageSchema.statics.updatePageProperty = function(page, updateData) {
     var Page = this;
     return new Promise(function(resolve, reject) {

+ 1 - 1
lib/views/widget/page_list.html

@@ -1,4 +1,4 @@
-<ul class="page-list-ul">
+<ul class="page-list-ul page-list-ul-flat">
 {% for data in pages %}
 
 {% if pagePropertyName %}

+ 1 - 1
package.json

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

+ 12 - 1
resource/css/_page_list.scss

@@ -30,6 +30,7 @@
     > li {
       list-style: none;
       line-height: 1.8em;
+      color: #666;
 
       .page-list-option {
         float: right;
@@ -45,7 +46,7 @@
         display: inline;
         padding: 0 4px;
         font-size: 1.1em;
-        color: #666;
+        color: inherit;
 
         strong {
           color: #333;
@@ -57,5 +58,15 @@
         color: #999;
       }
     }
+
+    // after second level indent
+    .page-list-ul {
+      padding-left: 1rem;
+    }
+
+    // override .page-list-ul
+    &.page-list-ul-flat {
+      padding-left: 0;
+    }
   }
 }

+ 1 - 1
resource/js/components/PageList/ListView.js

@@ -11,7 +11,7 @@ export default class ListView extends React.Component {
 
     return (
       <div className="page-list">
-        <ul className="page-list-ul">
+        <ul className="page-list-ul page-list-ul-flat">
         {listView}
         </ul>
       </div>

+ 1 - 1
resource/js/components/SearchPage/SearchResult.js

@@ -80,7 +80,7 @@ export default class SearchResult extends React.Component {
         <div className="search-result row" id="search-result">
           <div className="col-md-4 hidden-xs hidden-sm page-list search-result-list" id="search-result-list">
             <nav data-spy="affix" data-offset-top="120">
-              <ul className="page-list-ul nav">
+              <ul className="page-list-ul page-list-ul-flat nav">
                 {listView}
               </ul>
             </nav>