60 lines
2.1 KiB
Cheetah
60 lines
2.1 KiB
Cheetah
<?js
|
|
var self = this;
|
|
|
|
function toShortName(name) {
|
|
return name.indexOf('module:') === 0 ? name.split('/').pop() : name;
|
|
}
|
|
|
|
function getItemCssClass(type) {
|
|
if (type === 'module') {
|
|
return 'glyphicon-plus';
|
|
} else if (type === 'class') {
|
|
return 'glyphicon-chevron-right';
|
|
}
|
|
return '';
|
|
}
|
|
|
|
const printList = v => { ?>
|
|
<li data-name="<?js= v.longname ?>"><?js
|
|
}
|
|
const printListWithStability = v => {
|
|
const cls = v.stability && v.stability !== 'stable' ? ' class="unstable"' : ''; ?>
|
|
<li data-name="<?js= v.longname ?>"<?js= cls ?>><?js
|
|
}
|
|
|
|
function listContent(item, title, listItemPrinter) {
|
|
const type = title.toLowerCase();
|
|
if (item[type] && item[type].length) { ?>
|
|
<div class="member-list">
|
|
<span class="subtitle"><?js= title ?></span>
|
|
<ul><?js
|
|
item[type].forEach(function (v) {
|
|
listItemPrinter(v); ?><?js= self.linkto(v.longname, toShortName(v.name)) ?><?js
|
|
}); ?>
|
|
</ul>
|
|
</div><?js
|
|
}
|
|
}
|
|
?>
|
|
<div class="navigation">
|
|
<div class="search">
|
|
<input id="search" type="text" class="form-control input-sm" placeholder="Search Documentation">
|
|
</div>
|
|
<ul class="list"><?js
|
|
this.nav.forEach(function (item) { ?>
|
|
<li class="item" data-name="<?js= item.longname ?>" data-shortname="<?js= item.name.toLowerCase() ?>">
|
|
<span class="title">
|
|
<span class="glyphicon <?js= getItemCssClass(item.type) ?> toggle"></span>
|
|
<?js= self.linkto(item.longname, item.prettyname) ?>
|
|
</span><?js
|
|
listContent(item, 'Members', printList);
|
|
listContent(item, 'Typedefs', printListWithStability);
|
|
listContent(item, 'Methods', printListWithStability);
|
|
if (item.fires) {
|
|
const fires = item.fires.map(v => self.find({longname: v})[0] || {longname: v, name: v.split(/#?event:/)[1]});
|
|
listContent({fires: fires}, 'Fires', printListWithStability)
|
|
}
|
|
}); ?>
|
|
</ul>
|
|
</div>
|