Add user counts for each trust level to admin dashboard

This commit is contained in:
Neil Lalonde
2013-03-15 18:08:46 -04:00
parent 1d9764d8fc
commit d9cdde9aa7
10 changed files with 99 additions and 10 deletions

View File

@ -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;
}
}
});