mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-24 08:09:13 -05:00
17 lines
434 B
JavaScript
17 lines
434 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) { return parseInt(d.x,10) === parseInt(trustLevel,10); } );
|
|
if( item ) {
|
|
return item.y;
|
|
} else {
|
|
return 0;
|
|
}
|
|
}
|
|
});
|