Show two answer rows by default for quiz and order slides
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:
1 parent
4b5f9d92a1
commit
34d7e20567
1 file changed
+3
-3
@@ -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' : '' ?>">
|
||||||
|
|||||||
Reference in new issue
Block a user