mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 15:48:43 -05:00
Add blocked users count to dashboard
This commit is contained in:
parent
cfc4dda9ff
commit
9b0f63627b
9 changed files with 47 additions and 27 deletions
|
@ -23,12 +23,9 @@ Discourse.AdminDashboardRoute = Discourse.Route.extend({
|
|||
_.each(d.reports,function(report){
|
||||
c.set(report.type, Discourse.Report.create(report));
|
||||
});
|
||||
c.set('admins', d.admins);
|
||||
c.set('moderators', d.moderators);
|
||||
c.set('blocked', d.blocked);
|
||||
c.set('top_referrers', d.top_referrers);
|
||||
c.set('top_traffic_sources', d.top_traffic_sources);
|
||||
c.set('top_referred_topics', d.top_referred_topics);
|
||||
_.each(['admins', 'moderators', 'blocked', 'banned', 'top_referrers', 'top_traffic_sources', 'top_referred_topics'], function(x) {
|
||||
c.set(x, d[x]);
|
||||
});
|
||||
c.set('loading', false);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -34,18 +34,10 @@ Discourse.Route.buildRoutes(function() {
|
|||
this.resource('adminUsers', { path: '/users' }, function() {
|
||||
this.resource('adminUser', { path: '/:username' });
|
||||
this.resource('adminUsersList', { path: '/list' }, function() {
|
||||
this.route('active', { path: '/active' });
|
||||
this.route('new', { path: '/new' });
|
||||
this.route('pending', { path: '/pending' });
|
||||
this.route('admins', { path: '/admins' });
|
||||
this.route('moderators', { path: '/moderators' });
|
||||
this.route('blocked', { path: '/blocked' });
|
||||
// Trust Levels:
|
||||
this.route('newuser', { path: '/newuser' });
|
||||
this.route('basic', { path: '/basic' });
|
||||
this.route('regular', { path: '/regular' });
|
||||
this.route('leaders', { path: '/leaders' });
|
||||
this.route('elders', { path: '/elders' });
|
||||
_.each(['active', 'new', 'pending', 'admins', 'moderators', 'blocked', 'banned',
|
||||
'newuser', 'basic', 'regular', 'leaders', 'elders'], function(x) {
|
||||
this.route(x, { path: '/' + x });
|
||||
}, this);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -94,4 +94,18 @@ Discourse.AdminUsersListBlockedRoute = Discourse.Route.extend({
|
|||
setupController: function() {
|
||||
return this.controllerFor('adminUsersList').show('blocked');
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
Handles the route that lists banned users.
|
||||
|
||||
@class AdminUsersListBannedRoute
|
||||
@extends Discourse.Route
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.AdminUsersListBannedRoute = Discourse.Route.extend({
|
||||
setupController: function() {
|
||||
return this.controllerFor('adminUsersList').show('banned');
|
||||
}
|
||||
});
|
|
@ -97,12 +97,20 @@
|
|||
</div>
|
||||
|
||||
<div class="dashboard-stats totals">
|
||||
<span class="title"><i class='icon icon-trophy'></i> {{i18n admin.dashboard.admins}}</span>
|
||||
<span class="value">{{#linkTo 'adminUsersList.admins'}}{{admins}}{{/linkTo}}</span>
|
||||
<span class="title"><i class='icon icon-magic'></i> {{i18n admin.dashboard.moderators}}</span>
|
||||
<span class="value">{{#linkTo 'adminUsersList.moderators'}}{{moderators}}{{/linkTo}}</span>
|
||||
<span class="title"><i class='icon icon-ban-circle'></i> {{i18n admin.dashboard.blocked}}</span>
|
||||
<span class="value">{{#linkTo 'adminUsersList.blocked'}}{{blocked}}{{/linkTo}}</span>
|
||||
<table>
|
||||
<tr>
|
||||
<td class="title"><i class='icon icon-trophy'></i> {{i18n admin.dashboard.admins}}</td>
|
||||
<td class="value">{{#linkTo 'adminUsersList.admins'}}{{admins}}{{/linkTo}}</td>
|
||||
<td class="title"><i class='icon icon-ban-circle'></i> {{i18n admin.dashboard.banned}}</td>
|
||||
<td class="value">{{#linkTo 'adminUsersList.banned'}}{{banned}}{{/linkTo}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title"><i class='icon icon-magic'></i> {{i18n admin.dashboard.moderators}}</td>
|
||||
<td class="value">{{#linkTo 'adminUsersList.moderators'}}{{moderators}}{{/linkTo}}</td>
|
||||
<td class="title"><i class='icon icon-ban-circle'></i> {{i18n admin.dashboard.blocked}}</td>
|
||||
<td class="value">{{#linkTo 'adminUsersList.blocked'}}{{blocked}}{{/linkTo}}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="dashboard-stats">
|
||||
|
|
|
@ -467,12 +467,16 @@ table {
|
|||
}
|
||||
|
||||
&.totals {
|
||||
table {
|
||||
width: auto;
|
||||
}
|
||||
margin-top: 12px;
|
||||
padding-left: 5px;
|
||||
.value {
|
||||
text-align: left;
|
||||
font-weight: bold;
|
||||
margin-left: 8px;
|
||||
margin-right: 30px;
|
||||
padding-left: 8px;
|
||||
padding-right: 30px;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,12 +54,13 @@ class AdminDashboardData
|
|||
reports: REPORTS.map { |type| Report.find(type).as_json },
|
||||
admins: User.admins.count,
|
||||
moderators: User.moderators.count,
|
||||
banned: User.banned.count,
|
||||
blocked: User.blocked.count,
|
||||
top_referrers: IncomingLinksReport.find('top_referrers').as_json,
|
||||
top_traffic_sources: IncomingLinksReport.find('top_traffic_sources').as_json,
|
||||
top_referred_topics: IncomingLinksReport.find('top_referred_topics').as_json
|
||||
}.merge(
|
||||
SiteSetting.version_checks? ? {version_check: DiscourseUpdates.check_version} : {}
|
||||
SiteSetting.version_checks? ? {version_check: DiscourseUpdates.check_version.as_json} : {}
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -64,6 +64,7 @@ class User < ActiveRecord::Base
|
|||
attr_accessor :notification_channel_position
|
||||
|
||||
scope :blocked, -> { where(blocked: true) } # no index
|
||||
scope :banned, -> { where('banned_till IS NOT NULL AND banned_till > ?', Time.zone.now) } # no index
|
||||
|
||||
module NewTopicDuration
|
||||
ALWAYS = -1
|
||||
|
|
|
@ -1009,6 +1009,7 @@ en:
|
|||
moderators: 'Moderators:'
|
||||
admins: 'Admins:'
|
||||
blocked: 'Blocked:'
|
||||
banned: 'Banned:'
|
||||
private_messages_short: "PMs"
|
||||
private_messages_title: "Private Messages"
|
||||
|
||||
|
@ -1151,6 +1152,7 @@ en:
|
|||
admins: 'Admin Users'
|
||||
moderators: 'Moderators'
|
||||
blocked: 'Blocked Users'
|
||||
banned: 'Banned Users'
|
||||
|
||||
user:
|
||||
ban_failed: "Something went wrong banning this user {{error}}"
|
||||
|
|
|
@ -27,6 +27,7 @@ class AdminUserIndexQuery
|
|||
when 'admins' then @query.where('admin = ?', true)
|
||||
when 'moderators' then @query.where('moderator = ?', true)
|
||||
when 'blocked' then @query.blocked
|
||||
when 'banned' then @query.banned
|
||||
when 'pending' then @query.where('approved = false')
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue