Make private slides start with hidden results instead of withholding them
Anonymous/internal feedback now only presets "hide results" on the stage: presenter and embed get the full results flagged private and can show them on demand. Participants still never get results of private slides, the public PDF export strips them via ResultsService::withoutContents(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d1facd32a6
commit
ecb8f9d31c
11 files changed
+143
-95
No files matched your search
+58
-23
@@ -453,16 +453,25 @@
|
||||
}));
|
||||
},
|
||||
|
||||
/**
|
||||
* Placeholder for a private slide (anonymous/internal feedback) while its results
|
||||
* are hidden on stage: only the count, the presenter can show the rest with H.
|
||||
*/
|
||||
privateSummary: function (results) {
|
||||
var n = results.participants;
|
||||
var noun = results.type === 'scale'
|
||||
? (n === 1 ? 'Bewertung' : 'Bewertungen')
|
||||
: (n === 1 ? 'anonyme Antwort' : 'anonyme Antworten');
|
||||
return el('div', { class: 'private-summary' }, [
|
||||
el('p', { class: 'private-summary__count', text: String(n) }),
|
||||
el('p', { text: noun + ' eingegangen' }),
|
||||
el('p', { class: 'private-summary__hint', text: results.type === 'scale'
|
||||
? '🔒 Internes Feedback – Ergebnis verborgen.'
|
||||
: '🔒 Anonymes Feedback – Antworten verborgen.' })
|
||||
]);
|
||||
},
|
||||
|
||||
scale: function (results) {
|
||||
if (results.private) {
|
||||
// Internal feedback: the ratings never reach the stage, only the count.
|
||||
var n = results.participants;
|
||||
return el('div', { class: 'private-summary' }, [
|
||||
el('p', { class: 'private-summary__count', text: String(n) }),
|
||||
el('p', { text: (n === 1 ? 'Bewertung' : 'Bewertungen') + ' eingegangen' }),
|
||||
el('p', { class: 'private-summary__hint', text: '🔒 Ergebnis wird nicht öffentlich angezeigt.' })
|
||||
]);
|
||||
}
|
||||
var max = Math.max.apply(null, results.buckets.map(function (b) { return b.count; }).concat([1]));
|
||||
var total = results.buckets.reduce(function (sum, b) { return sum + b.count; }, 0);
|
||||
var hasAverage = results.average !== null;
|
||||
@@ -688,15 +697,6 @@
|
||||
},
|
||||
|
||||
open: function (results) {
|
||||
if (results.private) {
|
||||
// Anonymous feedback: the texts never reach the stage, only the count.
|
||||
var n = results.participants;
|
||||
return el('div', { class: 'private-summary' }, [
|
||||
el('p', { class: 'private-summary__count', text: String(n) }),
|
||||
el('p', { text: (n === 1 ? 'anonyme Antwort' : 'anonyme Antworten') + ' eingegangen' }),
|
||||
el('p', { class: 'private-summary__hint', text: '🔒 Antworten werden nicht öffentlich angezeigt.' })
|
||||
]);
|
||||
}
|
||||
return el('ul', { class: 'answers' }, results.answers.map(function (answer) {
|
||||
return el('li', { class: 'answer', text: answer.text });
|
||||
}));
|
||||
@@ -968,7 +968,11 @@
|
||||
}
|
||||
};
|
||||
var last = '';
|
||||
// hideAll: the presenter's choice for normal slides (kept across slides).
|
||||
// hideResults: what applies to the current slide - private slides start hidden.
|
||||
var hideAll = false;
|
||||
var hideResults = false;
|
||||
var hideSlideId = null;
|
||||
var state = null;
|
||||
var mediaKey = '';
|
||||
|
||||
@@ -1057,13 +1061,38 @@
|
||||
? count + (count === 1 ? ' Frage' : ' Fragen')
|
||||
: count + ' ' + (count === 1 ? 'Antwort' : 'Antworten')));
|
||||
|
||||
if (slide.id !== hideSlideId) {
|
||||
hideSlideId = slide.id;
|
||||
hideResults = isPrivate() || hideAll;
|
||||
hideLabel();
|
||||
}
|
||||
renderResults();
|
||||
Countdown.start();
|
||||
}
|
||||
|
||||
function isPrivate() {
|
||||
return !!(state && state.slide && state.slide.isInteractive && state.results && state.results.private);
|
||||
}
|
||||
|
||||
function renderResults() {
|
||||
var container = q('[data-results]');
|
||||
container.classList.toggle('is-hidden', hideResults);
|
||||
Results.render(container, slide.isInteractive ? state.results : null, {
|
||||
var slide = state.slide;
|
||||
// Hidden private slides show how many answered instead of an empty stage.
|
||||
var summary = hideResults && isPrivate();
|
||||
container.classList.toggle('is-hidden', hideResults && !summary);
|
||||
if (summary) {
|
||||
container.textContent = '';
|
||||
container.appendChild(Results.privateSummary(state.results));
|
||||
return;
|
||||
}
|
||||
Results.render(container, slide && slide.isInteractive ? state.results : null, {
|
||||
onStage: function (stage) { control('stage', { stage: stage }); },
|
||||
onQuestion: function (step) { control('question', { step: step }); }
|
||||
});
|
||||
Countdown.start();
|
||||
}
|
||||
|
||||
function hideLabel() {
|
||||
setText('[data-hide-results] [data-label]', hideResults ? 'Ergebnisse zeigen' : 'Ergebnisse verbergen');
|
||||
}
|
||||
|
||||
function refresh() {
|
||||
@@ -1083,8 +1112,14 @@
|
||||
|
||||
function toggleHide() {
|
||||
hideResults = !hideResults;
|
||||
q('[data-results]').classList.toggle('is-hidden', hideResults);
|
||||
setText('[data-hide-results] [data-label]', hideResults ? 'Ergebnisse zeigen' : 'Ergebnisse verbergen');
|
||||
// Showing a private slide is a decision for this slide only.
|
||||
if (!isPrivate()) {
|
||||
hideAll = hideResults;
|
||||
}
|
||||
hideLabel();
|
||||
if (state) {
|
||||
renderResults();
|
||||
}
|
||||
}
|
||||
q('[data-hide-results]').addEventListener('click', toggleHide);
|
||||
|
||||
|
||||
Reference in new issue
Block a user