<%@
required ('Uize.Str.Repeat');
input ({
idPrefix:'string'
});
%><%
var
_Class = m.Class,
_htmlChunks = [],
_idPrefix = input.idPrefix,
_dividerHtml = '',
_depthSpacer = ''
;
m.traverseTree ({
itemHandler:function (_item,_itemSpecifier,_depth) {
var
_itemLink = _item.link,
_hasItems = _Class.itemHasChildren (_item),
_itemClasses = m.cssClass ('item') + ' ' + m.cssClass ('depth' + _depth)
;
_htmlChunks.push (
'' +
Uize.Str.Repeat.repeat (_depthSpacer,_depth) +
(
_Class.itemIsDivider (_item)
? _dividerHtml
: (
'' +
(
_hasItems
? (
''
)
: ''
) + '' +
(
_itemLink || (_hasItems && input.alwaysLinkHeadings)
? (
'' + _item.title + ''
)
: ('' + _item.title + '')
)
)
) +
'
'
);
},
beforeSubItemsHandler:function (_item,_itemSpecifier) {
_htmlChunks.push ('');
},
afterSubItemsHandler:function () {_htmlChunks.push ('\n')}
});
%>
<%= _htmlChunks.join ('') %>