news/themes/pinpress/templates/partials/navigation.html.twig

48 lines
1.7 KiB
Twig
Executable file

{% macro loop(page) %}
{% for p in page.children.visible %}
<li class="{% if p.children.visible.count > 0 %}dropdown{% endif %}">
{% if p.children.visible.count > 0 %}
<a class="dropdown-toggle" data-toggle="dropdown" href="{{ p.url }}">
{% if p.header.icon %}<i class="fa fa-{{ p.header.icon }}"></i>{% endif %}
{{ p.menu }}
<i class="fa fa-caret-down"></i>
</a>
{% else %}
<a href="{{ p.url }}">
{% if p.header.icon %}<i class="fa fa-{{ p.header.icon }}"></i>{% endif %}
{{ p.menu }}
</a>
{% endif %}
{% if p.children.visible.count > 0 %}
<ul class="dropdown-menu">
{{ _self.loop(p) }}
</ul>
{% endif %}
</li>
{% endfor %}
{% endmacro %}
<ul class="nav" id="menu-primary">
{% if theme_config.dropdown.enabled %}
{{ _self.loop(pages) }}
{% else %}
{% for page in pages.children.visible %}
{% set current_page = (page.active or page.activeChild) ? 'current' : '' %}
<li class="{{ current_page }}">
<a href="{{ page.url }}">
{{ page.menu }}
</a>
</li>
{% endfor %}
{% endif %}
{% for mitem in site.menu %}
<li>
<a href="{{ mitem.url }}">
{{ mitem.text }}
</a>
</li>
{% endfor %}
{% if config.plugins.login.enabled and grav.user.username %}
<li>{% include 'partials/login-status.html.twig' %}</li>
{% endif %}
</ul>