1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01:00
Ghost-Admin/helpers/gh-count-characters.js
Fabian Becker 4254bae327 Implements character count helper.
closes #3035
- New character count helper
- Re-add casper test for bio count
- Change settings.general and settings.user to show character count
2014-06-23 20:02:09 +00:00

17 lines
No EOL
446 B
JavaScript

var countCharacters = Ember.Handlebars.makeBoundHelper(function (content) {
var el = document.createElement('span'),
length = content ? content.length : 0;
el.className = 'word-count';
if (length > 180) {
el.style.color = '#E25440';
} else {
el.style.color = '#9E9D95';
}
el.innerHTML = 200 - length;
return new Ember.Handlebars.SafeString(el.outerHTML);
});
export default countCharacters;