Add "Keine Angabe" to scales and an "Enthaltung" shortcut for choice slides
CI / Deploy / PHP 8.5 (push) Successful in 1m38s
CI / Deploy / PHP 8.4 (push) Successful in 1m39s
CI / Deploy / test (push) Successful in 2s
CI / Deploy / deploy (push) Skipped

Scales and star ratings get an optional "Keine Angabe" answer (setting
allow_skip). It counts as taking part but stays out of the average and
the distribution; the number is shown separately on stage, in the
evaluation and in the PDF. The choice form gets a button that appends an
"Enthaltung" option.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
gnilebeinandClaude Sonnet 5.5 committed 2026-11-21 12:39:44 +01:00
1 parent 1b48ce7852
commit d6432911ed
14 files changed
+195 -11

No files matched your search

+1
View File
@@ -225,6 +225,7 @@ h3 { font-size: 1.05rem; margin-top: 1.6em; }
.button--danger { color: var(--danger); }
.button--danger:hover { border-color: var(--danger); }
.button--ghost { border-color: transparent; background: transparent; }
.button--skip { margin-top: 8px; }
.button--small { padding: 6px 10px; font-size: .85rem; }
.header-tools { display: flex; align-items: center; gap: 8px; }
.button--block { width: 100%; padding: 14px; font-size: 1.05rem; }
+50 -5
View File
@@ -794,7 +794,11 @@
el('span', { class: 'average__of', text: ofText })
]),
visual,
el('span', { class: 'average__count', text: total + (total === 1 ? ' Bewertung' : ' Bewertungen') })
el('span', {
class: 'average__count',
text: total + (total === 1 ? ' Bewertung' : ' Bewertungen')
+ (results.skipped ? ' · ' + results.skipped + '× keine Angabe' : '')
})
]);
},
@@ -2841,6 +2845,45 @@
update();
}
// ------------------------------------------------------------------ quick option (choice form)
/**
* Button that appends a ready-made option (e.g. "Enthaltung") to the option textarea.
* Idempotent: an existing line with the same text is not added again; the maximum is respected.
*/
function initAddOption(button) {
var area = document.getElementById(button.getAttribute('data-add-option-target'));
if (!area) {
return;
}
var label = button.getAttribute('data-add-option');
var max = parseInt(button.getAttribute('data-add-option-max'), 10) || 20;
function lines() {
return area.value.split(/\r?\n/).map(function (line) { return line.trim(); }).filter(Boolean);
}
function update() {
var current = lines();
var present = current.some(function (line) { return line.toLowerCase() === label.toLowerCase(); });
button.disabled = present || current.length >= max;
}
button.hidden = false;
button.addEventListener('click', function () {
var current = lines();
if (button.disabled) {
return;
}
current.push(label);
area.value = current.join('\n');
update();
area.focus();
});
area.addEventListener('input', update);
update();
}
// ------------------------------------------------------------------ theme switch
var THEME_ICONS = { auto: '◐', light: '☀', dark: '☾' };
@@ -3163,6 +3206,7 @@
root.querySelectorAll('[data-sortable]').forEach(initSortable);
root.querySelectorAll('[data-order-options]').forEach(initOrderOptions);
root.querySelectorAll('[data-scale-style]').forEach(initScaleStyle);
root.querySelectorAll('[data-add-option]').forEach(initAddOption);
}
// Flash messages: click hides them (delegated, no inline handlers because of the CSP).
@@ -3290,10 +3334,11 @@
if (event.defaultPrevented) {
return; // handled via fetch (word cloud)
}
var button = form.querySelector('button[type=submit], button:not([type])');
if (button) {
setTimeout(function () { button.disabled = true; }, 0);
}
// All buttons (e.g. "Absenden" and "Keine Angabe"); the pressed one is already part of the request.
var buttons = form.querySelectorAll('button[type=submit], button:not([type])');
setTimeout(function () {
buttons.forEach(function (button) { button.disabled = true; });
}, 0);
});
});
});