Make the admin sidebar cards collapsible
CI / Deploy / PHP 8.5 (push) Successful in 1m9s
CI / Deploy / PHP 8.4 (push) Successful in 1m17s
CI / Deploy / test (push) Successful in 1s
CI / Deploy / deploy (push) Skipped

Participation and settings are open by default, the rest is closed.
Anchor links like #export open their card.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
gnilebeinandClaude Sonnet 5.5 committed 2026-11-16 19:45:03 +01:00
1 parent 74b69f3c9a
commit 2c0b8d2216
4 files changed
+69 -38

No files matched your search

+9
View File
@@ -154,6 +154,15 @@ h3 { font-size: 1.05rem; margin-top: 1.6em; }
.card--accent { background: var(--primary-soft); border-color: transparent; }
.card--danger h2 { color: var(--danger); }
/* Collapsible card: <details class="card collapsible"><summary><h2>…</h2></summary>…</details> */
.collapsible > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; list-style: none; }
.collapsible > summary::-webkit-details-marker { display: none; }
.collapsible > summary::after { content: "▾"; color: var(--muted); font-size: 1.5em; line-height: 0; transition: transform .15s; }
.collapsible:not([open]) > summary::after { transform: rotate(-90deg); }
.collapsible > summary h2 { margin: 0; }
.collapsible[open] > summary { margin: 0 -24px 16px; padding: 0 24px 12px; border-bottom: 1px solid var(--border); }
.collapsible > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; border-radius: 6px; }
.hero { text-align: center; max-width: 760px; margin: 16px auto 40px; }
.hero h1 { font-size: clamp(1.9rem, 4.5vw, 3rem); }
+17
View File
@@ -2935,6 +2935,23 @@
}
});
// Collapsible dashboard cards (<details class="collapsible">): in-page links like #export open their closed card.
function openCollapsible(hash) {
var target = hash && hash.length > 1 ? document.getElementById(decodeURIComponent(hash.slice(1))) : null;
var card = target && target.closest ? target.closest('details.collapsible') : null;
if (card && !card.open) {
card.open = true;
}
}
document.addEventListener('click', function (event) {
var link = event.target.closest ? event.target.closest('a[href^="#"]') : null;
if (link) {
openCollapsible(link.getAttribute('href'));
}
});
window.addEventListener('hashchange', function () { openCollapsible(window.location.hash); });
openCollapsible(window.location.hash);
// Split button menus ([data-menu-toggle] + [data-menu]). Delegated: the dashboard head is replaced on live refresh.
function closeMenus(except) {
document.querySelectorAll('[data-menu]').forEach(function (menu) {