From c6a92e347fbca551621e627c6c2c6c09dd13c3f6 Mon Sep 17 00:00:00 2001 From: Patrick Niebeling Date: Tue, 17 Nov 2026 14:11:53 +0100 Subject: [PATCH 1/3] Redesign the image section of the slide form Show a dropzone (with drag and drop) while a slide has no image and a row with preview, replace and remove buttons otherwise. A newly chosen file is previewed right away. Placement is picked from tiles with a small sketch instead of long radio labels, technical details move into a collapsible help. The section gets full-width dividers, and the modal a slim scrollbar. Co-Authored-By: Claude Sonnet 5.5 --- docs/images.md | 5 +- templates/element/slide_image_fields.php | 128 +++++++++------ tests/TestCase/Controller/SlideImageTest.php | 2 +- webroot/css/plenario.css | 58 ++++++- webroot/js/plenario.js | 156 ++++++++++++++----- 5 files changed, 257 insertions(+), 92 deletions(-) diff --git a/docs/images.md b/docs/images.md index 8f43460..2815765 100644 --- a/docs/images.md +++ b/docs/images.md @@ -9,7 +9,10 @@ Ein Bild pro Folie: Upload, Verarbeitung, Auslieferung und Löschregeln. Ablage `{Plenario.images.path}/{poll_id}/{24 Hex}.webp` (Standard `data/uploads`, Docker `/data/uploads`) **außerhalb von `webroot/`**, ausgeliefert über `participate:image` (`/p/{code}/img/{file}`, auch für Presenter und Einbettung; nur Dateien dieser Umfrage, `immutable` gecacht, kein Cookie). Jedes neue Bild bekommt einen neuen Namen → neue URL, ersetzte Bilder sind sofort 404. - Eine Bildbeschreibung wird bewusst nicht abgefragt (`image_alt` bleibt `""`, die Spalte ist ungenutzt): Bilder sind Beamer-Dekoration. Nie Pflichtfelder zum Bild einführen, die den Upload verwerfen: das Dateifeld lässt sich nach einem Fehler nicht neu füllen. Die Frage nach der Platzierung (`data-image-layout`) blendet `initImageFields()` nur ein, wenn ein Bild vorhanden (und nicht zum Entfernen markiert) oder eine Datei gewählt ist; ohne JavaScript bleibt sie sichtbar. Layout `image_layout` (`top`|`side`|`full`, `full` nur + Eine Bildbeschreibung wird bewusst nicht abgefragt (`image_alt` bleibt `""`, die Spalte ist ungenutzt): Bilder sind Beamer-Dekoration. Nie Pflichtfelder zum Bild einführen, die den Upload verwerfen: das Dateifeld lässt sich nach einem Fehler nicht neu füllen. Der Formularbereich (`element/slide_image_fields`) ist ein eigener Abschnitt: ohne Bild eine Dropzone (Label auf dem versteckten + Dateifeld `#image-file`, Drag & Drop), mit Bild eine Zeile aus Vorschau, „Ersetzen“ und „Entfernen“; eine gewählte Datei wird sofort als + Vorschau gezeigt (`initImageFields()`, ersetzt `remove_image` per Button, die Checkbox bleibt für den Betrieb ohne JavaScript). Die Platzierung + (`data-image-layout`, Kacheln mit Mini-Skizze, echte Radios) blendet `initImageFields()` nur ein, wenn ein Bild vorhanden (und nicht zum Entfernen markiert) oder eine Datei gewählt ist; ohne JavaScript bleibt sie sichtbar. Layout `image_layout` (`top`|`side`|`full`, `full` nur Inhaltsfolien, `null` = Standard je Typ: Inhaltsfolie `side`, sonst `top`; `Slide::imageLayout()`); `side` gilt nur für die Bühne (CSS `stage--img-*`), Teilnehmende sehen das Bild immer oben (`element/slide_image`). Kontingent `Plenario.images.maxPerPoll` Folien mit Bild. Im State steht `slide.image` = `{url, alt, layout, width, height}` (`PollStateService::slidePayload()`). diff --git a/templates/element/slide_image_fields.php b/templates/element/slide_image_fields.php index 4731cb4..8d06d5d 100644 --- a/templates/element/slide_image_fields.php +++ b/templates/element/slide_image_fields.php @@ -1,7 +1,8 @@ getData('image_layout'), Slide::IMAGE_LA ? (string)$request->getData('image_layout') : $slide->imageLayout(); $layouts = [ - Slide::IMAGE_TOP => __('Oben (über den Antworten bzw. Ergebnissen)'), - Slide::IMAGE_SIDE => __('Daneben (Bild links, Text und Ergebnis rechts)'), + Slide::IMAGE_TOP => [__('Oben'), ''], + Slide::IMAGE_SIDE => [__('Daneben'), ''], ]; if ($slide->type === Slide::TYPE_CONTENT) { - $layouts[Slide::IMAGE_FULL] = __('Bildschirm füllen (Bild so groß wie möglich)'); + $layouts[Slide::IMAGE_FULL] = [__('Vollbild'), '']; } $imageError = $slide->getError('image'); $maxMb = (int)round((int)Configure::read('Plenario.images.maxUploadBytes', 10 * 1024 * 1024) / 1024 / 1024); +$imageUrl = $hasImage + ? $this->Url->build(['_name' => 'participate:image', 'code' => $poll->join_code, 'file' => $slide->image]) + : ''; ?> -
> - +
> +
+

- -
- <?= h((string)$slide->image_alt) ?> -
- -
- Form->control('remove_image', [ - 'type' => 'checkbox', - 'label' => __('Bild entfernen'), - 'value' => '1', - 'hiddenField' => false, - 'checked' => false, - ]) ?> - - -
+ + -
- - > -

- -
- + + + > + + + +
> +
+ > +
+
+

image_width, (int)$slide->image_height)) : '' ?>

