From b11114b0021f1235b83cce2301e0b618c7f749fc Mon Sep 17 00:00:00 2001 From: Asaf Gartner Date: Tue, 2 Jul 2024 12:57:39 +0300 Subject: [PATCH] User settings tabs --- src/templates/src/user_settings.html | 199 ++------------------------- 1 file changed, 15 insertions(+), 184 deletions(-) diff --git a/src/templates/src/user_settings.html b/src/templates/src/user_settings.html index 372e6973..41497f35 100644 --- a/src/templates/src/user_settings.html +++ b/src/templates/src/user_settings.html @@ -7,18 +7,14 @@ {{ define "content" }}
-
-
- +
+ -
+
{{ csrftoken .Session }} @@ -189,194 +185,29 @@ let panels = document.querySelectorAll(".settings_panel"); let found = false; + let slug = ""; for (let i = 0; i < panels.length; ++i) { visible = hash == panels[i].dataset.slug; panels[i].hidden = !visible; if (visible) { + slug = panels[i].dataset.slug; found = true; } } if (!found) { + slug = panels[0].dataset.slug; panels[0].hidden = false; } + + let tabs = document.querySelectorAll(".tab-button"); + for (let i = 0; i < tabs.length; ++i) { + tabs[i].classList.toggle("tab-button-active", tabs[i].getAttribute("href").slice(1) == slug); + } } window.addEventListener("hashchange", updateVisibleSettings); updateVisibleSettings(); - {{ csrftoken .Session }}