Add moderator and admin count to dashboard

This commit is contained in:
Neil Lalonde 2013-03-22 17:50:22 -04:00
parent 86eaf10c3e
commit 158cda7628
6 changed files with 33 additions and 11 deletions

View file

@ -26,7 +26,8 @@ Discourse.AdminDashboardRoute = Discourse.Route.extend({
d.reports.each(function(report){
c.set(report.type, Discourse.Report.create(report));
});
c.set('totalUsers', d.total_users);
c.set('admins', d.admins);
c.set('moderators', d.moderators);
c.set('problems', d.problems);
c.set('loading', false);
});

View file

@ -71,7 +71,6 @@
<th>2</th>
<th>3</th>
<th>4</th>
<th>{{i18n admin.dashboard.moderator_short}}</th>
</tr>
</thead>
{{#unless loading}}
@ -80,6 +79,21 @@
</table>
</div>
<div class="dashboard-stats totals">
<table class="table table-condensed table-hover">
<tbody>
<tr>
<td class="title">{{i18n admin.dashboard.moderators}}</td>
<td class="value">{{moderators}}</td>
</tr>
<tr>
<td class="title">{{i18n admin.dashboard.admins}}</td>
<td class="value">{{admins}}</td>
</tr>
</tbody>
</table>
</div>
<div class="dashboard-stats">
<table class="table table-condensed table-hover">
<thead>

View file

@ -5,5 +5,4 @@
<td class="value">{{valueAtTrustLevel data 2}}</td>
<td class="value">{{valueAtTrustLevel data 3}}</td>
<td class="value">{{valueAtTrustLevel data 4}}</td>
<td class="value">{{valueAtTrustLevel data 5}}</td>
</tr>

View file

@ -394,22 +394,27 @@ table {
&.totals {
width: 160px;
margin-top: 0px;
table tr:first-child td {
table td {
border-top: none;
&.value {
text-align: left;
width: 55px;
}
}
}
&.trust-levels {
margin-top: 0px;
td.value {
width: 33px;
table {
margin-bottom: 0px;
}
}
&.total-users {
margin-left: 45px;
td.value {
width: 45px;
}
}
}

View file

@ -11,7 +11,9 @@ class AdminDashboardData
def as_json
@json ||= {
reports: REPORTS.map { |type| Report.find(type) },
problems: [rails_env_check, host_names_check, gc_checks, sidekiq_check || clockwork_check, ram_check].compact
problems: [rails_env_check, host_names_check, gc_checks, sidekiq_check || clockwork_check, ram_check].compact,
admins: User.where(admin: true).count,
moderators: User.where(moderator: true).count
}.merge(
SiteSetting.version_checks? ? {version_check: DiscourseUpdates.check_version} : {}
)

View file

@ -700,8 +700,9 @@ en:
installed_version: "Installed"
latest_version: "Latest"
update_often: 'Please update often!'
moderator_short: "mod"
problems_found: "Some problems have been found with your installation of Discourse:"
moderators: 'Moderators:'
admins: 'Admins:'
reports:
today: "Today"