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

73 lines
3.5 KiB
Plaintext
Raw Permalink Normal View History

{% macro render_icon_and_name(item) %}
<i class="{{ item.icon.class if item.icon is defined and item.icon.class is defined else 'fa-solid fa-link' }}"></i>
{% if item.name is defined %}
{{ item.name }}
{% else %}
Unnamed Item: {{item}}
{% endif %}
{% endmacro %}
<!-- Template for children -->
{% macro render_children(children) %}
{% for children in children %}
{% if children.children %}
2025-01-09 14:42:38 +01:00
<li class="dropdown-submenu position-relative">
2025-01-15 02:19:33 +01:00
<a class="dropdown-item dropdown-toggle" title="{{ children.description }}">
{{ render_icon_and_name(children) }}
2025-01-08 18:06:08 +01:00
</a>
2025-01-09 14:42:38 +01:00
<ul class="dropdown-menu">
{{ render_children(children.children) }}
2025-01-08 18:06:08 +01:00
</ul>
</li>
{% elif children.identifier or children.warning or children.info %}
2025-01-08 18:06:08 +01:00
<li>
<a class="dropdown-item" onclick='openDynamicPopup({{ children|tojson|safe }})' data-bs-toggle="tooltip" title="{{ children.description }}">
{{ render_icon_and_name(children) }}
2025-01-08 18:06:08 +01:00
</a>
</li>
{% else %}
<li>
<a class="dropdown-item" href="{{ children.url }}" target="{{ children.target|default('_blank') }}" data-bs-toggle="tooltip" title="{{ children.description }}">
{{ render_icon_and_name(children) }}
2025-01-08 18:06:08 +01:00
</a>
</li>
{% endif %}
{% endfor %}
{% endmacro %}
2025-01-14 17:08:59 +01:00
<!-- Navigation Bar -->
2025-01-08 17:09:45 +01:00
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
2025-01-15 13:21:42 +01:00
<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">
2025-01-08 17:09:45 +01:00
<span class="navbar-toggler-icon"></span>
</button>
2025-01-09 09:48:56 +01:00
<div class="collapse navbar-collapse" id="navbarNav{{menu_type}}">
2025-01-15 13:54:29 +01:00
<ul class="navbar-nav {% if menu_type == 'header' %}ms-auto{% endif %} btn-group">
{% for item in navigation[menu_type].children %}
2025-01-09 14:59:30 +01:00
{% if item.url %}
2025-01-08 17:09:45 +01:00
<!-- Single Item -->
<li class="nav-item">
2025-01-15 13:54:29 +01:00
<a class="nav-link btn btn-light" href="{{ item.url }}" target="{{ item.target|default('_blank') }}" data-bs-toggle="tooltip" title="{{ item.description }}">
{{ render_icon_and_name(item) }}
2025-01-08 17:09:45 +01:00
</a>
</li>
{% else %}
<!-- Dropdown Menu -->
<li class="nav-item dropdown">
2025-01-15 13:54:29 +01:00
<a class="nav-link dropdown-toggle btn btn-light" id="navbarDropdown{{ loop.index }}" role="button" data-bs-display="dynamic" aria-expanded="false">
2025-01-10 11:45:22 +01:00
{% if item.icon is defined and item.icon.class is defined %}
{{ render_icon_and_name(item) }}
2025-01-10 11:45:22 +01:00
{% else %}
<p>Missing icon in item: {{ item }}</p>
{% endif %}
2025-01-08 17:09:45 +01:00
</a>
2025-01-14 17:08:59 +01:00
<ul class="dropdown-menu">
{{ render_children(item.children) }}
2025-01-08 17:09:45 +01:00
</ul>
</li>
{% endif %}
{% endfor %}
</ul>
</div>
</div>
2025-01-14 17:08:59 +01:00
</nav>