Skip to content

Commit 3422bbe

Browse files
authored
Placeholder for counts (#1942)
* Needed for admin+ and should eventually down it some for #785 * Turn off zeroes to match no issues count from #1916 Auto-merge
1 parent 5d12081 commit 3422bbe

2 files changed

Lines changed: 20 additions & 4 deletions

File tree

controllers/user.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ var svgCaptcha = require('svg-captcha');
2121
var SPDX = require('spdx-license-ids');
2222

2323
//--- Model inclusions
24-
var Comment = require('../models/comment').Comment;
2524
var Script = require('../models/script').Script;
25+
var Comment = require('../models/comment').Comment;
26+
var Vote = require('../models/vote').Vote;
27+
var Flag = require('../models/flag').Flag;
2628
var Sync = require('../models/sync').Sync;
2729
var Strategy = require('../models/strategy').Strategy;
2830
var User = require('../models/user').User;
@@ -327,6 +329,8 @@ var getUserPageTasks = function (aOptions) {
327329
var user = null;
328330
var userScriptListCountQuery = null;
329331
var userCommentListCountQuery = null;
332+
var userVoteListCountQuery = null;
333+
var userFlagListCountQuery = null;
330334
var userSyncListCountQuery = null;
331335
var tasks = [];
332336

@@ -343,6 +347,14 @@ var getUserPageTasks = function (aOptions) {
343347
userCommentListCountQuery = Comment.find({ _authorId: user._id, flagged: { $ne: true } });
344348
tasks.push(countTask(userCommentListCountQuery, aOptions, 'commentListCount'));
345349

350+
// userVoteListCountQuery
351+
userVoteListCountQuery = Vote.find({ _userId: user._id });
352+
tasks.push(countTask(userVoteListCountQuery, aOptions, 'voteListCount'));
353+
354+
// userFlagListCountQuery
355+
userFlagListCountQuery = Flag.find({ _userId: user._id });
356+
tasks.push(countTask(userFlagListCountQuery, aOptions, 'flagListCount'));
357+
346358
// userSyncListCountQuery
347359
userSyncListCountQuery = Sync.find({ _authorId: user._id });
348360
tasks.push(countTask(userSyncListCountQuery, aOptions, 'syncListCount'));

views/includes/userPageHeader.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,15 @@ <h2 class="page-heading">
1111
<div class="navbar-collapse collapse in" id="content-navbar">
1212
<ul class="nav navbar-nav">
1313
<li class="{{#isUserPage}}active{{/isUserPage}}"><a href="{{{user.userPageUrl}}}">Profile</a></li>
14-
<li class="{{#isUserScriptListPage}}active{{/isUserScriptListPage}}"><a href="{{{user.userScriptListPageUrl}}}" class="{{^user.userScriptListPageUrl}}disabled{{/user.userScriptListPageUrl}}">Scripts <span class="badge">{{scriptListCount}}</span></a></li>
15-
<li class="{{#isUserCommentListPage}}active{{/isUserCommentListPage}}"><a href="{{{user.userCommentListPageUrl}}}" class="{{^user.userCommentListPageUrl}}disabled{{/user.userCommentListPageUrl}}">Comments <span class="badge">{{commentListCount}}</span></a></li>
14+
<li class="{{#isUserScriptListPage}}active{{/isUserScriptListPage}}"><a href="{{{user.userScriptListPageUrl}}}" class="{{^user.userScriptListPageUrl}}disabled{{/user.userScriptListPageUrl}}">Scripts{{#scriptListCount}} <span class="badge">{{scriptListCount}}</span>{{/scriptListCount}}</a></li>
15+
<li class="{{#isUserCommentListPage}}active{{/isUserCommentListPage}}"><a href="{{{user.userCommentListPageUrl}}}" class="{{^user.userCommentListPageUrl}}disabled{{/user.userCommentListPageUrl}}">Comments{{#commentListCount}} <span class="badge">{{commentListCount}}</span>{{/commentListCount}}</a></li>
16+
{{#isAdmin}}
17+
<li class=""><a href="#">Votes{{#voteListCount}} <span class="badge">{{voteListCount}}</span>{{/voteListCount}}</a></li>
18+
<li class=""><a href="#">Flags{{#flagListCount}} <span class="badge">{{flagListCount}}</span>{{/flagListCount}}</a></li>
19+
{{/isAdmin}}
1620
{{#isYou}}
1721
{{#user.canSync}}
18-
<li class="{{#isUserSyncListPage}}active{{/isUserSyncListPage}}"><a href="{{{user.userSyncListPageUrl}}}" class="{{^user.userSyncListPageUrl}}disabled{{/user.userSyncListPageUrl}}">Syncs <span class="badge">{{syncListCount}}</span></a></li>
22+
<li class="{{#isUserSyncListPage}}active{{/isUserSyncListPage}}"><a href="{{{user.userSyncListPageUrl}}}" class="{{^user.userSyncListPageUrl}}disabled{{/user.userSyncListPageUrl}}">Syncs{{#syncListCount}} <span class="badge">{{syncListCount}}</span>{{/syncListCount}}</a></li>
1923
{{/user.canSync}}
2024
{{/isYou}}
2125
</ul>

0 commit comments

Comments
 (0)