refactor: move nav items to base navbar template
Some checks failed
CVE Scan & Docker Build / security-scan (push) Successful in 50s
CVE Scan & Docker Build / build-and-push (push) Has been cancelled

Consolidate navigation items into the base navbar template instead of
requiring each app to override nav blocks. Nav links are now conditionally
rendered based on authentication status, removing the need for duplicate
nav block definitions in dashboard.html.
This commit is contained in:
2026-05-08 06:01:59 -04:00
parent 4cf022e615
commit 027de096bc
2 changed files with 16 additions and 18 deletions

View File

@@ -1,21 +1,5 @@
{% extends "themis/base.html" %}
{% block nav_items_desktop %}
<li><a href="{% url 'dashboard' %}" class="font-semibold">Dashboard</a></li>
<li><a href="{% url 'library:library-list' %}">Libraries</a></li>
<li><a href="{% url 'library:search' %}">Search</a></li>
<li><a href="{% url 'llm_manager:dashboard' %}">LLM Manager</a></li>
<li><a href="{% url 'themis:key-list' %}">API Keys</a></li>
{% endblock %}
{% block nav_items %}
<li><a href="{% url 'dashboard' %}">Dashboard</a></li>
<li><a href="{% url 'library:library-list' %}">Libraries</a></li>
<li><a href="{% url 'library:search' %}">Search</a></li>
<li><a href="{% url 'llm_manager:dashboard' %}">LLM Manager</a></li>
<li><a href="{% url 'themis:key-list' %}">API Keys</a></li>
{% endblock %}
{% block title %}Dashboard — Mnemosyne{% endblock %}
{% block content %}

View File

@@ -13,7 +13,15 @@
<ul tabindex="0"
class="menu menu-sm dropdown-content bg-base-200 rounded-box z-10 mt-3 w-52 p-2 shadow">
{% block nav_items_mobile %}
{% block nav_items %}{% endblock %}
{% block nav_items %}
{% if user.is_authenticated %}
<li><a href="{% url 'dashboard' %}">Dashboard</a></li>
<li><a href="{% url 'library:library-list' %}">Libraries</a></li>
<li><a href="{% url 'library:search' %}">Search</a></li>
<li><a href="{% url 'llm_manager:dashboard' %}">LLM Manager</a></li>
<li><a href="{% url 'themis:key-list' %}">API Keys</a></li>
{% endif %}
{% endblock %}
{% endblock %}
</ul>
</div>
@@ -28,7 +36,13 @@
<div class="navbar-center hidden lg:flex">
<ul class="menu menu-horizontal px-1">
{% block nav_items_desktop %}
<!-- Apps fill this block with their nav items -->
{% if user.is_authenticated %}
<li><a href="{% url 'dashboard' %}">Dashboard</a></li>
<li><a href="{% url 'library:library-list' %}">Libraries</a></li>
<li><a href="{% url 'library:search' %}">Search</a></li>
<li><a href="{% url 'llm_manager:dashboard' %}">LLM Manager</a></li>
<li><a href="{% url 'themis:key-list' %}">API Keys</a></li>
{% endif %}
{% endblock %}
</ul>
</div>