homepage.veen.world/app/templates/moduls/navigation.html.j2

63 lines
3.2 KiB
Django/Jinja

<!-- Template for Subitems -->
{% macro render_subitems(subitems) %}
{% for subitem in subitems %}
{% if subitem.subitems %}
<li class="dropdown-submenu">
<a class="dropdown-item" title="{{ subitem.description }}">
<i class="{{ subitem.icon_class }}"></i> {{ subitem.name }}
</a>
<ul class="dropdown-submenu">
{{ render_subitems(subitem.subitems) }}
</ul>
</li>
{% elif subitem.popup %}
<li>
<a class="dropdown-item" onclick='openDynamicPopup({{subitem|tojson|safe}})' data-bs-toggle="tooltip" title="{{ subitem.description }}">
<i class="{{ subitem.icon_class }}"></i> {{ subitem.name }}
</a>
</li>
{% else %}
<li>
<a class="dropdown-item" href="{{ subitem.href }}" target="{{ subitem.target|default('_blank') }}" data-bs-toggle="tooltip" title="{{ subitem.description }}">
<i class="{{ subitem.icon_class }}"></i> {{ subitem.name }}
</a>
</li>
{% endif %}
{% endfor %}
{% endmacro %}
<!-- Navigation Bar -->
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<!--
<a class="navbar-brand" href="#">Navbar</a>
-->
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav{{menu_type}}" aria-controls="navbarNav{{menu_type}}" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav{{menu_type}}">
<ul class="navbar-nav {% if menu_type == 'header' %}ms-auto{% endif %}">
{% for item in navigation[menu_type] %}
{% if item.href %}
<!-- Single Item -->
<li class="nav-item">
<a class="nav-link" href="{{ item.href }}" target="{{ item.target|default('_blank') }}" data-bs-toggle="tooltip" title="{{ item.description }}">
<i class="{{ item.icon_class }}"></i> {{ item.name }}
</a>
</li>
{% else %}
<!-- Dropdown Menu -->
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown{{ loop.index }}" role="button" data-bs-toggle="dropdown" data-bs-display="dynamic" data-popper-placement="top" title="{{ item.description }}" aria-expanded="false">
<i class="{{ item.icon_class }}" data-bs-toggle="tooltip"></i> {{ item.name }}
</a>
<ul class="dropdown-menu dropdown-menu-{{menu_type}}" aria-labelledby="navbarDropdown{{ loop.index }}">
{{ render_subitems(item.subitems) }}
</ul>
</li>
{% endif %}
{% endfor %}
</ul>
</div>
</div>
</nav>