Reorganize navbar with Trip and Conference dropdowns

- Move trip-related pages (Future trips, Past trips, Trip statistics) to a "Trips" dropdown
- Move conference-related pages (Conferences, Past conferences) to a "Conferences" dropdown
- Position both dropdowns between Calendar and Travel in the navbar
- Maintain active state highlighting for dropdown items and parent dropdowns

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Edward Betts 2025-07-15 16:18:41 +02:00
parent 06a7d03404
commit d65981ef7e

View file

@ -1,13 +1,12 @@
{% macro navbar() %}
{% set pages = [
{% set pages_before_dropdowns = [
{"endpoint": "index", "label": "Home" },
{"endpoint": "recent", "label": "Recent" },
{"endpoint": "calendar_page", "label": "Calendar" },
{"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" },
] %}
{% set pages_after_dropdowns = [
{"endpoint": "travel_list", "label": "Travel" },
{"endpoint": "accommodation_list", "label": "Accommodation" },
{"endpoint": "gaps_page", "label": "Gaps" },
@ -17,7 +16,18 @@
{"endpoint": "schengen_report", "label": "Schengen" },
] + ([{"endpoint": "birthday_list", "label": "Birthdays" }]
if g.user.is_authenticated else [])
%}
%}
{% set trip_pages = [
{"endpoint": "trip_future_list", "label": "Future trips" },
{"endpoint": "trip_past_list", "label": "Past trips" },
{"endpoint": "trip_stats", "label": "Trip statistics" },
] %}
{% set conference_pages = [
{"endpoint": "conference_list", "label": "Conferences" },
{"endpoint": "past_conference_list", "label": "Past conferences" },
] %}
<nav class="navbar navbar-expand-md bg-success" data-bs-theme="dark">
@ -28,7 +38,44 @@
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
{% for page in pages %}
{% for page in pages_before_dropdowns %}
{% set is_active = request.endpoint == page.endpoint %}
<li class="nav-item">
<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>
</li>
{% endfor %}
<!-- Trip dropdown -->
{% set trip_active = request.endpoint in ['trip_future_list', 'trip_past_list', 'trip_stats'] %}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle{% if trip_active %} border border-white border-2 active{% endif %}" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Trips
</a>
<ul class="dropdown-menu">
{% for page in trip_pages %}
{% set is_active = request.endpoint == page.endpoint %}
<li><a class="dropdown-item{% if is_active %} active{% endif %}" href="{{ url_for(page.endpoint) }}">{{ page.label }}</a></li>
{% endfor %}
</ul>
</li>
<!-- Conference dropdown -->
{% set conference_active = request.endpoint in ['conference_list', 'past_conference_list'] %}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle{% if conference_active %} border border-white border-2 active{% endif %}" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Conferences
</a>
<ul class="dropdown-menu">
{% for page in conference_pages %}
{% set is_active = request.endpoint == page.endpoint %}
<li><a class="dropdown-item{% if is_active %} active{% endif %}" href="{{ url_for(page.endpoint) }}">{{ page.label }}</a></li>
{% endfor %}
</ul>
</li>
{% for page in pages_after_dropdowns %}
{% set is_active = request.endpoint == page.endpoint %}
<li class="nav-item">
<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) }}">