agenda/templates/navbar.html

51 lines
2.2 KiB
HTML
Raw Permalink Normal View History

2024-01-02 16:08:22 +00:00
{% macro navbar() %}
{% set pages = [
{"endpoint": "index", "label": "Home" },
{"endpoint": "recent", "label": "Recent" },
{"endpoint": "calendar_page", "label": "Calendar" },
2024-06-15 20:57:59 +01:00
{"endpoint": "trip_future_list", "label": "Future trips" },
{"endpoint": "trip_past_list", "label": "Past trips" },
{"endpoint": "conference_list", "label": "Conferences" },
{"endpoint": "past_conference_list", "label": "Past conferences" },
2024-01-02 16:08:22 +00:00
{"endpoint": "travel_list", "label": "Travel" },
{"endpoint": "accommodation_list", "label": "Accommodation" },
2024-06-15 20:57:59 +01:00
{"endpoint": "gaps_page", "label": "Gaps" },
{"endpoint": "weekends", "label": "Weekends" },
{"endpoint": "launch_list", "label": "Space launches" },
{"endpoint": "holiday_list", "label": "Holidays" },
2024-06-03 19:30:14 +01:00
] + ([{"endpoint": "birthday_list", "label": "Birthdays" }]
if g.user.is_authenticated else [])
%}
2024-01-02 16:08:22 +00:00
2024-01-02 18:56:13 +00:00
<nav class="navbar navbar-expand-md bg-success" data-bs-theme="dark">
2024-01-02 16:08:22 +00:00
<div class="container-fluid">
<a class="navbar-brand" href="{{ url_for("index") }}">Agenda</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
{% for page in pages %}
2024-01-02 18:56:13 +00:00
{% set is_active = request.endpoint == page.endpoint %}
2024-01-02 16:08:22 +00:00
<li class="nav-item">
2024-01-02 18:56:13 +00:00
<a class="nav-link{% if is_active %} border border-white border-2 active{% endif %}" {% if is_active %} aria-current="page"{% endif %} href="{{ url_for(page.endpoint) }}">
{{ page.label }}
</a>
2024-01-02 16:08:22 +00:00
</li>
{% endfor %}
</ul>
2024-01-22 12:46:46 +00:00
<ul class="navbar-nav ms-auto">
2024-02-25 09:08:19 +00:00
{% if g.user.is_authenticated %}
<li class="nav-item"><a class="nav-link" href="{{ url_for("logout", next=request.url) }}">Logout</a></li>
{% else %}
<li class="nav-item"><a class="nav-link" href="{{ url_for("login", next=request.url) }}">Login</a></li>
{% endif %}
2024-01-22 12:46:46 +00:00
</ul>
2024-01-02 16:08:22 +00:00
</div>
</div>
</nav>
{% endmacro %}