From 2c0b8d2216fe816be1c7c8de7f620b377e8c32ef Mon Sep 17 00:00:00 2001 From: Patrick Niebeling Date: Mon, 16 Nov 2026 19:45:03 +0100 Subject: [PATCH] Make the admin sidebar cards collapsible 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 --- docs/frontend.md | 5 +++ templates/Admin/index.php | 76 +++++++++++++++++++-------------------- webroot/css/plenario.css | 9 +++++ webroot/js/plenario.js | 17 +++++++++ 4 files changed, 69 insertions(+), 38 deletions(-) diff --git a/docs/frontend.md b/docs/frontend.md index 5a6f003..0389be3 100644 --- a/docs/frontend.md +++ b/docs/frontend.md @@ -4,6 +4,11 @@ Dashboard-Fragmente, Farbschema, Textformatierung, Vollbild. CSP-Regeln stehen i ## Dashboard ohne Neuladen +- **Einklappbare Seitenleiste** der Verwaltung: `
` mit `

`. Standard: Teilnahme, + Einstellungen (direkt unter dem QR-Code) offen; „Ergebnisse als PDF“, „In Präsentation einbetten“ und „Sicherheit“ zu. + Offene Karten trennt eine Linie zwischen Überschrift und Inhalt. + Anker-Links wie `#export` öffnen ihre Karte (`openCollapsible()` in `plenario.js`). + - **Dashboard ohne Neuladen** (`initAdminDashboard()`, `Fragments` in `plenario.js`): Formulare in `[data-live]` (Folienliste, Kopf) und das Folienformular im `` laufen per `fetch` mit Header `X-Fragment`; `AdminAppController::beforeRender()` nimmt dann das Layout `fragment` (nur Inhalt + Flash). Die Server-Aktionen bleiben normale POST + Redirect, das JS tauscht die Bereiche diff --git a/templates/Admin/index.php b/templates/Admin/index.php index b0ce53d..beeb226 100644 --- a/templates/Admin/index.php +++ b/templates/Admin/index.php @@ -225,18 +225,44 @@ $hasInternal = array_filter($slides, fn($slide) => !$slide->is_hidden && $slide-

-
-

+
+

+ Form->create($poll, ['url' => $url('admin:settings'), 'type' => 'post']) ?> + Form->control('title', ['label' => __('Titel'), 'maxlength' => 200]) ?> + Form->control('is_active', [ + 'type' => 'checkbox', + 'label' => __('Umfrage ist aktiv (Teilnehmende können abstimmen)'), + ]) ?> + Form->control('comment_speed', [ + 'type' => 'select', + 'label' => __('Tempo der Kommentare in der Präsentation'), + 'options' => [ + 50 => __('Viel langsamer (doppelt so lange)'), + 75 => __('Langsamer'), + 100 => __('Normal'), + 125 => __('Schneller'), + 150 => __('Deutlich schneller'), + 200 => __('Sehr schnell (halb so lange)'), + ], + 'aria-describedby' => 'comment-speed-hint', + ]) ?> +

+ Form->button(__('Speichern'), ['class' => 'button']) ?> + Form->end() ?> +
+ +
+

Form->create(null, ['url' => $url('admin:export'), 'type' => 'get']) ?> @@ -260,10 +286,10 @@ $hasInternal = array_filter($slides, fn($slide) => !$slide->is_hidden && $slide- Form->button(__('PDF herunterladen'), ['class' => 'button']) ?> Form->end() ?> -
+ -
-

+
+

@@ -271,36 +297,10 @@ $hasInternal = array_filter($slides, fn($slide) => !$slide->is_hidden && $slide- 'class' => 'button button--small', 'data-confirm' => __('Neue Einbett-Links erzeugen? Alle bisher eingebetteten Folien funktionieren danach nicht mehr.'), ]) ?> -
+ -
-

- Form->create($poll, ['url' => $url('admin:settings'), 'type' => 'post']) ?> - Form->control('title', ['label' => __('Titel'), 'maxlength' => 200]) ?> - Form->control('is_active', [ - 'type' => 'checkbox', - 'label' => __('Umfrage ist aktiv (Teilnehmende können abstimmen)'), - ]) ?> - Form->control('comment_speed', [ - 'type' => 'select', - 'label' => __('Tempo der Kommentare in der Präsentation'), - 'options' => [ - 50 => __('Viel langsamer (doppelt so lange)'), - 75 => __('Langsamer'), - 100 => __('Normal'), - 125 => __('Schneller'), - 150 => __('Deutlich schneller'), - 200 => __('Sehr schnell (halb so lange)'), - ], - 'aria-describedby' => 'comment-speed-hint', - ]) ?> -

- Form->button(__('Speichern'), ['class' => 'button']) ?> - Form->end() ?> -
- -
-

+
+

expiresAt() !== null) : ?>

expiresAt()->i18nFormat('dd.MM.yyyy'))) ?>

@@ -344,7 +344,7 @@ $hasInternal = array_filter($slides, fn($slide) => !$slide->is_hidden && $slide- ]) ?> Form->button(__('Endgültig löschen'), ['class' => 'button button--danger']) ?> Form->end() ?> -
+ diff --git a/webroot/css/plenario.css b/webroot/css/plenario.css index ce16026..e9cd850 100644 --- a/webroot/css/plenario.css +++ b/webroot/css/plenario.css @@ -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:

…

…
*/ +.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); } diff --git a/webroot/js/plenario.js b/webroot/js/plenario.js index e21b63b..501bdbc 100644 --- a/webroot/js/plenario.js +++ b/webroot/js/plenario.js @@ -2935,6 +2935,23 @@ } }); + // Collapsible dashboard cards (
): 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) { -- 2.54.1