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

refactor new_page.html (move to not_found.html)

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

+ 1 - 1
lib/routes/page.js

@@ -243,7 +243,7 @@ module.exports = function(crowi, app) {
     }).catch(function(err) {
       // page not exists
       // change template
-      pageTeamplate = 'crowi-plus/new_page';
+      pageTeamplate = 'customlayout-selector/not_found';
     }).then(function() {
       return Page.findListByStartWith(path, req.user, queryOptions)
         .then(function(pageList) {

+ 55 - 0
lib/views/crowi-plus/base/not_found_nosidebar.html

@@ -0,0 +1,55 @@
+{% extends '../../not_found.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 #}
+
+
+{% block footer %}
+  {% parent %}
+  <div class="system-version">
+    <span>
+      <a href="https://github.com/weseek/crowi-plus">crowi-plus</a> {{ crowiVersion() }}
+    </span>
+    <span>
+      <a href="" data-target="#help-modal" data-toggle="modal"><i class="fa fa-question-circle"></i> {{ t('Help') }}</a>
+    </span>
+  </div>
+{% endblock %}

+ 0 - 123
lib/views/crowi-plus/new_page.html

@@ -1,123 +0,0 @@
-{% extends 'base/page_nosidebar.html' %}
-
-{% block main_css_class %}
-  main-crowi-plus-customized
-  {% parent %}
-{% endblock %}
-
-{% block content_head %}
-
-  {% block content_head_before %}
-  {% endblock %}
-
-  <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>
-          <h1 class="title flex-item-title" id="revision-path"></h1>
-          <div id="revision-url" class="url-line"></div>
-        </div>
-      </div>
-
-    </header>
-  </div>
-
-  {% block content_head_after %}
-  {% endblock %}
-
-{% endblock %} {# /content_head #}
-
-{% block content_main %}
-  <div class="container-fluid">
-    <div class="row">
-
-      <div class="col-lg-10 col-md-9">
-
-        {% block content_main_before %}
-        <h2 class="text-muted">
-          <i class="fa fa-info-circle" aria-hidden="true"></i>
-          Page is not found
-        </h2>
-        {% endblock %}
-
-
-
-        <div id="content-main" class="content-main content-main-new-page page-list"
-          data-path="{{ path }}"
-          data-path-shortname="{{ path|path2name }}"
-          data-page-id="{% if page %}{{ page._id.toString() }}{% endif %}"
-          data-current-user="{% if user %}{{ user._id.toString() }}{% endif %}"
-          data-current-username="{% if user %}{{ user.username }}{% endif %}"
-          data-page-revision-id="{% if revision %}{{ revision._id.toString() }}{% endif %}"
-          data-page-revision-created="{% if revision %}{{ revision.createdAt|datetz('U') }}{% endif %}"
-          data-page-is-seen="{% if page and page.isSeenUser(user) %}1{% else %}0{% endif %}"
-          data-linebreaks-enabled="{{ isEnabledLinebreaks() }}"
-          data-csrftoken="{{ csrf() }}"
-          >
-
-          <ul class="nav nav-tabs hidden-print">
-            <li class="active"><a href="#revision-body" data-toggle="tab">{{ t('List View') }}</a></li>
-
-            <li>
-              <a {% if user %}href="#edit-form" data-toggle="tab"{% endif %} class="edit-button {% if not user %}edit-button-disabled{% endif %}">
-                <i class="fa fa-pencil-square-o"></i> {{ t('Create') }}
-              </a>
-            </li>
-
-            {% if user %}
-            <li class="dropdown pull-right">
-              <a href="#" onclick="history.back();"><i class="fa fa-times"></i> {{ t('Cancel') }}</a>
-            </li>
-            {% endif %}
-          </ul>
-
-          <div class="tab-content wiki-content">
-            {% if req.query.renamed %}
-            <div class="alert alert-info alert-moved">
-              <span>
-                <strong>{{ t('Moved') }}: </strong> {{ t('page_page.notice.moved', req.query.renamed) }}
-              </span>
-            </div>
-            {% endif %}
-            {% if req.query.unlinked %}
-            <div class="alert alert-info">
-              <strong>{{ t('Unlinked') }}: </strong> {{ t('page_page.notice.unlinked') }}
-            </div>
-            {% endif %}
-
-            {# list view #}
-            <div class="active tab-pane page-list-container" id="revision-body">
-              {% if pages.length == 0 %}
-                There are no pages under <strong>{{ path }}</strong>.
-              {% endif  %}
-
-              {% include '../widget/page_list.html' with { pages: pages, pager: pager, viewConfig: viewConfig } %}
-            </div>
-
-            {# edit view #}
-            <div class="edit-form tab-pane {% if req.body.pageForm %}active{% endif %}" id="edit-form">
-              {% include '../_form.html' %}
-            </div>
-
-          </div>
-        </div>
-
-        {% block content_main_after %}
-        {% endblock %}
-
-
-
-      </div> {# /.col- #}
-
-    </div>
-  </div>
-
-{% endblock %}
-
-{% block content_main_after %}
-{% endblock %}
-
-{% block content_footer %}
-{% endblock %}

+ 34 - 0
lib/views/crowi-plus/not_found.html

@@ -0,0 +1,34 @@
+{% extends 'base/not_found_nosidebar.html' %}
+
+{% block main_css_class %}
+  main-crowi-plus-customized
+  {% parent %}
+{% endblock %}
+
+{% block content_head %}
+
+  {% block content_head_before %}
+  {% endblock %}
+
+  {% include 'widget/header.html' %}
+
+  {% block content_head_after %}
+  {% endblock %}
+
+{% endblock %} {# /content_head #}
+
+
+{% block content_main %}
+  <div class="container-fluid">
+    <div class="row">
+
+      <div class="col-lg-10 col-md-9">
+
+        {% parent %}
+
+      </div> {# /.col- #}
+
+    </div>
+
+  </div>
+{% endblock %}

+ 1 - 1
lib/views/crowi-plus/widget/header.html

@@ -53,7 +53,7 @@
       </ul>
       {% endif %}
 
-      {% if not page and not isUserPageList(path) and !isTrashPage() %}
+      {% if not page and ('crowi' === behaviorType()) and not isUserPageList(path) and !isTrashPage() %}
       <div class="portal-form-button">
         <button class="btn btn-primary" id="create-portal-button" {% if not user %}disabled{% endif %}>Create Portal</button>
         <p class="help-block"><a href="#" data-target="#help-portal" data-toggle="modal"><i class="fa fa-question-circle"></i> What is Portal?</a></p>

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

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

+ 103 - 0
lib/views/not_found.html

@@ -0,0 +1,103 @@
+{% extends 'layout/2column.html' %}
+
+{% block content_head %}
+
+  {% block content_head_before %}
+  {% endblock %}
+
+  <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>
+          <h1 class="title flex-item-title" id="revision-path"></h1>
+          <div id="revision-url" class="url-line"></div>
+        </div>
+      </div>
+
+    </header>
+  </div>
+
+  {% block content_head_after %}
+  {% endblock %}
+
+{% endblock %} {# /content_head #}
+
+{% block content_main %}
+
+{% block content_main_before %}
+{% endblock %}
+
+<div id="content-main" class="content-main content-main-not-found page-list"
+  data-path="{{ path }}"
+  data-path-shortname="{{ path|path2name }}"
+  data-page-id="{% if page %}{{ page._id.toString() }}{% endif %}"
+  data-current-user="{% if user %}{{ user._id.toString() }}{% endif %}"
+  data-current-username="{% if user %}{{ user.username }}{% endif %}"
+  data-page-revision-id="{% if revision %}{{ revision._id.toString() }}{% endif %}"
+  data-page-revision-created="{% if revision %}{{ revision.createdAt|datetz('U') }}{% endif %}"
+  data-page-is-seen="{% if page and page.isSeenUser(user) %}1{% else %}0{% endif %}"
+  data-linebreaks-enabled="{{ isEnabledLinebreaks() }}"
+  data-csrftoken="{{ csrf() }}"
+  >
+
+  <h2 class="message-not-found text-muted">
+    <i class="fa fa-info-circle" aria-hidden="true"></i>
+    Page is not found
+  </h2>
+
+  <ul class="nav nav-tabs hidden-print">
+    <li class="active"><a href="#revision-body" data-toggle="tab">{{ t('List View') }}</a></li>
+
+    <li>
+      <a {% if user %}href="#edit-form" data-toggle="tab"{% endif %} class="edit-button {% if not user %}edit-button-disabled{% endif %}">
+        <i class="fa fa-pencil-square-o"></i> {{ t('Create') }}
+      </a>
+    </li>
+
+    {% if user %}
+    <li class="dropdown pull-right">
+      <a href="#" onclick="history.back();"><i class="fa fa-times"></i> {{ t('Cancel') }}</a>
+    </li>
+    {% endif %}
+  </ul>
+
+  <div class="tab-content wiki-content">
+    {% if req.query.renamed %}
+    <div class="alert alert-info alert-moved">
+      <span>
+        <strong>{{ t('Moved') }}: </strong> {{ t('page_page.notice.moved', req.query.renamed) }}
+      </span>
+    </div>
+    {% endif %}
+    {% if req.query.unlinked %}
+    <div class="alert alert-info">
+      <strong>{{ t('Unlinked') }}: </strong> {{ t('page_page.notice.unlinked') }}
+    </div>
+    {% endif %}
+
+    {# list view #}
+    <div class="active tab-pane page-list-container" id="revision-body">
+      {% if pages.length == 0 %}
+        There are no pages under <strong>{{ path }}</strong>.
+      {% endif  %}
+
+      {% include 'widget/page_list.html' with { pages: pages, pager: pager, viewConfig: viewConfig } %}
+    </div>
+
+    {# edit view #}
+    <div class="edit-form tab-pane {% if req.body.pageForm %}active{% endif %}" id="edit-form">
+      {% include '_form.html' %}
+    </div>
+
+  </div>
+</div>
+
+{% block content_main_after %}
+{% endblock %}
+
+{% endblock %}
+
+{% block content_footer %}
+{% endblock %}

+ 9 - 0
resource/css/_page.scss

@@ -372,3 +372,12 @@
   }
 
 } // }}}
+
+.crowi.main-container .content-main.content-main-not-found {
+  .message-not-found {
+    margin-top: 10px;
+  }
+  .nav {
+    margin-top: 30px;
+  }
+}

+ 0 - 6
resource/css/_page_crowi-plus.scss

@@ -43,9 +43,3 @@
     margin-top: 15px;
   }
 }
-
-.crowi-plus .content-main-new-page {
-  .nav {
-    margin-top: 30px;
-  }
-}