mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-29 18:46:23 -05:00
17 lines
No EOL
441 B
JavaScript
17 lines
No EOL
441 B
JavaScript
/**
|
|
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;
|
|
}
|
|
}
|
|
}); |