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

Merge branch 'master' of github.com:crowi/crowi

Sotaro KARASAWA 9 лет назад
Родитель
Сommit
df792b4b67
4 измененных файлов с 34 добавлено и 18 удалено
  1. 7 0
      lib/util/swigFunctions.js
  2. 2 0
      lib/views/page.html
  3. 21 16
      lib/views/page_list.html
  4. 4 2
      resource/js/crowi.js

+ 7 - 0
lib/util/swigFunctions.js

@@ -66,6 +66,13 @@ module.exports = function(crowi, app, req, locals) {
     return false;
     return false;
   };
   };
 
 
+  locals.isDeletablePage = function() {
+    var Page = crowi.model('Page');
+    var path = req.path || '';
+
+    return Page.isDeletableName(path);
+  };
+
   locals.userPageRoot = function(user) {
   locals.userPageRoot = function(user) {
     if (!user || !user.username) {
     if (!user || !user.username) {
       return '';
       return '';

+ 2 - 0
lib/views/page.html

@@ -102,8 +102,10 @@
       <ul class="dropdown-menu">
       <ul class="dropdown-menu">
        <li><a href="#" data-target="#renamePage" data-toggle="modal"><i class="fa fa-share"></i> 移動</a></li>
        <li><a href="#" data-target="#renamePage" data-toggle="modal"><i class="fa fa-share"></i> 移動</a></li>
        <li><a href="?presentation=1" class="toggle-presentation"><i class="fa fa-arrows-alt"></i> プレゼンモード (beta)</a></li>
        <li><a href="?presentation=1" class="toggle-presentation"><i class="fa fa-arrows-alt"></i> プレゼンモード (beta)</a></li>
+       {% if isDeletablePage() %}
        <li class="divider"></li>
        <li class="divider"></li>
        <li class=""><a href="#" data-target="#deletePage" data-toggle="modal"><i class="fa fa-trash-o text-danger"></i> 削除</a></li>
        <li class=""><a href="#" data-target="#deletePage" data-toggle="modal"><i class="fa fa-trash-o text-danger"></i> 削除</a></li>
+       {% endif %}
       </ul>
       </ul>
     </li>
     </li>
     {% if page %}
     {% if page %}

+ 21 - 16
lib/views/page_list.html

@@ -154,22 +154,27 @@
 
 
   <div class="tab-content">
   <div class="tab-content">
     {% if pages.length == 0 %}
     {% if pages.length == 0 %}
-    There are no pages under <strong>{{ path }}</strong>.
-
-    <h3>Next Actions</h3>
-
-    <ul>
-      <li>Create portal page?
-        <ul>
-          <li>Great! To create the portal of <strong>{{ path }}</strong>, click "Create Portal" button.</li>
-        </ul>
-      </li>
-      <li>Create the under page directly?
-        <ul>
-          <li>Nice. To create the page under <strong>{{ path }}</strong> directly, type the page name on your browser.</li>
-        </ul>
-      </li>
-    </ul>
+
+      {% if isTrashPage() %}
+      No deleted pages.
+      {% else %}
+      There are no pages under <strong>{{ path }}</strong>.
+
+      <h3>Next Actions</h3>
+
+      <ul>
+        <li>Create portal page?
+          <ul>
+            <li>Great! To create the portal of <strong>{{ path }}</strong>, click "Create Portal" button.</li>
+          </ul>
+        </li>
+        <li>Create the under page directly?
+          <ul>
+            <li>Nice. To create the page under <strong>{{ path }}</strong> directly, type the page name on your browser.</li>
+          </ul>
+        </li>
+      </ul>
+      {% endif %}
     {% endif  %}
     {% endif  %}
 
 
     {# list view #}
     {# list view #}

+ 4 - 2
resource/js/crowi.js

@@ -933,7 +933,8 @@ Crowi.findHashFromUrl = function(url)
 
 
 Crowi.unhighlightSelectedSection = function(hash)
 Crowi.unhighlightSelectedSection = function(hash)
 {
 {
-  if (!hash || hash == "") {
+  if (!hash || hash == "" || !hash.match(/^head.+/)) {
+    // とりあえず head* だけ (検索結果ページで副作用出た
     return true;
     return true;
   }
   }
   $(hash).removeClass('highlighted');
   $(hash).removeClass('highlighted');
@@ -941,7 +942,8 @@ Crowi.unhighlightSelectedSection = function(hash)
 
 
 Crowi.highlightSelectedSection = function(hash)
 Crowi.highlightSelectedSection = function(hash)
 {
 {
-  if (!hash || hash == "") {
+  if (!hash || hash == "" || !hash.match(/^head.+/)) {
+    // とりあえず head* だけ (検索結果ページで副作用出た
     return true;
     return true;
   }
   }
   $(hash).addClass('highlighted');
   $(hash).addClass('highlighted');