Add instructions field to quiz and matching item types

Instructions are optional free text shown to the student above the questions/word bank.
Admin enters them in the item editor; stored in items.body for quiz and matching types.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Nate EmmertandClaude Sonnet 4.6 committed 2026-08-01 16:57:52 -04:00
1 parent f9cc515cec
commit 60bfe3ca4a
5 files changed
+35 -4

No files matched your search

+12 -2
View File
@@ -406,8 +406,12 @@ async function openItemEditor(unitId, itemId) {
$('#ie-retake-policy').value = item.retake_policy || 'latest';
if (item.type === 'spelling_practice' || item.type === 'spelling_test') $('#ie-list').value = item.ref_id;
if (item.type === 'flashcards') $('#ie-deck').value = item.ref_id;
if (item.type === 'quiz') (item.questions || []).forEach(addQuestionRow);
if (item.type === 'quiz') {
$('#ie-quiz-instructions').value = item.body || '';
(item.questions || []).forEach(addQuestionRow);
}
if (item.type === 'matching') {
$('#ie-matching-instructions').value = item.body || '';
$('#ie-pairs').innerHTML = '';
pairCount = 0;
(item.questions || []).forEach(addMatchingRow);
@@ -425,6 +429,8 @@ async function openItemEditor(unitId, itemId) {
$('#ie-title').value = '';
$('#ie-body-lesson').innerHTML = '';
$('#ie-body-assignment').innerHTML = '';
$('#ie-quiz-instructions').value = '';
$('#ie-matching-instructions').value = '';
$('#ie-points').value = 10;
$('#ie-due-date').value = '';
$('#ie-allow-retakes').checked = false;
@@ -713,7 +719,11 @@ $('#item-form').addEventListener('submit', async (e) => {
unitId: Number($('#ie-unit-id').value),
type,
title,
body: type === 'lesson' ? getLessonBody() : type === 'assignment' ? getAssignmentBody() : '',
body: type === 'lesson' ? getLessonBody()
: type === 'assignment' ? getAssignmentBody()
: type === 'quiz' ? $('#ie-quiz-instructions').value.trim()
: type === 'matching' ? $('#ie-matching-instructions').value.trim()
: '',
points: type === 'assignment' ? Number($('#ie-points').value) || 0 : 0,
refId: type === 'spelling_practice' || type === 'spelling_test' ? Number($('#ie-list').value)
: type === 'flashcards' ? Number($('#ie-deck').value) : null,