Add admin menu drawer and poll cloning, drop participant screen tools
CI / Deploy / PHP 8.5 (push) Successful in 1m51s
CI / Deploy / PHP 8.4 (push) Successful in 1m51s
CI / Deploy / test (push) Successful in 2s
CI / Deploy / deploy (push) Skipped

- Remove fullscreen and wake lock buttons from the participant view.
- Turn the admin sidebar into a drawer below 900px, opened from a header
  menu button next to the theme switch (progressive enhancement).
- Add "Umfrage kopieren": clone a poll with all slides, options and images
  but without responses, with its own join code and admin link.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
gnilebeinandClaude Sonnet 5.5 committed 2026-11-20 10:57:33 +01:00
1 parent 0f91377de3
commit bd57f23be6
15 files changed
+374 -138

No files matched your search

+26
View File
@@ -140,6 +140,32 @@ h3 { font-size: 1.05rem; margin-top: 1.6em; }
.grid--sidebar { grid-template-columns: 1fr; }
}
/* Sidebar as menu drawer (JS adds .sidebar--drawer; without JS the sidebar stays below the slides). */
.menu-toggle { display: none; }
.sidebar__bar { display: none; }
.drawer-backdrop { display: none; }
@media (max-width: 900px) {
.menu-toggle:not([hidden]) { display: inline-flex; }
.sidebar--drawer {
position: fixed; top: 0; right: 0; bottom: 0; z-index: 40;
width: min(92vw, 400px); padding: 0 16px 24px; overflow-y: auto; overscroll-behavior: contain;
background: var(--bg); box-shadow: -8px 0 32px rgba(20, 22, 50, .25);
visibility: hidden; transform: translateX(100%);
transition: transform .2s ease, visibility 0s linear .2s;
}
.drawer-open .sidebar--drawer { visibility: visible; transform: none; transition: transform .2s ease; }
.sidebar--drawer .sidebar__bar {
position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between;
margin: 0 -16px 16px; padding: 12px 16px; background: var(--bg); border-bottom: 1px solid var(--border);
}
.sidebar--drawer .sidebar__close { position: static; }
.drawer-open .drawer-backdrop { display: block; position: fixed; inset: 0; z-index: 39; background: rgba(20, 22, 50, .45); }
.drawer-open { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) {
.sidebar--drawer { transition: none; }
}
/* ---------------------------------------------------------------- components */
.card {
background: var(--surface);
+46 -81
View File
@@ -1704,88 +1704,7 @@
// ------------------------------------------------------------------ participant
// Fullscreen and screen wake lock for the participant view (both optional, buttons stay hidden if unsupported).
function initScreenTools(root) {
function setPressed(button, on) {
var text = button.getAttribute(on ? 'data-label-on' : 'data-label-off');
button.setAttribute('aria-pressed', on ? 'true' : 'false');
button.setAttribute('aria-label', text);
button.title = text;
}
// The buttons live in the layout header, outside the participant root.
var fsButton = document.querySelector('[data-fullscreen-toggle]');
if (fsButton && document.fullscreenEnabled) {
fsButton.hidden = false;
fsButton.addEventListener('click', function () {
if (document.fullscreenElement) {
document.exitFullscreen();
} else {
document.documentElement.requestFullscreen().catch(function () {});
}
});
// Also fires when leaving with Esc/back gesture.
document.addEventListener('fullscreenchange', function () {
setPressed(fsButton, !!document.fullscreenElement);
});
}
var wlButton = document.querySelector('[data-wakelock-toggle]');
if (wlButton && 'wakeLock' in navigator) {
// The page reloads on every slide change, so the choice is kept per tab and re-applied on load.
var STORE = 'plenario-wakelock';
// On by default; only an explicit "off" is remembered.
var wanted = true;
var sentinel = null;
try {
wanted = sessionStorage.getItem(STORE) !== '0';
} catch (e) {
// storage blocked: choice only lasts until the next slide
}
var remember = function () {
try {
sessionStorage.setItem(STORE, wanted ? '1' : '0');
} catch (e) {
// ignore
}
};
var acquire = function () {
if (!wanted || sentinel || document.visibilityState !== 'visible') {
return Promise.resolve();
}
return navigator.wakeLock.request('screen').then(function (lock) {
sentinel = lock;
// The browser releases the lock when the tab is hidden; re-acquired on return.
lock.addEventListener('release', function () {
sentinel = null;
});
}).catch(function () {
wanted = false; // denied (e.g. battery saver)
remember();
setPressed(wlButton, false);
});
};
wlButton.hidden = false;
setPressed(wlButton, wanted);
acquire();
wlButton.addEventListener('click', function () {
wanted = !wanted;
remember();
setPressed(wlButton, wanted);
if (wanted) {
acquire();
} else if (sentinel) {
sentinel.release();
}
});
document.addEventListener('visibilitychange', acquire);
}
}
function initParticipant(root) {
initScreenTools(root);
var stateUrl = root.getAttribute('data-state-url');
var voteUrl = root.getAttribute('data-vote-url');
var version = root.getAttribute('data-version');
@@ -3161,10 +3080,56 @@
}
});
// Admin menu drawer: below 900px the sidebar slides in from the right (CSS), opened by the header button.
// Without JS the button stays hidden and the sidebar remains a normal block below the slides.
function initDrawer() {
var toggle = document.querySelector('[data-drawer-toggle]');
var drawer = toggle ? document.getElementById(toggle.getAttribute('aria-controls')) : null;
if (!toggle || !drawer) {
return;
}
var root = document.body;
drawer.classList.add('sidebar--drawer');
toggle.hidden = false;
function setOpen(open) {
root.classList.toggle('drawer-open', open);
toggle.setAttribute('aria-expanded', open ? 'true' : 'false');
if (open) {
var close = drawer.querySelector('[data-drawer-close]');
if (close) {
close.focus();
}
}
}
toggle.addEventListener('click', function () {
setOpen(!root.classList.contains('drawer-open'));
});
document.addEventListener('click', function (event) {
var target = event.target.closest ? event.target.closest('[data-drawer-close], a[href^="#"]') : null;
if (target && root.classList.contains('drawer-open') && (target.hasAttribute('data-drawer-close') || drawer.contains(target))) {
setOpen(false);
}
});
document.addEventListener('keydown', function (event) {
if (event.key === 'Escape' && root.classList.contains('drawer-open') && !document.querySelector('dialog[open]')) {
setOpen(false);
toggle.focus();
}
});
// Back to a wide screen: the sidebar is a normal column again.
window.addEventListener('resize', function () {
if (window.innerWidth > 900 && root.classList.contains('drawer-open')) {
setOpen(false);
}
});
}
document.addEventListener('DOMContentLoaded', function () {
document.querySelectorAll('[data-theme-switch]').forEach(initThemeSwitch);
initWidgets(document);
initShare();
initDrawer();
initQrDownload();
initAdminDashboard();
document.querySelectorAll('[data-presenter]').forEach(initPresenter);