2016-06-30 12:21:47 +02:00
|
|
|
import {helper} from 'ember-helper';
|
|
|
|
import {htmlSafe} from 'ember-string';
|
2015-08-19 13:55:40 +02:00
|
|
|
|
2016-06-30 12:21:47 +02:00
|
|
|
export default helper(function (params) {
|
2015-09-03 13:06:50 +02:00
|
|
|
if (!params || !params.length) {
|
2015-02-09 16:57:50 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-10-28 12:36:45 +01:00
|
|
|
let el = document.createElement('span');
|
|
|
|
let content = params[0] || '';
|
|
|
|
let {length} = content;
|
2014-06-23 22:02:09 +02:00
|
|
|
|
|
|
|
el.className = 'word-count';
|
2014-10-24 23:09:50 +02:00
|
|
|
|
2014-06-23 22:02:09 +02:00
|
|
|
if (length > 180) {
|
|
|
|
el.style.color = '#E25440';
|
|
|
|
} else {
|
|
|
|
el.style.color = '#9E9D95';
|
|
|
|
}
|
|
|
|
|
|
|
|
el.innerHTML = 200 - length;
|
|
|
|
|
2016-06-11 18:52:36 +02:00
|
|
|
return htmlSafe(el.outerHTML);
|
2014-06-23 22:02:09 +02:00
|
|
|
});
|