mirror of
https://github.com/discourse/discourse.git
synced 2025-05-25 00:32:52 +08:00
Add user counts for each trust level to admin dashboard
This commit is contained in:
@ -36,3 +36,21 @@ Handlebars.registerHelper('sumLast', function(property, numDays) {
|
||||
return sum;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
Return the count of users at the given trust level.
|
||||
|
||||
@method valueAtTrustLevel
|
||||
@for Handlebars
|
||||
**/
|
||||
Handlebars.registerHelper('valueAtTrustLevel', function(property, trustLevel) {
|
||||
var data = Ember.Handlebars.get(this, property);
|
||||
if( data ) {
|
||||
var item = data.find( function(d, i, arr) { return parseInt(d.x,10) === parseInt(trustLevel,10); } );
|
||||
if( item ) {
|
||||
return item.y;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user