+
+ + + +
+ Form->control('remove_image', [ + 'type' => 'checkbox', + 'label' => __('Bild entfernen'), + 'value' => '1', + 'hiddenField' => false, + 'checked' => false, + ]) ?> +
+ + +
+
-
+ +
+
+ +

+
+
+ +
- Form->radio('image_layout', array_map( - fn($value, $text) => ['value' => $value, 'text' => $text], - array_keys($layouts), - $layouts, - ), ['value' => $layout]) ?> +
+ [$text, $shapes]) : ?> + + +

+
diff --git a/tests/TestCase/Controller/SlideImageTest.php b/tests/TestCase/Controller/SlideImageTest.php index a14a466..5aff409 100644 --- a/tests/TestCase/Controller/SlideImageTest.php +++ b/tests/TestCase/Controller/SlideImageTest.php @@ -328,6 +328,6 @@ class SlideImageTest extends TestCase $this->assertResponseOk(); $this->assertResponseContains('enctype="multipart/form-data"'); $this->assertResponseContains('name="remove_image"'); - $this->assertResponseContains('Bildschirm füllen'); + $this->assertResponseContains('value="full"'); } } diff --git a/webroot/css/plenario.css b/webroot/css/plenario.css index e9cd850..455a48a 100644 --- a/webroot/css/plenario.css +++ b/webroot/css/plenario.css @@ -816,6 +816,8 @@ body.present { .modal::backdrop { background: rgba(10, 12, 30, .55); } .modal__panel { max-height: calc(100dvh - 24px); overflow: auto; + /* slim scrollbar in the theme colours instead of the bright system one */ + scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--muted) 55%, transparent) transparent; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: 0 20px 60px rgba(0, 0, 0, .35); } @@ -836,12 +838,54 @@ body:has(dialog[open]) { overflow: hidden; } /* slide images: participant page and slide form */ .slide-image { margin: 1em 0; } .slide-image img { display: block; max-width: 100%; height: auto; margin: 0 auto; border-radius: 8px; } -.image-fields, .image-fields__layout { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; } +/* Full width dividers: reach through the 24px padding of .card. */ +.image-section { margin: 24px -24px; padding: 16px 24px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); } +.image-fields, .image-layout { border: 0; padding: 0; margin: 0; min-width: 0; } .image-fields > legend { font-weight: 600; padding: 0; margin-bottom: .5em; } -.image-fields__layout > legend { padding: 0; margin-bottom: .25em; } -.image-fields__current { margin: 0 0 .75em; } +.image-fields__optional { font-weight: 400; color: var(--muted); } +.image-layout { margin-top: 16px; } +.image-layout > legend { font-weight: 600; padding: 0; margin-bottom: .5em; } +.image-layout .hint { margin-bottom: 0; } + +/* dropzone (no image yet) */ +.image-drop { + display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; + padding: 20px 16px; border: 2px dashed var(--border); border-radius: 10px; + color: var(--muted); cursor: pointer; +} +.image-drop[hidden] { display: none; } +.image-drop:hover, .image-drop.is-dragover, .image-fields:has(input[type="file"]:focus-visible) .image-drop { + border-color: var(--primary); background: var(--primary-soft); color: var(--text); +} +.image-fields:has(input[type="file"]:focus-visible) .image-drop { outline: 3px solid var(--primary); outline-offset: 2px; } +.image-drop__title { font-weight: 600; color: var(--text); } +.image-drop__hint { font-size: .875rem; } + +/* current or chosen image: thumbnail, info, buttons */ +.image-fields__row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; } +.image-fields__row[hidden] { display: none; } +.image-fields__row.is-dragover { border-color: var(--primary); background: var(--primary-soft); } +.image-fields__current { margin: 0; flex: none; } +.image-fields__current img { display: block; max-width: 160px; max-height: 110px; width: auto; height: auto; border-radius: 6px; background: var(--surface-2); } .image-fields__current.is-removed img { opacity: .3; filter: grayscale(1); } -.image-fields__remove { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 0 0 1em; } -.image-fields__remove .button { display: inline-flex; align-items: center; gap: 6px; } -.image-fields__remove .hint { margin: 0; } -.image-fields__current img { display: block; max-width: 100%; max-height: 180px; width: auto; height: auto; border-radius: 6px; } +.image-fields__side { flex: 1 1 200px; min-width: 0; } +.image-fields__info { margin: 0 0 8px; font-size: .875rem; color: var(--muted); overflow-wrap: anywhere; } +.image-fields__buttons { display: flex; flex-wrap: wrap; gap: 8px; } +.image-fields__buttons .button { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; } +.image-fields:has(input[type="file"]:focus-visible) .image-fields__buttons [data-image-pick] { outline: 3px solid var(--primary); outline-offset: 2px; } +.image-fields__remove { margin: 0; } +.image-fields__help { margin-top: 8px; font-size: .875rem; color: var(--muted); } +.image-fields__help summary { cursor: pointer; width: fit-content; } +.image-fields__help .hint { margin: .5em 0 0; } + +/* placement tiles (radios) */ +.image-layout__tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; max-width: 420px; } +.image-layout__tile { + display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 8px; + border: 2px solid var(--border); border-radius: 8px; cursor: pointer; color: var(--muted); font-size: .9rem; +} +.image-layout__tile svg { max-width: 100%; height: auto; } +.image-layout__tile svg .img { fill: var(--primary); opacity: .45; } +.image-layout__tile:hover { border-color: var(--primary); } +.image-layout__tile:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--text); font-weight: 600; } +.image-layout__tile:has(input:focus-visible) { outline: 3px solid var(--primary); outline-offset: 2px; } diff --git a/webroot/js/plenario.js b/webroot/js/plenario.js index e2579e0..d94b4b7 100644 --- a/webroot/js/plenario.js +++ b/webroot/js/plenario.js @@ -2279,51 +2279,132 @@ // ------------------------------------------------------------------ slide form - /** Slide image: a trash button toggles the "remove image" checkbox (the checkbox stays for use without JavaScript). */ - function initImageRemove(box) { - var checkbox = box.querySelector('input[type="checkbox"]'); - var button = box.querySelector('[data-image-remove-button]'); - var status = box.querySelector('[data-image-remove-status]'); - var figure = box.parentNode.querySelector('.image-fields__current'); - if (!checkbox || !button) { - return; - } - var field = checkbox.closest('.input'); - if (field) { - field.hidden = true; - } - button.hidden = false; - button.addEventListener('click', function () { - checkbox.checked = !checkbox.checked; - button.setAttribute('aria-pressed', checkbox.checked ? 'true' : 'false'); - button.querySelector('[data-label]').textContent = button.getAttribute(checkbox.checked ? 'data-label-undo' : 'data-label-remove'); - if (figure) { - figure.classList.toggle('is-removed', checkbox.checked); - } - if (status) { - status.textContent = checkbox.checked ? 'Das Bild wird beim Speichern entfernt.' : ''; - } - }); - } - /** - * Slide image: the placement question only makes sense with an image, i.e. an existing one that is not - * marked for removal, or a newly selected file. Without JavaScript it stays visible. + * Slide image section: dropzone (also drag and drop) while there is no image, otherwise a row with + * preview and replace/remove buttons. A newly chosen file is previewed right away. The placement + * question only shows with an image (existing and not marked for removal, or a chosen file). + * Without JavaScript the label opens the file dialog, the checkbox removes and the placement stays visible. */ function initImageFields(box) { - var layout = box.querySelector('[data-image-layout]'); var file = box.querySelector('input[type="file"]'); - var remove = box.querySelector('input[name="remove_image"]'); - if (!layout || !file) { + var layout = box.querySelector('[data-image-layout]'); + var drop = box.querySelector('[data-image-drop]'); + var row = box.querySelector('[data-image-row]'); + var img = box.querySelector('[data-image-figure] img'); + var figure = box.querySelector('[data-image-figure]'); + var info = box.querySelector('[data-image-info]'); + var pick = box.querySelector('[data-image-pick]'); + var button = box.querySelector('[data-image-remove-button]'); + var checkbox = box.querySelector('input[name="remove_image"]'); + if (!file || !layout || !drop || !row || !img || !button) { return; } var hasImage = box.hasAttribute('data-has-image'); - function update() { - var removed = !!remove && remove.checked; - layout.hidden = !(file.files && file.files.length > 0) && !(hasImage && !removed); + var original = img.getAttribute('data-image-original') || ''; + var width = img.getAttribute('width'); + var height = img.getAttribute('height'); + var objectUrl = null; + + // The checkbox is replaced by the button (it stays in the form and is toggled by it). + var removeBox = box.querySelector('[data-image-remove]'); + if (removeBox) { + removeBox.hidden = true; } - box.addEventListener('change', update); - box.addEventListener('click', update); + var extra = box.querySelector('[data-image-drop-extra]'); + if (extra) { + extra.hidden = false; + } + button.hidden = false; + + function formatSize(bytes) { + return bytes < 1048576 ? Math.max(1, Math.round(bytes / 1024)) + ' KB' : (bytes / 1048576).toFixed(1).replace('.', ',') + ' MB'; + } + + function update() { + var chosen = !!file.files && file.files.length > 0; + var removed = !!checkbox && checkbox.checked && !chosen; + if (objectUrl) { + URL.revokeObjectURL(objectUrl); + objectUrl = null; + } + if (chosen) { + objectUrl = URL.createObjectURL(file.files[0]); + img.src = objectUrl; + img.removeAttribute('width'); + img.removeAttribute('height'); + } else { + img.src = original; + if (width && height) { + img.setAttribute('width', width); + img.setAttribute('height', height); + } + } + var showRow = chosen || hasImage; + var focusLost = row.hidden === false && !showRow; + row.hidden = !showRow; + drop.hidden = showRow; + figure.classList.toggle('is-removed', removed); + if (info) { + info.textContent = chosen + ? info.getAttribute('data-text-new') + ' ' + file.files[0].name + ' (' + formatSize(file.files[0].size) + ')' + : (removed ? info.getAttribute('data-text-removed') : (hasImage ? info.getAttribute('data-text-current') : '')); + } + if (pick) { + pick.textContent = pick.getAttribute(chosen || !hasImage ? 'data-label-choose' : 'data-label-replace'); + } + button.querySelector('[data-label]').textContent = button.getAttribute(chosen ? 'data-label-discard' : (removed ? 'data-label-undo' : 'data-label-remove')); + if (!chosen && checkbox) { + button.setAttribute('aria-pressed', removed ? 'true' : 'false'); + } else { + button.removeAttribute('aria-pressed'); + } + layout.hidden = !chosen && !(hasImage && !removed); + if (focusLost) { + file.focus(); + } + } + + file.addEventListener('change', function () { + if (file.files && file.files.length > 0 && checkbox) { + // A new image replaces the old one, so "remove" no longer applies. + checkbox.checked = false; + } + update(); + }); + button.addEventListener('click', function () { + if (file.files && file.files.length > 0) { + file.value = ''; + } else if (checkbox) { + checkbox.checked = !checkbox.checked; + } + update(); + }); + + [drop, row].forEach(function (zone) { + zone.addEventListener('dragover', function (event) { + event.preventDefault(); + zone.classList.add('is-dragover'); + }); + zone.addEventListener('dragleave', function () { + zone.classList.remove('is-dragover'); + }); + zone.addEventListener('drop', function (event) { + event.preventDefault(); + zone.classList.remove('is-dragover'); + var dropped = event.dataTransfer && event.dataTransfer.files; + if (!dropped || dropped.length === 0 || typeof DataTransfer === 'undefined') { + return; + } + try { + var transfer = new DataTransfer(); + transfer.items.add(dropped[0]); + file.files = transfer.files; + file.dispatchEvent(new Event('change', {bubbles: true})); + } catch (e) { + // Browser without assignable file lists: the file dialog still works. + } + }); + }); update(); } @@ -2967,7 +3048,6 @@ initCopy(root); root.querySelectorAll('[data-youtube-form]').forEach(initYouTubeForm); root.querySelectorAll('[data-quiz-options]').forEach(initQuizOptions); - root.querySelectorAll('[data-image-remove]').forEach(initImageRemove); root.querySelectorAll('[data-image-fields]').forEach(initImageFields); root.querySelectorAll('[data-sortable]').forEach(initSortable); root.querySelectorAll('[data-order-options]').forEach(initOrderOptions); -- 2.54.1 From 83c76d72ec8920d08c94ae5722796cdd955dac7a Mon Sep 17 00:00:00 2001 From: Patrick Niebeling Date: Tue, 17 Nov 2026 14:18:15 +0100 Subject: [PATCH 2/3] Rename "personal ranking" to "own assessment" in the UI The label now says what participants do (sort by their own assessment, e.g. by importance) instead of using the vague term "Rangfolge". Co-Authored-By: Claude Sonnet 5.5 --- docs/slide-types.md | 2 +- templates/Admin/export.php | 2 +- templates/Admin/index.php | 2 +- templates/Slides/form.php | 2 +- tests/TestCase/Controller/OrderSlideTest.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/slide-types.md b/docs/slide-types.md index 98ebd21..aa5c0c0 100644 --- a/docs/slide-types.md +++ b/docs/slide-types.md @@ -80,7 +80,7 @@ Details zu den einzelnen Folientypen. Übersicht und zentrale Regeln stehen in [ Vorher landen weder richtige Reihenfolge noch Zählungen im JSON (Presenter sieht die Einträge gemischt mit Seed `slide:{id}`); danach sieht der Presenter die Lösung inkl. „X von N komplett richtig“ und je Eintrag, wie oft er an der richtigen Stelle lag; Teilnehmende nur die Lösung mit eigenen Platzierungen und `order.isCorrect`. Tests: `OrderTest.php`, `OrderSlideTest.php`. -- **Persönliche Rangfolge** (Setting `ranking`, `Slide::isRanking()`): keine richtige Lösung („Sortiere nach deiner Wichtigkeit“). +- **Eigene Einschätzung** (Setting `ranking`, `Slide::isRanking()`): keine richtige Lösung (Checkbox „Keine richtige Reihenfolge …“, z. B. nach Wichtigkeit). Gespeichert wird wie sonst (`order[]`), die Reihenfolge der Einträge im Editor zählt nicht. `isOrderRevealed()` ist dann nie wahr: Teilnehmende bekommen weder `results` noch Urteil (`order.ranking` steuert die Texte), nur die Bestätigung. Der Presenter sieht live (auch bei offener Abstimmung, es gibt nichts zu verbergen) `ResultsService::ranking()`: Einträge nach durchschnittlichem Platz diff --git a/templates/Admin/export.php b/templates/Admin/export.php index 3bed113..474f127 100644 --- a/templates/Admin/export.php +++ b/templates/Admin/export.php @@ -141,7 +141,7 @@ $bar = function (float $percent, bool $ok = false): string {

