Navbar-Reihenfolge: Unterpunkte je Gruppe editierbar, Karte unter Profil/Passwort verschoben
- Neuer Settings-Schluessel nav_child_order (JSON dict group_key -> geordnete Liste der Kind-Keys), analog zu nav_order fuer die Top-Level- Reihenfolge. _ordered_nav_items() liefert die komplette, ungefilterte Navbar-Struktur inkl. angewandter Kind-Reihenfolge; inject_nav() filtert das anschliessend weiterhin nach Berechtigung wie bisher. - save_nav_order() verarbeitet zusaetzlich ein Feld nav_child_order_<group_key> pro Gruppe mit Kindern. - account.html: Navbar-Reihenfolge-Karte jetzt UNTER Profil/Passwort aendern (vorher darueber), zeigt die komplette Navbar inkl. eingerueckter, separat sortierbarer Unterpunkte pro Gruppe (verschachtelte <ul>, moveNavItem() bewegt automatisch nur innerhalb der eigenen Gruppe dank DOM-Nesting). - Live per Playwright verifiziert: Zugangsdaten innerhalb Geraete nach oben verschoben, gespeichert, Sidebar zeigt danach tatsaechlich die neue Reihenfolge (Zugangsdaten vor Clients/Switche). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,39 +4,6 @@
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% if current_user.is_admin %}
|
||||
<div class="card card-pad" style="margin-bottom:24px;">
|
||||
<div class="section-head" style="margin-bottom:16px;">
|
||||
<div>
|
||||
<h2 style="font-size:16px;">Navbar-Reihenfolge</h2>
|
||||
<div class="hint">Bestimmt, in welcher Reihenfolge die Menüpunkte in der Sidebar erscheinen. Jeder Benutzer sieht davon nur, wofür er auch berechtigt ist.</div>
|
||||
</div>
|
||||
</div>
|
||||
<form method="post" action="{{ url_for('save_nav_order') }}" id="navOrderForm">
|
||||
<ul class="nav-order-list" id="navOrderList">
|
||||
{% for item in nav_items_ordered %}
|
||||
<li data-key="{{ item.key }}">
|
||||
<span>{{ item.label }}</span>
|
||||
<div class="nav-order-actions">
|
||||
<button type="button" class="icon-btn" title="Nach oben" onclick="moveNavItem(this,-1)">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 19V5M5 12l7-7 7 7"/></svg>
|
||||
</button>
|
||||
<button type="button" class="icon-btn" title="Nach unten" onclick="moveNavItem(this,1)">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 5v14M5 12l7 7 7-7"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
<input type="hidden" name="nav_order" value="{{ item.key }}">
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<button type="submit" class="btn btn-primary btn-block">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6L9 17l-5-5"/></svg>
|
||||
Reihenfolge speichern
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="settings-grid">
|
||||
|
||||
<div class="card card-pad">
|
||||
@@ -84,6 +51,58 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
{% if current_user.is_admin %}
|
||||
{% macro nav_order_buttons() %}
|
||||
<div class="nav-order-actions">
|
||||
<button type="button" class="icon-btn" title="Nach oben" onclick="moveNavItem(this,-1)">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 19V5M5 12l7-7 7 7"/></svg>
|
||||
</button>
|
||||
<button type="button" class="icon-btn" title="Nach unten" onclick="moveNavItem(this,1)">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 5v14M5 12l7 7 7-7"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
<div class="card card-pad" style="margin-top:24px;">
|
||||
<div class="section-head" style="margin-bottom:16px;">
|
||||
<div>
|
||||
<h2 style="font-size:16px;">Navbar-Reihenfolge</h2>
|
||||
<div class="hint">Bestimmt, in welcher Reihenfolge die Menüpunkte inkl. Unterpunkte in der Sidebar erscheinen. Jeder Benutzer sieht davon nur, wofür er auch berechtigt ist.</div>
|
||||
</div>
|
||||
</div>
|
||||
<form method="post" action="{{ url_for('save_nav_order') }}" id="navOrderForm">
|
||||
<ul class="nav-order-list" id="navOrderList">
|
||||
{% for item in full_nav_items %}
|
||||
<li data-key="{{ item.key }}">
|
||||
<div class="nav-order-row">
|
||||
<span>{{ item.label }}</span>
|
||||
{{ nav_order_buttons() }}
|
||||
</div>
|
||||
<input type="hidden" name="nav_order" value="{{ item.key }}">
|
||||
{% if item.children %}
|
||||
<ul class="nav-order-sublist">
|
||||
{% for child in item.children %}
|
||||
<li data-key="{{ child.key }}">
|
||||
<div class="nav-order-row">
|
||||
<span>{{ child.label }}</span>
|
||||
{{ nav_order_buttons() }}
|
||||
</div>
|
||||
<input type="hidden" name="nav_child_order_{{ item.key }}" value="{{ child.key }}">
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<button type="submit" class="btn btn-primary btn-block">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6L9 17l-5-5"/></svg>
|
||||
Reihenfolge speichern
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
|
||||
Reference in New Issue
Block a user