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

Added seener icon and count at page-list view

Norio Suzuki 9 лет назад
Родитель
Сommit
b4f3c31615
3 измененных файлов с 11 добавлено и 1 удалено
  1. 4 0
      lib/routes/page.js
  2. 1 1
      lib/views/page_list.html
  3. 6 0
      lib/views/widget/page_list.html

+ 4 - 0
lib/routes/page.js

@@ -59,6 +59,7 @@ module.exports = function(crowi, app) {
     var path = getPathFromRequest(req);
     var limit = 50;
     var offset = parseInt(req.query.offset)  || 0;
+    var SEENER_THRESHOLD = 10;
     path = path + (path == '/' ? '' : '/');
 
     // index page
@@ -90,6 +91,9 @@ module.exports = function(crowi, app) {
 
       pagerOptions.length = pageList.length;
 
+      renderVars.config = {
+        seener_threshold: SEENER_THRESHOLD
+      };
       renderVars.pager = generatePager(pagerOptions);
       renderVars.pages = pageList;
       res.render('page_list', renderVars);

+ 1 - 1
lib/views/page_list.html

@@ -127,7 +127,7 @@
 
     {# list view #}
     <div class="active tab-pane fade page-list-container in" id="view-list">
-      {% include 'widget/page_list.html' with { pages: pages, pager: pager } %}
+      {% include 'widget/page_list.html' with { pages: pages, pager: pager, config: config } %}
     </div>
 
     {# timeline view #}

+ 6 - 0
lib/views/widget/page_list.html

@@ -31,6 +31,12 @@
     </span>
     {% endif  %}
 
+    {% if page.seenUsers.length >= config.seener_threshold %}
+    <span>
+      <i class="fa fa-eye">{{ page.seenUsers.length }}</i>
+    </span>
+    {% endif  %}
+
     {% if !page.isPublic() %}
     <span>
       <i class="fa fa-lock"></i>