-

+

diff --git a/templates/Admin/index.php b/templates/Admin/index.php index e55ce73..e4cc0e7 100644 --- a/templates/Admin/index.php +++ b/templates/Admin/index.php @@ -119,7 +119,7 @@ $hasInternal = array_filter($slides, fn($slide) => !$slide->is_hidden && $slide- setting('upvote_share')) ?> 0 ? ' · ' . __n('{0} pro Frage', '{0} pro Frage', $perQuestion, $perQuestion) : '' ?>setting('allow_self_upvote') ? ' · ' . __('auch für eigene Fragen') : '' ?> isRanking()) : ?> - · is_voting_open ? __('Persönliche Rangfolge') : __('Persönliche Rangfolge, Abstimmung geschlossen') ?> + · is_voting_open ? __('Eigene Einschätzung') : __('Eigene Einschätzung, Abstimmung geschlossen') ?>isOrder() && !$slide->is_voting_open) : ?> · is_voting_open) : ?>· diff --git a/templates/Slides/form.php b/templates/Slides/form.php index 8d3663b..7572a96 100644 --- a/templates/Slides/form.php +++ b/templates/Slides/form.php @@ -305,7 +305,7 @@ $optionsError = $slide->getError('options_text'); Form->control('settings.ranking', [ 'type' => 'checkbox', - 'label' => __('Persönliche Rangfolge: keine richtige Lösung (z. B. „Sortiere nach deiner Wichtigkeit“)'), + 'label' => __('Keine richtige Reihenfolge – Teilnehmende sortieren nach eigener Einschätzung (z. B. nach Wichtigkeit)'), 'checked' => (bool)$settings['ranking'], ]) ?>

