Total Complexity | 5 |
Complexity/F | 1.25 |
Lines of Code | 30 |
Function Count | 4 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | /** |
||
4 | (function($) { |
||
5 | |||
6 | $.entwine('ss', function($){ |
||
7 | /** |
||
8 | * Name |
||
9 | */ |
||
10 | $('.cms-edit-form input[name=Name]').entwine({ |
||
11 | onchange: function() { |
||
12 | this.updateTreeLabel(this.val()); |
||
13 | }, |
||
14 | |||
15 | /** |
||
16 | * Function: updateTreeLabel |
||
17 | * |
||
18 | * Update the tree |
||
19 | * (String) title |
||
20 | */ |
||
21 | updateTreeLabel: function(title) { |
||
22 | var id = $('.cms-edit-form input[name=ID]').val(); |
||
23 | |||
24 | // only update immediate text element, we don't want to update all the nested ones |
||
25 | var treeItem = $('.item:first', $('.cms-tree').find("[data-id='" + id + "']")); |
||
26 | if (title && title != "") { |
||
27 | treeItem.text(title); |
||
28 | } |
||
29 | } |
||
30 | |||
31 | }); |
||
32 | }); |
||
33 | }(jQuery)); |
||
34 |