Files
calminer/templates/partials/sidebar_nav.html
zwitschi eb2687829f
Some checks failed
CI / lint (push) Successful in 17s
Deploy - Coolify / deploy (push) Failing after 5s
CI / test (push) Successful in 1m21s
CI / build (push) Successful in 2m25s
refactor(navigation): remove legacy navigation.js and integrate logic into navigation_sidebar.js
2025-11-15 13:53:50 +01:00

81 lines
3.7 KiB
HTML

{% set sidebar_nav = get_sidebar_navigation(request) %}
{% set nav_roles = sidebar_nav.roles if sidebar_nav and sidebar_nav.roles else [] %}
{% set nav_groups = sidebar_nav.groups if sidebar_nav else [] %}
{% set current_path = request.url.path if request else '' %}
<nav
class="sidebar-nav"
aria-label="Primary navigation"
data-navigation-source="{{ 'server' if sidebar_nav else 'fallback' }}"
data-navigation-roles="{{ nav_roles | join(',') }}"
>
<div class="sidebar-nav-controls">
<button id="nav-prev" class="nav-chevron nav-chevron-prev" aria-label="Previous page"></button>
<button id="nav-next" class="nav-chevron nav-chevron-next" aria-label="Next page"></button>
</div>
{% if nav_groups %}
{% for group in nav_groups %}
{% if group.links %}
<div class="sidebar-section" data-group-id="{{ group.id }}">
<div class="sidebar-section-label">{{ group.label }}</div>
<div class="sidebar-section-links">
{% for link in group.links %}
{% set href = link.href %}
{% if href %}
{% set match_prefix = link.match_prefix or href %}
{% if match_prefix == '/' %}
{% set is_active = current_path == '/' %}
{% else %}
{% set is_active = current_path.startswith(match_prefix) %}
{% endif %}
<div class="sidebar-link-block" data-link-id="{{ link.id }}">
<a
href="{{ href }}"
class="sidebar-link{% if is_active %} is-active{% endif %}{% if link.is_external %} is-external{% endif %}"
data-match-prefix="{{ match_prefix }}"
{% if link.tooltip %}title="{{ link.tooltip }}"{% endif %}
{% if link.is_external %}target="_blank" rel="noopener noreferrer"{% endif %}
>
{{ link.label }}
</a>
{% if link.children %}
<div class="sidebar-sublinks">
{% for child in link.children %}
{% set child_href = child.href %}
{% if child_href %}
{% set child_prefix = child.match_prefix or child_href %}
{% if child_prefix == '/' %}
{% set child_active = current_path == '/' %}
{% else %}
{% set child_active = current_path.startswith(child_prefix) %}
{% endif %}
<a
href="{{ child_href }}"
class="sidebar-sublink{% if child_active %} is-active{% endif %}{% if child.is_external %} is-external{% endif %}"
data-match-prefix="{{ child_prefix }}"
{% if child.tooltip %}title="{{ child.tooltip }}"{% endif %}
{% if child.is_external %}target="_blank" rel="noopener noreferrer"{% endif %}
>
{{ child.label }}
</a>
{% endif %}
{% endfor %}
</div>
{% endif %}
</div>
{% endif %}
{% endfor %}
</div>
</div>
{% endif %}
{% endfor %}
{% else %}
<div class="sidebar-section sidebar-empty-state">
<div class="sidebar-section-label">Navigation</div>
<div class="sidebar-section-links">
<p class="sidebar-empty-copy">Navigation is unavailable.</p>
</div>
</div>
{% endif %}
</nav>