diff --git a/tests/TestCase/Controller/OrderSlideTest.php b/tests/TestCase/Controller/OrderSlideTest.php index 3a25036..5ff8ee8 100644 --- a/tests/TestCase/Controller/OrderSlideTest.php +++ b/tests/TestCase/Controller/OrderSlideTest.php @@ -132,6 +132,6 @@ class OrderSlideTest extends TestCase $this->assertSame(100.0, (float)$results['items'][0]['score']); $html = $this->exportHtml($token); - $this->assertStringContainsString('persönliche Rangfolgen', $html); + $this->assertStringContainsString('Einschätzungen, sortiert nach', $html); } } -- 2.54.1 From bb2d1443cf2614306bd0078f593d9277de9230b8 Mon Sep 17 00:00:00 2001 From: Patrick Niebeling Date: Tue, 17 Nov 2026 14:18:15 +0100 Subject: [PATCH 3/3] Remove the "voting open" checkbox from the slide form is_voting_open is presenter state (SlideControlService), so the form never takes it over anymore, for all slide types instead of only quiz and Q&A. New slides start open (quiz closed), as before. Co-Authored-By: Claude Sonnet 5.5 --- docs/slide-types.md | 4 ++++ src/Controller/SlidesController.php | 7 ++----- templates/Slides/form.php | 8 -------- tests/TestCase/Controller/OrderSlideTest.php | 6 +++--- 4 files changed, 9 insertions(+), 16 deletions(-) diff --git a/docs/slide-types.md b/docs/slide-types.md index aa5c0c0..6fc47ba 100644 --- a/docs/slide-types.md +++ b/docs/slide-types.md @@ -2,6 +2,10 @@ Details zu den einzelnen Folientypen. Übersicht und zentrale Regeln stehen in [AGENTS.md](../AGENTS.md). +**Abstimmung offen/geschlossen:** `slides.is_voting_open` ist Laufzeitzustand der Präsentation und im Folienformular +nicht editierbar (`SlidesController::saveSlide()` übernimmt das Feld nie). Neue Folien starten offen (Quiz geschlossen), +geändert wird es nur über die Presenter-Steuerung (`SlideControlService`) bzw. `QaService`; der Reset stellt es zurück. + ## Wortwolke - Ausnahme Wortwolke: Begriffe werden einzeln abgegeben (AJAX, `vote` liefert dann JSON `{ok, message, state}`), diff --git a/src/Controller/SlidesController.php b/src/Controller/SlidesController.php index 75dde6a..381615c 100644 --- a/src/Controller/SlidesController.php +++ b/src/Controller/SlidesController.php @@ -299,11 +299,8 @@ class SlidesController extends AdminAppController $data['type'] = $slide->type; // The upload is handled by prepareImage(); the marshaller must not see the file object. unset($data['image']); - $fields = ['type', 'question', 'description', 'settings', 'is_voting_open']; - if ($slide->isQuiz() || $slide->isQa()) { - // Quiz and Q&A voting is controlled by the presenter only. - $fields = array_values(array_diff($fields, ['is_voting_open'])); - } + // is_voting_open is presenter state (SlideControlService), never editable via the form. + $fields = ['type', 'question', 'description', 'settings']; $youtube = $slide->isYouTube() ? $this->prepareYouTube($data) : ['errors' => [], 'warning' => null]; $this->Slides->patchEntity($slide, $data, ['fields' => $fields, 'associated' => []]); foreach ($youtube['errors'] as $field => $message) { diff --git a/templates/Slides/form.php b/templates/Slides/form.php index 7572a96..d2f0a04 100644 --- a/templates/Slides/form.php +++ b/templates/Slides/form.php @@ -354,14 +354,6 @@ $optionsError = $slide->getError('options_text');

