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.
26 lines
547 B
JavaScript
26 lines
547 B
JavaScript
var countCharacters = Ember.HTMLBars.makeBoundHelper(function (arr /* hashParams */) {
|
|
var el = document.createElement('span'),
|
|
length,
|
|
content;
|
|
|
|
if (!arr || !arr.length) {
|
|
return;
|
|
}
|
|
|
|
content = arr[0] || '';
|
|
length = content.length;
|
|
|
|
el.className = 'word-count';
|
|
|
|
if (length > 180) {
|
|
el.style.color = '#E25440';
|
|
} else {
|
|
el.style.color = '#9E9D95';
|
|
}
|
|
|
|
el.innerHTML = 200 - length;
|
|
|
|
return Ember.String.htmlSafe(el.outerHTML);
|
|
});
|
|
|
|
export default countCharacters;
|