ensl.org/app/assets/javascripts/helpers.js
2014-10-13 22:30:28 -04:00

12 lines
586 B
JavaScript

Ember.Handlebars.helper('flag', function(country) {
if (country) {
return new Ember.Handlebars.SafeString('<img src="/assets/flags/' + country + '.png" class="flag" />');
}
return new Ember.Handlebars.SafeString('<img src="/assets/flags/EU.png" class="flag" />');
});
Ember.Handlebars.helper('votingBar', function(name, current, total) {
var bar = '<div class="voting-bar"><div class="label">' + name + '</div>';
bar += '<div class="vote-progress"><div style="width: ' + Math.round(current/total*100) + '%"></div></div></div>';
return new Ember.Handlebars.SafeString(bar);
});