Przeglądaj źródła

Merge pull request #124 from weseek/master

release v1.2.15
Yuki Takei 8 lat temu
rodzic
commit
c8260e8f96

+ 6 - 0
CHANGES.md

@@ -1,6 +1,12 @@
 CHANGES
 ========
 
+## 1.2.15
+
+* Improvement: Optimize cache settings for express server
+* Improvement: Add a logo link to the affix header
+* Fix: Child pages under `/trash` are not shown when applying crowi-plus Simplified Behavior
+
 ## 1.2.14
 
 * Fix: Tabs(`a[data-toggle="tab"][href="#..."]`) push browser history twice

+ 3 - 2
lib/crowi/express-init.js

@@ -80,13 +80,14 @@ module.exports = function(crowi, app) {
   });
 
   app.set('port', crowi.port);
-  app.use(express.static(crowi.publicDir));
+  const staticOption = (crowi.node_env === 'production') ? {maxAge:'30d'} : {};
+  app.use(express.static(crowi.publicDir, staticOption));
   app.engine('html', cons.swig);
   app.use(webpackAssets(
     path.join(crowi.publicDir, 'js/webpack-assets.json'),
     { devMode: (crowi.node_env === 'development') })
   );
-  app.set('view cache', false);
+  // app.set('view cache', false);  // Default: true in production, otherwise undefined. -- 2017.07.04 Yuki Takei
   app.set('view engine', 'html');
   app.set('views', crowi.viewsDir);
   app.use(methodOverride());

+ 3 - 2
lib/routes/index.js

@@ -139,8 +139,9 @@ module.exports = function(crowi, app) {
   //app.get('/_api/r/:revisionId'    , user.useUserData()         , page.api.get);
 
   app.post('/_/edit'                 , form.revision             , loginRequired(crowi, app) , csrf, page.pageEdit);
-  app.get('/trash/$'                 , loginRequired(crowi, app, false) , page.deletedPageListShow);
-  app.get('/trash/*/$'               , loginRequired(crowi, app, false) , page.deletedPageListShow);
+  app.get('/trash$'                  , loginRequired(crowi, app, false) , page.trashPageShowWrapper);
+  app.get('/trash/$'                 , loginRequired(crowi, app, false) , page.trashPageListShowWrapper);
+  app.get('/trash/*/$'               , loginRequired(crowi, app, false) , page.deletedPageListShowWrapper);
 
   app.get('/*/$'                   , loginRequired(crowi, app, false) , page.pageListShowWrapper);
   app.get('/*'                     , loginRequired(crowi, app, false) , page.pageShowWrapper);

+ 48 - 0
lib/routes/page.js

@@ -89,6 +89,53 @@ module.exports = function(crowi, app) {
       return actions.pageShow(req, res);
     }
   }
+  /**
+   * switch action by behaviorType
+   */
+  actions.trashPageListShowWrapper = function(req, res) {
+    const behaviorType = Config.behaviorType(config);
+
+    if ('crowi-plus' === behaviorType) {
+      // redirect to '/trash'
+      return res.redirect('/trash');
+    }
+    // official Crowi behavior for '/trash/*'
+    else {
+      return actions.deletedPageListShow(req, res);
+    }
+  }
+  /**
+   * switch action by behaviorType
+   */
+  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 {
+      // redirect to '/trash/'
+      return res.redirect('/trash/');
+    }
+
+  }
+  /**
+   * switch action by behaviorType
+   */
+  actions.deletedPageListShowWrapper = function(req, res) {
+    const behaviorType = Config.behaviorType(config);
+
+    if ('crowi-plus' === behaviorType) {
+      const path = '/trash' + getPathFromRequest(req);
+      return res.redirect(path);
+    }
+    // official Crowi behavior for '/trash/*'
+    else {
+      return actions.deletedPageListShow(req, res);
+    }
+  }
+
 
   actions.pageListShow = function(req, res) {
     var path = getPathFromRequest(req);
@@ -173,6 +220,7 @@ module.exports = function(crowi, app) {
       offset: offset,
       limit : limit + 1,
       isPopulateRevisionBody: Config.isEnabledTimeline(config),
+      includeDeletedPage: path.startsWith('/trash/'),
     };
 
     var renderVars = {

+ 6 - 3
lib/views/crowi-plus/widget/header.html

@@ -1,9 +1,12 @@
 <div class="header-wrap">
   <header id="page-header">
-    <p class="stopper"><a href="#" data-affix-disable="#page-header"><i class="fa fa-chevron-up"></i></a></p>
-
     <div class="flex-title-line">
-      <div>
+      <div class="title-logo-container">
+        <a href="/">
+          <img alt="Crowi" src="/logo/32x32_g.png" />
+        </a>
+      </div>
+      <div class="title-container">
         <h1 class="title flex-item-title" id="revision-path"></h1>
         <div id="revision-url" class="url-line"></div>
       </div>

+ 1 - 1
package.json

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

BIN
public/logo/32x32_g.png


+ 30 - 2
resource/css/_page_crowi-plus.scss

@@ -1,8 +1,27 @@
 .crowi-plus.main-container {
   .flex-title-line {
 
+    div.title-logo-container {
+      display: none;  // hide in default
+
+      a {
+        width: 32px;
+        height: 32px;
+
+        // centering
+        display: flex;
+        align-items: center;
+        justify-content: center;
+
+        img {
+          width: 16px;
+          height: 16px;
+        }
+      }
+    }
+
     // the container of h1
-    div:first-child {
+    div.title-container {
       margin-right: auto;
     }
 
@@ -28,8 +47,17 @@
 
   }
 
-  // hide authors in affix
+  /*
+   * affix header
+   */
   .main #page-header.affix {
+    // show logo link
+    div.title-logo-container {
+      display: unset;
+      margin-left: -12px;
+      margin-right: 6px;
+    }
+    // hide authors in affix
     .authors {
       display: none !important;
     }