You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.5 KiB

{% macro pageLinkName(text) %}{{ text|lower|replace({' ':'_'}) }}{% endmacro %}
7 years ago
{% macro nav_loop(page) %}
{% for p in page.children.visible %}
{% set active_page = (p.active or p.activeChild) ? 'active' : '' %}
{% set modules = p.collection() %}
7 years ago
{% if p.children.visible.count > 0 %}
<li>
<a href="{{ p.url }}" class="{{ active_page }}">
{{ p.menu }}
</a>
<ul>
{{ _self.nav_loop(p) }}
</ul>
</li>
{% elseif modules.count > 0 %}
<li>
<a href="{{ p.url }}" class="{{ active_page }}">
{{ p.menu }}
</a>
<ul class="navigation">
{% for m in modules %}
{% set current_module = (m.active or m.activeChild) ? 'active' : '' %}
<li>
<a href="{{ p.url }}#{{ _self.pageLinkName(m.menu) }}" class="{{ current_module }}">
{{ m.menu }}
</a>
</li>
{% endfor %}
</ul>
</li>
7 years ago
{% else %}
<li>
<a href="{{ p.url }}" class="{{ active_page }}">
{{ p.menu }}
</a>
</li>
{% endif %}
{% endfor %}
{% endmacro %}
<ul {{ tree ? 'class="tree"' : '' }}>
{{ _self.nav_loop(pages) }}
</ul>