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

add customlayout-selector for page_list

Yuki Takei 9 лет назад
Родитель
Сommit
fa8c0fd785

+ 3 - 3
lib/routes/page.js

@@ -113,7 +113,7 @@ module.exports = function(crowi, app) {
       };
       renderVars.pager = generatePager(pagerOptions);
       renderVars.pages = pageList;
-      res.render('page_list', renderVars);
+      res.render('customlayout-selector/page_list', renderVars);
     }).catch(function(err) {
       debug('Error on rendering pageListShow', err);
     });
@@ -152,7 +152,7 @@ module.exports = function(crowi, app) {
 
       renderVars.pager = generatePager(pagerOptions);
       renderVars.pages = pageList;
-      res.render('page_list', renderVars);
+      res.render('customlayout-selector/page_list', renderVars);
     }).catch(function(err) {
       debug('Error on rendering deletedPageListShow', err);
     });
@@ -178,7 +178,7 @@ module.exports = function(crowi, app) {
       return Page.findListByPageIds(ids);
     }).then(function(pages) {
 
-      res.render('page_list', {
+      res.render('customlayout-selector/page_list', {
         path: '/',
         pages: pages,
         pager: generatePager({offset: 0, limit: 50})

+ 42 - 0
lib/views/crowi-plus/layout/page_list_nosidebar.html

@@ -0,0 +1,42 @@
+{% extends '../../page_list.html' %}
+
+
+{% block layout_sidebar %}
+{% endblock %}
+
+
+{% block layout_main %}
+<div id="main" class="main col-md-12 {% if page %}{{ css.grant(page) }}{% endif %} {% block main_css_class %}{% endblock %}">
+  {% if page && page.grant != 1 %}
+  <p class="page-grant">
+    <i class="fa fa-lock"></i> {{ consts.pageGrants[page.grant] }} ({{ t('Browsing of this page is restricted') }})
+  </p>
+  {% endif %}
+  {% if page && page.grant == 2 %}
+  <p class="alert alert-info">
+    {{ t('Shareable Link') }}
+    <input type="text" class="copy-link form-control" value="{{ baseUrl }}/{{ page._id.toString() }}" readonly>
+  </p>
+  {% endif %}
+  <article>
+    {% block content_head %}
+      {% parent %}
+    {% endblock %}
+
+    {% block content_main_before %}
+    {% endblock %}
+
+    {% block content_main %}
+      {% parent %}
+    {% endblock content_main %}
+
+    {% block content_main_after %}
+    {% endblock %}
+
+    {% block content_footer %}
+      {% parent %}
+    {% endblock %}
+  </article>
+</div>
+
+{% endblock %} {# layout_main #}

+ 1 - 50
lib/views/crowi-plus/page.html

@@ -6,56 +6,7 @@
   {% block content_head_before %}
   {% endblock %}
 
-  <div class="header-wrap">
-    {% if not page.isDeleted() %}
-    <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>
-          <h1 class="title flex-item-title" id="revision-path"></h1>
-          <div id="revision-url" class="url-line"></div>
-        </div>
-        {% if page %}
-        <div class="flex-item-action">
-          <span id="bookmark-button">
-            <p class="bookmark-link">
-              <i class="fa fa-star-o"></i>
-            </p>
-          </span>
-        </div>
-        <div class="flex-item-action visible-xs visible-sm">
-          <button
-              data-csrftoken="{{ csrf() }}"
-              data-liked="{% if page.isLiked(user) %}1{% else %}0{% endif %}"
-              class="like-button btn btn-default btn-sm {% if page.isLiked(user) %}active{% endif %}"
-          ><i class="fa fa-thumbs-o-up"></i></button>
-        </div>
-        {% endif %}
-
-        {% if page %}
-          {% include 'widget/authors.html' %}
-        {% endif %}
-
-      </div>
-
-    </header>
-    {% else %}
-    {# trash/* #}
-    <header id="page-header">
-      <div class="flex-title-line">
-        <h1 class="title flex-item-title"></h1>
-        <div class="flex-item-action">
-          <span id="bookmark-button">
-            <p class="bookmark-link">
-              <i class="fa fa-star-o"></i>
-            </a>
-          </span>
-        </div>
-      </div>
-    </header>
-    {% endif %}
-  </div>
+  {% include 'widget/header.html' %}
 
   {% block content_head_after %}
   {% endblock %}

+ 22 - 0
lib/views/crowi-plus/page_list.html

@@ -0,0 +1,22 @@
+{% extends 'layout/page_list_nosidebar.html' %}
+
+
+{% block content_head %}
+
+  {% block content_head_before %}
+  {% endblock %}
+
+  {% include 'widget/header.html' %}
+
+  {% block content_head_after %}
+  {% endblock %}
+
+{% endblock %} {# /content_head #}
+
+
+
+{% block content_main_after %}
+  {% if not page.isDeleted() %}
+    {% include 'widget/comments.html' %}
+  {% endif %}
+{% endblock %}

+ 0 - 24
lib/views/crowi-plus/widget/authors.html

@@ -1,24 +0,0 @@
-<ul class="authors visible-md visible-lg">
-  <li>
-    <div class="creator-picture">
-      <a href="{{ userPageRoot(page.creator) }}">
-        <img src="{{ page.creator|default(author)|picture }}" class="picture picture-rounded"><br>
-      </a>
-    </div>
-    <div class="">
-      <div>Created by <a href="{{ userPageRoot(page.creator) }}">{{ page.creator.name|default(author.name) }}</a></div>
-      <div class="text-muted">{{ page.createdAt|datetz('Y/m/d H:i:s') }}</div>
-    </div>
-  </li>
-  <li>
-    <div class="creator-picture">
-      <a href="{{ userPageRoot(page.lastUpdateUser) }}">
-        <img src="{{ page.lastUpdateUser|default(author)|picture }}" class="picture picture-rounded"><br>
-      </a>
-    </div>
-    <div class="">
-      <div>Updated by <a href="{{ userPageRoot(page.lastUpdateUser) }}">{{ page.lastUpdateUser.name|default(author.name) }}</a></div>
-      <div class="text-muted">{{ page.updatedAt|datetz('Y/m/d H:i:s') }}</div>
-    </div>
-  </li>
-</ul>

+ 71 - 0
lib/views/crowi-plus/widget/header.html

@@ -0,0 +1,71 @@
+<div class="header-wrap">
+  {% if not page.isDeleted() %}
+  <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>
+        <h1 class="title flex-item-title" id="revision-path"></h1>
+        <div id="revision-url" class="url-line"></div>
+      </div>
+      {% if page %}
+      <div class="flex-item-action">
+        <span id="bookmark-button">
+          <p class="bookmark-link">
+            <i class="fa fa-star-o"></i>
+          </p>
+        </span>
+      </div>
+      <div class="flex-item-action visible-xs visible-sm">
+        <button
+            data-csrftoken="{{ csrf() }}"
+            data-liked="{% if page.isLiked(user) %}1{% else %}0{% endif %}"
+            class="like-button btn btn-default btn-sm {% if page.isLiked(user) %}active{% endif %}"
+        ><i class="fa fa-thumbs-o-up"></i></button>
+      </div>
+
+      <ul class="authors visible-md visible-lg">
+        <li>
+          <div class="creator-picture">
+            <a href="{{ userPageRoot(page.creator) }}">
+              <img src="{{ page.creator|default(author)|picture }}" class="picture picture-rounded"><br>
+            </a>
+          </div>
+          <div class="">
+            <div>Created by <a href="{{ userPageRoot(page.creator) }}">{{ page.creator.name|default(author.name) }}</a></div>
+            <div class="text-muted">{{ page.createdAt|datetz('Y/m/d H:i:s') }}</div>
+          </div>
+        </li>
+        <li>
+          <div class="creator-picture">
+            <a href="{{ userPageRoot(page.lastUpdateUser) }}">
+              <img src="{{ page.lastUpdateUser|default(author)|picture }}" class="picture picture-rounded"><br>
+            </a>
+          </div>
+          <div class="">
+            <div>Updated by <a href="{{ userPageRoot(page.lastUpdateUser) }}">{{ page.lastUpdateUser.name|default(author.name) }}</a></div>
+            <div class="text-muted">{{ page.updatedAt|datetz('Y/m/d H:i:s') }}</div>
+          </div>
+        </li>
+      </ul>
+      {% endif %}
+
+    </div>
+
+  </header>
+  {% else %}
+  {# trash/* #}
+  <header id="page-header">
+    <div class="flex-title-line">
+      <h1 class="title flex-item-title"></h1>
+      <div class="flex-item-action">
+        <span id="bookmark-button">
+          <p class="bookmark-link">
+            <i class="fa fa-star-o"></i>
+          </a>
+        </span>
+      </div>
+    </div>
+  </header>
+  {% endif %}
+</div>

+ 5 - 0
lib/views/customlayout-selector/page_list.html

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