view view/layout/default/library.tt @ 8:7d92a42f8e18

improved doxygen library
author sergey
date Wed, 14 May 2014 17:28:22 +0400
parents fa7a99c2d079
children 573272ec604b
line wrap: on
line source

[%
	labels(
		CollectionTitle = "Home (%name%)"
	);
	document.postRender.push('dojo');
	
	document.css.push(css.library);
	
	CollectionClass = 'Benzin::Doxygen::Model::Collection';
	CompoundClass = 'Benzin::Doxygen::Model::Compound';
	MemberClass = 'Benzin::Doxygen::Model::Member';
	
	Icons = {
		namespace = 'NS',
		class = 'C',
		variable = 'Var',
		function = 'F',
		property = 'P',
		interface = 'I',
		struct = 'S',
		enum = 'E',
		event = 'Ev'
	};
	
	NullIcon = '  ';
	
	coll = resource.Seek('doxygenCollection');
	
	compounds = coll.location.compounds;
	members = resource.Seek('compound').location || coll.location.members;
	
	document.title = model.canonicalName;
	
	MACRO GetLocationFor(model) BLOCK;
		members.Child(model.doxId) IF model.isa(MemberClass);
		compounds.Child(model.doxId) IF model.isa(CompoundClass);
	END;
%]
[% MACRO IconKind(model) BLOCK %]<span class="icon">[% Icons.item(model.kind) || NullIcon %]</span>[% END %]
[% MACRO Link(model,label,title) BLOCK %]<a class="$model.kind $model.protection" [% IF title %]title="$title" [% END %]href="[% GetLocationFor(model) %]">[% IconKind(model) %] $label</a>[% END %]
[% MACRO CompoundSiblings(model) BLOCK %]
	[% compound = model.isa(MemberClass) ? model.compound : model %]
	<ul class="members">
		[% FOREACH item IN compound.GetSiblings({ kind = { '-not_in' = [ 'file', 'dir' ] } }) %]
			<li [% IF item.doxId == compound.doxId %]class="active"[% END %]>[% Link(item,item.shortName, item.canonicalName) %]</li>
		[% END %]
	</ul>
[% END %]
[% MACRO Members(model) BLOCK %]
	[% compound = model.isa(MemberClass) ? model.compound : model %]
	<ul class="members">
		[% FOREACH item IN compound.GetMembers({ kind = { '-not_in' = [ 'file', 'dir' ] } }) %]
			<li [% IF item.doxId == model.doxId %]class="active"[% END %]>[% Link(item,item.shortName, item.canonicalName) %]</li>
		[% END %]
	</ul>
[% END %]
[% BLOCK LAYOUT %]
<div class="library-pane">
	
	<div id="toc-nav" class="nav-pane left">
		[% IF model.isa(CollectionClass) %]
			
			<ul class="dox-nav-menu">
				<li class="last"><a href="$coll.location" title="$coll.model.description">[% CollectionTitle( name = coll.model.name) %]</a></li>
				[% Members(model) %]
			</ul>
		[% ELSE %]
			[%
				parents = model.GetParents({ kind = { '-not_in' = [ 'file', 'dir' ] } });
				parents.push(model) IF model.isa(CompoundClass);
			%]
			<ul class="dox-nav-menu">
				<li [% IF !parents.size %]class="last"[% END %]><a href="$coll.location" title="$coll.model.description">[% CollectionTitle( name = coll.model.name) %]</a></li>
			[% FOREACH parent IN parents %]
				<li [% IF loop.last %]class="last"[% END %]>[% Link(parent, parent.shortName, parent.canonicalName) %]</li>
			[% END %]
				[% Members(model) %]
			</ul>
		[% END %]
	</div>
	<div id="siblings-nav" class="nav-pane right">
		[% CompoundSiblings(model) %]
	</div>
	<div id="content-pane" class="content-pane">
		$content
	</div>
	<script type="text/javascript">
		require(['implab/sticky'],function(sticky) {
			sticky('toc-nav',{ along: 'content-pane' });
			sticky('siblings-nav', { along: 'content-pane' });
		});
	</script>
</div>
[% END %]
[% WRAPPER LAYOUT;
	render('base', content = content);
END %]