Skip to content

Commit 2caff4d

Browse files
author
p01
committed
initialized the resource_tee template only once
1 parent 1455f9a commit 2caff4d

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/resource-manager/resource_templates.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,28 @@ templates.resource_tree =
1111

1212
_init:function()
1313
{
14-
this._initialized = true;
14+
if (this._initialized)
15+
return;
16+
17+
// wrap the nesting templating for _depth iteration according styling
1518
['document', 'resource_group', 'resource'].forEach(function(f)
1619
{
1720
var original = this[f];
1821
this[f] = function()
1922
{
2023
this._depth++;
2124

22-
var r = original.apply(this, arguments);
23-
if(r && r[1] && r[1][0] == 'h2')
24-
r[1].push( 'style','padding-left:'+this._depth*18+'px;' );
25+
var tpl = original.apply(this, arguments);
26+
if(tpl && tpl[1] && tpl[1][0] == 'h2')
27+
tpl[1].push( 'style', 'padding-left:'+ this._depth*18 +'px;' );
2528

2629
this._depth--;
27-
return r;
30+
31+
return tpl;
2832
};
2933
}, this);
3034

35+
this._initialized = true;
3136
},
3237

3338
expandCollapseToggle:function(context, pivotID, tpl)

0 commit comments

Comments
 (0)