- isInteractive() && !$slide->isQuiz() && !$slide->isQa()) : ?> - Form->control('is_voting_open', [ - 'type' => 'checkbox', - 'label' => __('Abstimmung geöffnet'), - 'checked' => $isNew ? true : $slide->is_voting_open, - ]) ?> - -
Form->button($isNew ? __('Folie anlegen') : __('Speichern'), ['class' => 'button button--primary']) ?> diff --git a/tests/TestCase/Controller/OrderSlideTest.php b/tests/TestCase/Controller/OrderSlideTest.php index 5ff8ee8..30db76f 100644 --- a/tests/TestCase/Controller/OrderSlideTest.php +++ b/tests/TestCase/Controller/OrderSlideTest.php @@ -37,7 +37,7 @@ class OrderSlideTest extends TestCase $this->assertResponseContains('name="order_options[]"'); $this->assertResponseContains('data-order-options'); - $data = ['type' => 'order', 'question' => 'Sortiere nach Größe', 'is_voting_open' => '1']; + $data = ['type' => 'order', 'question' => 'Sortiere nach Größe', 'is_voting_open' => '0']; $this->post("/admin/$token/slides/add?type=order", $data + ['order_options' => ['Maus', '', '']]); $this->assertResponseOk(); $this->assertResponseContains('Bitte gib mindestens zwei Einträge an.'); @@ -49,7 +49,7 @@ class OrderSlideTest extends TestCase $this->assertRedirect(['_name' => 'admin', 'token' => $token]); $slide = $this->slidesTable()->find()->where(['poll_id' => $poll->id])->contain(['SlideOptions'])->firstOrFail(); $this->assertSame(['Maus', 'Katze', 'Elefant'], array_map(fn($o) => $o->label, $slide->slide_options)); - $this->assertTrue($slide->is_voting_open); + $this->assertTrue($slide->is_voting_open, 'the form cannot close voting, only the presenter can'); $ids = array_map(fn($o) => $o->id, $slide->slide_options); // Reordering in the editor keeps the options (ids), only the positions change. @@ -97,7 +97,7 @@ class OrderSlideTest extends TestCase { [$poll, $token] = $this->createPoll(); $this->post("/admin/$token/slides/add?type=order", [ - 'type' => 'order', 'question' => 'Was ist dir wichtig?', 'is_voting_open' => '1', + 'type' => 'order', 'question' => 'Was ist dir wichtig?', 'settings' => ['ranking' => '1'], 'order_options' => ['Eins', 'Zwei', 'Drei'], ]); $slide = $this->slidesTable()->find()->where(['poll_id' => $poll->id])->contain(['SlideOptions'])->firstOrFail(); -- 2.54.1