Skip to content
This repository was archived by the owner on Feb 5, 2024. It is now read-only.

Commit 1933d18

Browse files
authored
Merge pull request crowi#102 from crowi/add-seener-icon-at-page-list
Added watcher icon and count at page-list view
2 parents 964d3fa + b4f3c31 commit 1933d18

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

lib/routes/page.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ module.exports = function(crowi, app) {
5959
var path = getPathFromRequest(req);
6060
var limit = 50;
6161
var offset = parseInt(req.query.offset) || 0;
62+
var SEENER_THRESHOLD = 10;
6263
path = path + (path == '/' ? '' : '/');
6364

6465
// index page
@@ -90,6 +91,9 @@ module.exports = function(crowi, app) {
9091

9192
pagerOptions.length = pageList.length;
9293

94+
renderVars.config = {
95+
seener_threshold: SEENER_THRESHOLD
96+
};
9397
renderVars.pager = generatePager(pagerOptions);
9498
renderVars.pages = pageList;
9599
res.render('page_list', renderVars);

lib/views/page_list.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ <h3>Next Actions</h3>
127127

128128
{# list view #}
129129
<div class="active tab-pane fade page-list-container in" id="view-list">
130-
{% include 'widget/page_list.html' with { pages: pages, pager: pager } %}
130+
{% include 'widget/page_list.html' with { pages: pages, pager: pager, config: config } %}
131131
</div>
132132

133133
{# timeline view #}

lib/views/widget/page_list.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@
3131
</span>
3232
{% endif %}
3333

34+
{% if page.seenUsers.length >= config.seener_threshold %}
35+
<span>
36+
<i class="fa fa-eye">{{ page.seenUsers.length }}</i>
37+
</span>
38+
{% endif %}
39+
3440
{% if !page.isPublic() %}
3541
<span>
3642
<i class="fa fa-lock"></i>

0 commit comments

Comments
 (0)