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 <noreply@anthropic.com>
This commit is contained in:
1 parent
83c76d72ec
commit
bb2d1443cf
4 files changed
+9
-16
No files matched your search
@@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
Details zu den einzelnen Folientypen. Übersicht und zentrale Regeln stehen in [AGENTS.md](../AGENTS.md).
|
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
|
## Wortwolke
|
||||||
|
|
||||||
- Ausnahme Wortwolke: Begriffe werden einzeln abgegeben (AJAX, `vote` liefert dann JSON `{ok, message, state}`),
|
- Ausnahme Wortwolke: Begriffe werden einzeln abgegeben (AJAX, `vote` liefert dann JSON `{ok, message, state}`),
|
||||||
|
|||||||
@@ -299,11 +299,8 @@ class SlidesController extends AdminAppController
|
|||||||
$data['type'] = $slide->type;
|
$data['type'] = $slide->type;
|
||||||
// The upload is handled by prepareImage(); the marshaller must not see the file object.
|
// The upload is handled by prepareImage(); the marshaller must not see the file object.
|
||||||
unset($data['image']);
|
unset($data['image']);
|
||||||
$fields = ['type', 'question', 'description', 'settings', 'is_voting_open'];
|
// is_voting_open is presenter state (SlideControlService), never editable via the form.
|
||||||
if ($slide->isQuiz() || $slide->isQa()) {
|
$fields = ['type', 'question', 'description', 'settings'];
|
||||||
// Quiz and Q&A voting is controlled by the presenter only.
|
|
||||||
$fields = array_values(array_diff($fields, ['is_voting_open']));
|
|
||||||
}
|
|
||||||
$youtube = $slide->isYouTube() ? $this->prepareYouTube($data) : ['errors' => [], 'warning' => null];
|
$youtube = $slide->isYouTube() ? $this->prepareYouTube($data) : ['errors' => [], 'warning' => null];
|
||||||
$this->Slides->patchEntity($slide, $data, ['fields' => $fields, 'associated' => []]);
|
$this->Slides->patchEntity($slide, $data, ['fields' => $fields, 'associated' => []]);
|
||||||
foreach ($youtube['errors'] as $field => $message) {
|
foreach ($youtube['errors'] as $field => $message) {
|
||||||
|
|||||||
@@ -354,14 +354,6 @@ $optionsError = $slide->getError('options_text');
|
|||||||
<p class="hint"><?= __('Ablauf in der Präsentation: 1. Fragen sammeln, 2. abstimmen, 3. besprechen – die Frage mit den meisten Upvotes zuerst. Ohne Upvotes entfällt Schritt 2. Du schaltest die Schritte selbst weiter.') ?></p>
|
<p class="hint"><?= __('Ablauf in der Präsentation: 1. Fragen sammeln, 2. abstimmen, 3. besprechen – die Frage mit den meisten Upvotes zuerst. Ohne Upvotes entfällt Schritt 2. Du schaltest die Schritte selbst weiter.') ?></p>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php if ($slide->isInteractive() && !$slide->isQuiz() && !$slide->isQa()) : ?>
|
|
||||||
<?= $this->Form->control('is_voting_open', [
|
|
||||||
'type' => 'checkbox',
|
|
||||||
'label' => __('Abstimmung geöffnet'),
|
|
||||||
'checked' => $isNew ? true : $slide->is_voting_open,
|
|
||||||
]) ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
<?= $this->Form->button($isNew ? __('Folie anlegen') : __('Speichern'), ['class' => 'button button--primary']) ?>
|
<?= $this->Form->button($isNew ? __('Folie anlegen') : __('Speichern'), ['class' => 'button button--primary']) ?>
|
||||||
<a class="button button--ghost" data-modal-close href="<?= $this->Url->build(['_name' => 'admin', 'token' => $adminToken]) ?>"><?= __('Abbrechen') ?></a>
|
<a class="button button--ghost" data-modal-close href="<?= $this->Url->build(['_name' => 'admin', 'token' => $adminToken]) ?>"><?= __('Abbrechen') ?></a>
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class OrderSlideTest extends TestCase
|
|||||||
$this->assertResponseContains('name="order_options[]"');
|
$this->assertResponseContains('name="order_options[]"');
|
||||||
$this->assertResponseContains('data-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->post("/admin/$token/slides/add?type=order", $data + ['order_options' => ['Maus', '', '']]);
|
||||||
$this->assertResponseOk();
|
$this->assertResponseOk();
|
||||||
$this->assertResponseContains('Bitte gib mindestens zwei Einträge an.');
|
$this->assertResponseContains('Bitte gib mindestens zwei Einträge an.');
|
||||||
@@ -49,7 +49,7 @@ class OrderSlideTest extends TestCase
|
|||||||
$this->assertRedirect(['_name' => 'admin', 'token' => $token]);
|
$this->assertRedirect(['_name' => 'admin', 'token' => $token]);
|
||||||
$slide = $this->slidesTable()->find()->where(['poll_id' => $poll->id])->contain(['SlideOptions'])->firstOrFail();
|
$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->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);
|
$ids = array_map(fn($o) => $o->id, $slide->slide_options);
|
||||||
|
|
||||||
// Reordering in the editor keeps the options (ids), only the positions change.
|
// Reordering in the editor keeps the options (ids), only the positions change.
|
||||||
@@ -97,7 +97,7 @@ class OrderSlideTest extends TestCase
|
|||||||
{
|
{
|
||||||
[$poll, $token] = $this->createPoll();
|
[$poll, $token] = $this->createPoll();
|
||||||
$this->post("/admin/$token/slides/add?type=order", [
|
$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'],
|
'settings' => ['ranking' => '1'], 'order_options' => ['Eins', 'Zwei', 'Drei'],
|
||||||
]);
|
]);
|
||||||
$slide = $this->slidesTable()->find()->where(['poll_id' => $poll->id])->contain(['SlideOptions'])->firstOrFail();
|
$slide = $this->slidesTable()->find()->where(['poll_id' => $poll->id])->contain(['SlideOptions'])->firstOrFail();
|
||||||
|
|||||||
Reference in new issue
Block a user