actix-admin/templates/navbar.html
2022-10-07 21:32:59 +02:00

62 lines
2.7 KiB
HTML

<nav class="navbar is-dark mb-4" role="navigation" aria-label="main navigation">
<div class="navbar-brand">
<a class="navbar-item" href="/admin/">
Actix Admin
</a>
<a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false" data-target="navbarBasicExample">
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
</a>
</div>
<div id="navbarBasicExample" class="navbar-menu">
<div class="navbar-start">
{% for category, entities in entity_names %}
{% if category == "" %}
{% for menu_element in entities %}
{% if menu_element.is_custom_handler %}
<a href="/admin/{{ menu_element.link }}" hx-boost="true" hx-indicator="#loading" class="navbar-item {% if entity_name and entity_name == menu_element.name %}is-active{% endif %}">{{ menu_element.name }}</a>
{% else %}
<a href="/admin/{{ menu_element.link }}/list" hx-boost="true" hx-indicator="#loading" class="navbar-item {% if entity_name and entity_name == menu_element.name %}is-active{% endif %}">{{ menu_element.name | title }}</a>
{% endif %}
{%- endfor %}
{% else %}
<div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link {% if entity_name and entity_name in entities %}is-active{% endif %}">
{{ category }}
</a>
<div class="navbar-dropdown">
{% for menu_element in entities %}
{% if menu_element.is_custom_handler %}
<a href="/admin/{{ menu_element.link }}" hx-boost="true" hx-indicator="#loading" class="navbar-item {% if entity_name and entity_name == menu_element.name %}is-active{% endif %}">{{ menu_element.name }}</a>
{% else %}
<a href="/admin/{{ menu_element.link }}/list" hx-boost="true" hx-indicator="#loading" class="navbar-item {% if entity_name and entity_name == menu_element.name %}is-active{% endif %}">{{ menu_element.name | title }}</a>
{% endif %}
{%- endfor %}
</div>
</div>
{% endif %}
{%- endfor %}
</div>
<div class="navbar-end">
<div class="navbar-item">
<div class="buttons">
{% if enable_auth %}
{% if user_is_logged_in %}
<a href="{{ logout_link }}" hx-boost="true" hx-indicator="#loading" class="button is-light">
Log out
</a>
{% else %}
<a href="{{ login_link }}" hx-boost="true" hx-indicator="#loading" class="button is-light">
Log in
</a>
{% endif %}
{% endif %}
</div>
</div>
</div>
</div>
</nav>