2014-09-19 03:42:07 +04:00
|
|
|
var countDownCharacters = Ember.Handlebars.makeBoundHelper(function (content, maxCharacters) {
|
|
|
|
var el = document.createElement('span'),
|
|
|
|
length = content ? content.length : 0;
|
|
|
|
|
|
|
|
el.className = 'word-count';
|
2014-10-25 01:09:50 +04:00
|
|
|
|
2014-09-19 03:42:07 +04:00
|
|
|
if (length > maxCharacters) {
|
|
|
|
el.style.color = '#E25440';
|
|
|
|
} else {
|
2014-09-21 22:56:30 +04:00
|
|
|
el.style.color = '#9FBB58';
|
2014-09-19 03:42:07 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
el.innerHTML = length;
|
|
|
|
|
|
|
|
return new Ember.Handlebars.SafeString(el.outerHTML);
|
|
|
|
});
|
|
|
|
|
2014-10-25 01:09:50 +04:00
|
|
|
export default countDownCharacters;
|