Sotaro KARASAWA пре 10 година
родитељ
комит
9682727bd0
4 измењених фајлова са 15 додато и 8 уклоњено
  1. 8 0
      lib/util/middlewares.js
  2. 3 1
      lib/views/page.html
  3. 2 3
      lib/views/page_list.html
  4. 2 4
      resource/js/crowi.js

+ 8 - 0
lib/util/middlewares.js

@@ -59,6 +59,14 @@ exports.swigFilters = function(app, swig) {
         .replace(/\n/g, '<br>');
     });
 
+    swig.setFilter('insertSpaceToEachSlashes', function(string) {
+      if (string == '/') {
+        return string;
+      }
+
+      return string.replace(/\//g, ' / ');
+    });
+
     swig.setFilter('removeLastSlash', function(string) {
       if (string == '/') {
         return string;

+ 3 - 1
lib/views/page.html

@@ -15,7 +15,7 @@
     {% if page %}
       <a href="#" title="Bookmark" class="bookmark-link" id="bookmark-button" data-bookmarked="0"><i class="fa fa-star-o"></i></a>
     {% endif %}
-    <h1 class="title" id="revision-path">{{ path }}</h1>
+    <h1 class="title" id="revision-path">{{ path|insertSpaceToEachSlashes }}</h1>
   </header>
 </div>
 
@@ -30,6 +30,8 @@
 {% endblock %}
 
 <div id="content-main" class="content-main {% if not page or req.body.pageForm %}on-edit{% endif %}"
+  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-page-revision-id="{% if revision %}{{ revision._id.toString() }}{% endif %}"

+ 2 - 3
lib/views/page_list.html

@@ -14,7 +14,7 @@
 
     {% endif %}
     <h1 class="title" id="revision-path">
-      {{ path }}
+      {{ path|insertSpaceToEachSlashes }}
     </h1>
   </header>
 </div>
@@ -67,8 +67,7 @@
   </ul>
 
   <div class="tab-content">
-    <div class="wiki tab-pane {% if not req.body.pageForm %}active{% endif %}" id="revision-body-content">
-    </div>
+    <div class="wiki tab-pane {% if not req.body.pageForm %}active{% endif %}" id="revision-body-content">{{ page.revision.body|nl2br|safe }}</div>
 
     <script type="text/template" id="raw-text-original">{{ page.revision.body }}</script>
     <script type="text/javascript">

+ 2 - 4
resource/js/crowi.js

@@ -19,10 +19,8 @@ Crowi.createErrorView = function(msg) {
 Crowi.linkPath = function(revisionPath) {
   var $revisionPath = revisionPath || '#revision-path';
   var $title = $($revisionPath);
-  if (!$title.get(0)) {
-    return;
-  }
-  var realPath = $title.text().trim();
+
+  var realPath = $('#content-main').data('path').trim();
   if (realPath.substr(-1, 1) == '/') {
     realPath = realPath.substr(0, realPath.length - 1);
   }