Refactor: Tab-Switching von JavaScript auf HTMX + Jinja2 umgestellt
Shares- und Identities-Seite nutzen jetzt ?tab= Query-Parameter statt clientseitigem JS. Der Server steuert aktiven Tab via Jinja2, kein <script>-Block mehr nötig. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,15 +3,18 @@
|
||||
{% block content %}
|
||||
<h2>File Sharing</h2>
|
||||
|
||||
<!-- Tabs via CSS -->
|
||||
<!-- Tabs via HTMX -->
|
||||
<div role="tablist" style="display:flex;gap:0.5rem;margin-bottom:1.5rem;border-bottom:1px solid var(--pico-muted-border-color);padding-bottom:0.5rem">
|
||||
<button role="tab" onclick="showTab('samba')" id="tab-samba" class="outline">Samba (SMB)</button>
|
||||
<button role="tab" onclick="showTab('nfs')" id="tab-nfs" class="outline secondary">NFS</button>
|
||||
<button role="tab" onclick="showTab('config')" id="tab-config" class="outline secondary">Samba Config</button>
|
||||
<a role="tab" href="/shares?tab=samba" hx-get="/shares?tab=samba" hx-target="body" hx-push-url="true"
|
||||
class="outline{% if tab != 'samba' %} secondary{% endif %}">Samba (SMB)</a>
|
||||
<a role="tab" href="/shares?tab=nfs" hx-get="/shares?tab=nfs" hx-target="body" hx-push-url="true"
|
||||
class="outline{% if tab != 'nfs' %} secondary{% endif %}">NFS</a>
|
||||
<a role="tab" href="/shares?tab=config" hx-get="/shares?tab=config" hx-target="body" hx-push-url="true"
|
||||
class="outline{% if tab != 'config' %} secondary{% endif %}">Samba Config</a>
|
||||
</div>
|
||||
|
||||
<!-- Samba Shares -->
|
||||
<div id="panel-samba">
|
||||
<div id="panel-samba"{% if tab != 'samba' %} style="display:none"{% endif %}>
|
||||
<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:1rem">
|
||||
<h3 style="margin:0">Samba Shares</h3>
|
||||
<button onclick="document.getElementById('new-samba-form').style.display='block'">+ Neu</button>
|
||||
@@ -40,7 +43,7 @@
|
||||
</div>
|
||||
|
||||
<!-- NFS -->
|
||||
<div id="panel-nfs" style="display:none">
|
||||
<div id="panel-nfs"{% if tab != 'nfs' %} style="display:none"{% endif %}>
|
||||
<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:1rem">
|
||||
<h3 style="margin:0">NFS Exports</h3>
|
||||
<button onclick="document.getElementById('new-nfs-form').style.display='block'">+ Neu</button>
|
||||
@@ -69,7 +72,7 @@
|
||||
</div>
|
||||
|
||||
<!-- Samba Config -->
|
||||
<div id="panel-config" style="display:none">
|
||||
<div id="panel-config"{% if tab != 'config' %} style="display:none"{% endif %}>
|
||||
<div id="samba-config"
|
||||
hx-get="/fragments/samba-config"
|
||||
hx-trigger="load">
|
||||
@@ -77,13 +80,4 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function showTab(name) {
|
||||
['samba','nfs','config'].forEach(t => {
|
||||
document.getElementById('panel-' + t).style.display = t === name ? 'block' : 'none';
|
||||
const btn = document.getElementById('tab-' + t);
|
||||
btn.className = t === name ? 'outline' : 'outline secondary';
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user