Allow Q&A rounds without upvotes and limit upvotes per question
- max_upvotes = 0 disables upvoting: the voting stage is skipped (collect -> discuss), questions are discussed in submission order - new setting max_upvotes_per_question caps a participant's upvotes on a single question (0 = no limit besides max_upvotes) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3e44ded107
commit
bc86ec2db6
16 files changed
+235
-38
No files matched your search
+13
-6
@@ -743,9 +743,13 @@
|
||||
var onQuestion = options && options.onQuestion;
|
||||
var questions = results.questions;
|
||||
var maxVotes = Math.max.apply(null, questions.map(function (q) { return q.votes; }).concat([1]));
|
||||
var children = [Qa.steps(results.stage, onStage)];
|
||||
var children = [Qa.steps(results.stage, onStage, results.stages)];
|
||||
var withVotes = results.maxUpvotes > 0;
|
||||
|
||||
function votes(question) {
|
||||
if (!withVotes) {
|
||||
return null;
|
||||
}
|
||||
return el('span', {
|
||||
class: 'qa-votes',
|
||||
'aria-label': question.votes + (question.votes === 1 ? ' Stimme' : ' Stimmen'),
|
||||
@@ -763,6 +767,7 @@
|
||||
} else if (results.stage === 'vote') {
|
||||
children.push(el('p', { class: 'qa-summary', text: 'Abstimmen: jede Person hat '
|
||||
+ results.maxUpvotes + (results.maxUpvotes === 1 ? ' Stimme' : ' Stimmen')
|
||||
+ (results.maxPerQuestion < results.maxUpvotes ? ' (höchstens ' + results.maxPerQuestion + ' pro Frage)' : '')
|
||||
+ ' · bisher ' + results.upvotes + ' vergeben' }));
|
||||
children.push(el('ol', { class: 'qa-list' }, questions.map(function (question) {
|
||||
return el('li', { class: 'qa-item' }, [
|
||||
@@ -819,9 +824,9 @@
|
||||
var Qa = {
|
||||
labels: { collect: 'Fragen sammeln', vote: 'Abstimmen', discuss: 'Besprechen' },
|
||||
|
||||
/** Stepper of the three stages; clickable for the presenter (onStage). */
|
||||
steps: function (stage, onStage) {
|
||||
return el('ol', { class: 'qa-steps', 'aria-label': 'Ablauf' }, ['collect', 'vote', 'discuss'].map(function (key, i) {
|
||||
/** Stepper of the stages (without upvotes there is no voting stage); clickable for the presenter (onStage). */
|
||||
steps: function (stage, onStage, stages) {
|
||||
return el('ol', { class: 'qa-steps', 'aria-label': 'Ablauf' }, (stages || ['collect', 'vote', 'discuss']).map(function (key, i) {
|
||||
var current = key === stage;
|
||||
var label = (i + 1) + ' ' + Qa.labels[key];
|
||||
var item = onStage
|
||||
@@ -1430,7 +1435,7 @@
|
||||
'aria-label': given === 0 ? 'keine Stimme von dir' : given + (given === 1 ? ' Stimme' : ' Stimmen') + ' von dir',
|
||||
text: '▲ ' + given
|
||||
}),
|
||||
button('up', '+', 'Stimme geben', qa.votesLeft === 0)
|
||||
button('up', '+', 'Stimme geben', qa.votesLeft === 0 || given >= qa.maxPerQuestion)
|
||||
]);
|
||||
}
|
||||
return el('li', { class: 'qa-item' + (mine ? ' is-mine' : '') + (given > 0 ? ' is-upvoted' : '') }, [
|
||||
@@ -1463,7 +1468,9 @@
|
||||
}
|
||||
return el('li', attrs, [
|
||||
el('span', { class: 'qa-item__text', text: (i < index ? '✓ ' : '') + question.text + (mine ? ' (deine Frage)' : '') }),
|
||||
el('span', { class: 'qa-votes', 'aria-label': question.votes + (question.votes === 1 ? ' Stimme' : ' Stimmen'), text: '▲ ' + question.votes })
|
||||
qa.maxUpvotes > 0
|
||||
? el('span', { class: 'qa-votes', 'aria-label': question.votes + (question.votes === 1 ? ' Stimme' : ' Stimmen'), text: '▲ ' + question.votes })
|
||||
: null
|
||||
]);
|
||||
})));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user