From 1fdec59f777a01c41602aff192a280ce1c6f009b Mon Sep 17 00:00:00 2001 From: Marie Birner Date: Tue, 11 Feb 2025 21:12:30 +0100 Subject: [PATCH] [TASK] add sort element user management --- frontend/main.ts | 19 +++++++++++++++++++ templates/admin/user/index.html.tera | 23 ++++++++++++++++++++++- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/frontend/main.ts b/frontend/main.ts index 82f59e9..e8d528c 100644 --- a/frontend/main.ts +++ b/frontend/main.ts @@ -23,6 +23,7 @@ document.addEventListener("DOMContentLoaded", function () { addRelationMagic(document.querySelector("body")); reloadPage(); setCurrentdate(document.querySelector("#departure")); + initDropdown(); }); function changeTheme() { @@ -795,3 +796,21 @@ function replaceStrings() { weekday.innerHTML = weekday.innerHTML.replace("Freitag", "Markttag"); }); } + +function initDropdown() { + const popoverTriggerList = document.querySelectorAll('[data-dropdown]'); + + popoverTriggerList.forEach((popoverTriggerEl: Element) => { + const id = popoverTriggerEl.getAttribute('data-dropdown'); + + if (id) { + const element = document.getElementById(id); + if (element) { + // Toggle visibility of the dropdown when clicked + popoverTriggerEl.addEventListener('click', () => { + element.classList.toggle('hidden'); + }); + } + } + }); +} diff --git a/templates/admin/user/index.html.tera b/templates/admin/user/index.html.tera index 9d58196..fd6de6c 100644 --- a/templates/admin/user/index.html.tera +++ b/templates/admin/user/index.html.tera @@ -28,13 +28,34 @@ {% endif %} -
+
+ +
+ + + + +