From 58e4cc6583b65b11a6d7104d54a8f50927aad965 Mon Sep 17 00:00:00 2001 From: "Adrian A. Baumann" Date: Tue, 23 Sep 2025 11:16:03 +0200 Subject: [PATCH] Static Files added --- staticfiles/css/admin_extras.css | 14 ++++++++++++++ staticfiles/js/inline_toggle.js | 24 ++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 staticfiles/css/admin_extras.css create mode 100644 staticfiles/js/inline_toggle.js diff --git a/staticfiles/css/admin_extras.css b/staticfiles/css/admin_extras.css new file mode 100644 index 0000000..2e15826 --- /dev/null +++ b/staticfiles/css/admin_extras.css @@ -0,0 +1,14 @@ +.nested-inline h3 { + background-color: #f3f3f3; + border-bottom: 1px solid #ccc; + padding: 0.4em; + margin: 0; + font-weight: bold; + cursor: pointer; + } + + .nested-inline fieldset.module { + margin-bottom: 1em; + border: 1px solid #ccc; + padding: 0; + } \ No newline at end of file diff --git a/staticfiles/js/inline_toggle.js b/staticfiles/js/inline_toggle.js new file mode 100644 index 0000000..7ec2f67 --- /dev/null +++ b/staticfiles/js/inline_toggle.js @@ -0,0 +1,24 @@ +document.addEventListener("DOMContentLoaded", function () { + const inlineSections = document.querySelectorAll(".nested-inline fieldset.module"); + + inlineSections.forEach(section => { + const header = section.querySelector("h2"); + const content = Array.from(section.children).filter(child => !child.matches("h2")); + + if (header && content.length > 0) { + header.style.cursor = "pointer"; + header.style.userSelect = "none"; + header.style.background = "#f3f3f3"; + header.style.borderBottom = "1px solid #ccc"; + header.style.padding = "4px"; + + // Collapse by default + content.forEach(el => el.style.display = "none"); + + header.addEventListener("click", () => { + const currentlyVisible = content[0].style.display !== "none"; + content.forEach(el => el.style.display = currentlyVisible ? "none" : "block"); + }); + } + }); +}); \ No newline at end of file