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){ d.reports.each(function(report){
c.set(report.type, Discourse.Report.create(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('problems', d.problems);
c.set('loading', false); c.set('loading', false);
}); });

View File

@ -71,7 +71,6 @@
<th>2</th> <th>2</th>
<th>3</th> <th>3</th>
<th>4</th> <th>4</th>
<th>{{i18n admin.dashboard.moderator_short}}</th>
</tr> </tr>
</thead> </thead>
{{#unless loading}} {{#unless loading}}
@ -80,6 +79,21 @@
</table> </table>
</div> </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"> <div class="dashboard-stats">
<table class="table table-condensed table-hover"> <table class="table table-condensed table-hover">
<thead> <thead>

View File

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

View File

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

View File

@ -11,7 +11,9 @@ class AdminDashboardData
def as_json def as_json
@json ||= { @json ||= {
reports: REPORTS.map { |type| Report.find(type) }, 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( }.merge(
SiteSetting.version_checks? ? {version_check: DiscourseUpdates.check_version} : {} SiteSetting.version_checks? ? {version_check: DiscourseUpdates.check_version} : {}
) )

View File

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