You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ambari.apache.org by "Oleg Nechiporenko (JIRA)" <ji...@apache.org> on 2016/03/28 15:12:25 UTC
[jira] [Created] (AMBARI-15599) Create computed macros `truncate`
Oleg Nechiporenko created AMBARI-15599:
------------------------------------------
Summary: Create computed macros `truncate`
Key: AMBARI-15599
URL: https://issues.apache.org/jira/browse/AMBARI-15599
Project: Ambari
Issue Type: Task
Components: ambari-web
Affects Versions: 2.4.0
Reporter: Oleg Nechiporenko
Assignee: Oleg Nechiporenko
Fix For: 2.4.0
A computed property that returns dependent value truncated to the `reduceTo`-size if its length is greater than `maxLength` Truncated part may be replaced with `replacer` if it's provided
{code:javascript}
var o = Em.Object.create({
p1: Em.computed.truncate('p2', 8, 5, '###'),
p2: 'some string',
p3: Em.computed.truncate('p2', 8, 5)
});
console.log(o.get('p1')); // 'some ###'
console.log(o.get('p3')); // 'some ...'
o.set('p2', '123456789');
console.log(o.get('p1')); // '12345###'
console.log(o.get('p3')); // '12345...'
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)