Show two answer rows by default for quiz and order slides
CI / Deploy / PHP 8.4 (push) Successful in 1m0s
CI / Deploy / PHP 8.5 (push) Successful in 1m5s
CI / Deploy / test (push) Successful in 2s
CI / Deploy / deploy (push) Skipped

Only two entries are required, so the form no longer offers four empty rows
up front; further rows come via the add button.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
gnilebeinandClaude Sonnet 5.5 committed 2026-11-12 22:34:21 +01:00
1 parent 4b5f9d92a1
commit 34d7e20567
1 file changed
+3 -3
+3 -3
View File
@@ -214,8 +214,8 @@ $optionsError = $slide->getError('options_text');
<?php elseif ($slide->type === 'quiz') : <?php elseif ($slide->type === 'quiz') :
$quizError = $slide->getError('quiz_options'); $quizError = $slide->getError('quiz_options');
$rows = $quizOptions; $rows = $quizOptions;
// Always offer a few empty rows (more via "Antwort hinzufügen" with JS). // Offer the two required rows (more via "Antwort hinzufügen" with JS), plus one spare when editing.
$rowCount = min(\App\Model\Table\SlidesTable::MAX_QUIZ_OPTIONS, max(4, count($rows) + 1)); $rowCount = min(\App\Model\Table\SlidesTable::MAX_QUIZ_OPTIONS, max(2, count($rows) + 1));
$rows = array_pad($rows, $rowCount, ['label' => '', 'correct' => false]); $rows = array_pad($rows, $rowCount, ['label' => '', 'correct' => false]);
?> ?>
<fieldset class="quiz-options<?= $quizError ? ' error' : '' ?>" data-quiz-options <fieldset class="quiz-options<?= $quizError ? ' error' : '' ?>" data-quiz-options
@@ -266,7 +266,7 @@ $optionsError = $slide->getError('options_text');
<?php elseif ($slide->isOrder()) : <?php elseif ($slide->isOrder()) :
$orderError = $slide->getError('order_options'); $orderError = $slide->getError('order_options');
$max = \App\Model\Table\SlidesTable::MAX_ORDER_OPTIONS; $max = \App\Model\Table\SlidesTable::MAX_ORDER_OPTIONS;
$rows = array_pad($orderOptions, min($max, max(4, count($orderOptions) + 1)), ''); $rows = array_pad($orderOptions, min($max, max(2, count($orderOptions) + 1)), '');
?> ?>
<fieldset class="order-options<?= $orderError ? ' error' : '' ?>" data-order-options data-max="<?= $max ?>" <fieldset class="order-options<?= $orderError ? ' error' : '' ?>" data-order-options data-max="<?= $max ?>"
aria-describedby="order-options-hint<?= $orderError ? ' order-options-error' : '' ?>"> aria-describedby="order-options-hint<?= $orderError ? ' order-options-error' : '' ?>">