From bb2d1443cf2614306bd0078f593d9277de9230b8 Mon Sep 17 00:00:00 2001 From: Patrick Niebeling Date: Tue, 17 Nov 2026 14:18:15 +0100 Subject: [PATCH] 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();