mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-13 22:41:32 -05:00
2a91a1071e
No issue. - Ember@1.10.0 - Update grunt-ember-templates to version that supports HTMLBars. - Update Gruntfile.js to compile templates with HTMLBars. - Convert Handlebars code to its HTMLBars equivalent.
28 lines
613 B
JavaScript
28 lines
613 B
JavaScript
var countDownCharacters = Ember.HTMLBars.makeBoundHelper(function (arr /* hashParams */) {
|
|
var el = document.createElement('span'),
|
|
content,
|
|
maxCharacters,
|
|
length;
|
|
|
|
if (!arr || arr.length < 2) {
|
|
return;
|
|
}
|
|
|
|
content = arr[0] || '';
|
|
maxCharacters = arr[1];
|
|
length = content.length;
|
|
|
|
el.className = 'word-count';
|
|
|
|
if (length > maxCharacters) {
|
|
el.style.color = '#E25440';
|
|
} else {
|
|
el.style.color = '#9FBB58';
|
|
}
|
|
|
|
el.innerHTML = length;
|
|
|
|
return Ember.String.htmlSafe(el.outerHTML);
|
|
});
|
|
|
|
export default countDownCharacters;
|