Add ordering slide type
Participants bring shuffled items into the correct order and submit it once. The admin enters the items in the correct order and can reorder them by drag & drop or arrow keys. Closing the voting reveals the solution: how many got it completely right and how often each item was placed correctly; participants see whether their order was right. The drag & drop mechanics of the slide list are extracted into a reusable makeSortable() helper. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4eed568a64
commit
918e077734
17 files changed
+922
-95
No files matched your search
@@ -9,6 +9,7 @@
|
||||
* @var \App\Model\Entity\Slide $slide
|
||||
* @var string $optionsText
|
||||
* @var list<array{label: string, correct: bool}> $quizOptions
|
||||
* @var list<string> $orderOptions Ordering slide: labels in the correct order
|
||||
* @var bool|null $hasResponses
|
||||
*/
|
||||
|
||||
@@ -217,6 +218,39 @@ $optionsError = $slide->getError('options_text');
|
||||
'value' => $settings['time_limit'],
|
||||
]) ?>
|
||||
<p class="hint"><?= __('Das Quiz startet erst, wenn du es in der Präsentation startest. Du kannst es jederzeit vorzeitig beenden.') ?></p>
|
||||
<?php elseif ($slide->isOrder()) :
|
||||
$orderError = $slide->getError('order_options');
|
||||
$max = \App\Model\Table\SlidesTable::MAX_ORDER_OPTIONS;
|
||||
$rows = array_pad($orderOptions, min($max, max(4, count($orderOptions) + 1)), '');
|
||||
?>
|
||||
<fieldset class="order-options<?= $orderError ? ' error' : '' ?>" data-order-options data-max="<?= $max ?>"
|
||||
aria-describedby="order-options-hint<?= $orderError ? ' order-options-error' : '' ?>">
|
||||
<legend><?= __('Einträge in der richtigen Reihenfolge') ?></legend>
|
||||
<p class="hint" id="order-options-hint"><?= __('Mindestens zwei, maximal {0} Einträge – von oben (zuerst) nach unten. Teilnehmende bekommen sie gemischt und müssen sie sortieren. Leere Zeilen werden ignoriert.', $max) ?></p>
|
||||
<p class="hint" data-order-hint hidden><?= __('Zum Umsortieren den Griff ⠿ ziehen, oder Griff fokussieren und Pfeiltasten nutzen.') ?></p>
|
||||
<ol class="order-options__list" data-order-list>
|
||||
<?php foreach ($rows as $i => $label) : ?>
|
||||
<li class="order-option" data-order-row>
|
||||
<button type="button" class="drag-handle" data-drag-handle hidden
|
||||
aria-label="<?= __('Eintrag verschieben (Pfeiltasten)') ?>" title="<?= __('Ziehen zum Sortieren') ?>">⠿</button>
|
||||
<span class="order-option__pos" data-position aria-hidden="true"><?= $i + 1 ?>.</span>
|
||||
<label class="sr-only" for="order-option-<?= $i ?>" data-row-label><?= __('Platz {0}', $i + 1) ?></label>
|
||||
<input type="text" id="order-option-<?= $i ?>" name="order_options[]"
|
||||
value="<?= h($label) ?>" maxlength="255" <?= $i < 2 ? 'required' : '' ?>
|
||||
placeholder="<?= __('Eintrag {0}', $i + 1) ?>">
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ol>
|
||||
<p class="sr-only" role="status" aria-live="polite" data-order-status></p>
|
||||
<button type="button" class="button button--small" data-order-add hidden>+ <?= __('Eintrag hinzufügen') ?></button>
|
||||
<?php if ($orderError) : ?>
|
||||
<div class="error-message" id="order-options-error"><?= h(implode(' ', (array)$orderError)) ?></div>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($hasResponses)) : ?>
|
||||
<p class="hint"><?= __('Achtung: Umbenannte oder entfernte Einträge zählen bei bisherigen Antworten als falsch. Eine neue Reihenfolge gilt sofort für die Auswertung.') ?></p>
|
||||
<?php endif; ?>
|
||||
</fieldset>
|
||||
<p class="hint"><?= __('Aufgelöst wird, sobald du die Abstimmung schließt: Dann siehst du, wie viele richtig lagen, und jede Person sieht, ob ihre Reihenfolge stimmt.') ?></p>
|
||||
<?php elseif ($slide->type === 'qa') :
|
||||
$upvoteOptions = [];
|
||||
foreach (range(1, \App\Model\Entity\Slide::QA_MAX_UPVOTES) as $n) {
|
||||
|
||||
Reference in new issue
Block a user