Add internal feedback and comments to choice slides
Same options as for scales: "private" shows only the number of votes on the stage, "comments" adds an optional comment field whose comments rotate in the presentation, "comment_ratings" shows the chosen answer(s) next to each comment. With multiple choice the comment is stored on the participant's first row. Settings and participant fields are shared elements for scale and choice. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3e09906830
commit
547b564e32
18 files changed
+485
-108
No files matched your search
@@ -100,7 +100,7 @@ $url = fn(string $name, array $params = []) => ['_name' => $name, 'token' => $ad
|
||||
<span class="muted">· <?= __('Abstimmung geschlossen, aufgelöst') ?></span>
|
||||
<?php elseif (!$slide->is_voting_open) : ?><span class="muted">· <?= __('Abstimmung geschlossen') ?></span><?php endif; ?>
|
||||
<?php if ($slide->hasComments()) : ?><span class="badge" title="<?= __('Teilnehmende können einen Kommentar abgeben') ?>">💬 <?= __('Kommentare') ?></span><?php endif; ?>
|
||||
<?php if ($slide->isPrivate()) : ?><span class="badge" title="<?= __('Antworten werden nicht öffentlich angezeigt') ?>">🔒 <?= $slide->type === 'scale' ? __('intern') : __('anonym') ?></span><?php endif; ?>
|
||||
<?php if ($slide->isPrivate()) : ?><span class="badge" title="<?= __('Antworten werden nicht öffentlich angezeigt') ?>">🔒 <?= $slide->type === 'open' ? __('anonym') : __('intern') ?></span><?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<a class="slide-item__title" href="<?= $this->Url->build($url('slides:edit', ['id' => $slide->id])) ?>"><?= h($slide->question) ?></a>
|
||||
@@ -136,7 +136,7 @@ $url = fn(string $name, array $params = []) => ['_name' => $name, 'token' => $ad
|
||||
]) ?>
|
||||
<?php endif; ?>
|
||||
<?php if (($slide->type === 'open' || $slide->isPrivate() || $slide->hasComments()) && $count > 0) : ?>
|
||||
<a class="button button--small" href="<?= $this->Url->build($url('slides:answers', ['id' => $slide->id])) ?>"><?= $slide->type === 'scale' ? __('Auswertung') : __('Antworten') ?></a>
|
||||
<a class="button button--small" href="<?= $this->Url->build($url('slides:answers', ['id' => $slide->id])) ?>"><?= $slide->type === 'open' ? __('Antworten') : __('Auswertung') ?></a>
|
||||
<?php endif; ?>
|
||||
<a class="button button--small" href="<?= $this->Url->build($url('slides:edit', ['id' => $slide->id])) ?>"><?= __('Bearbeiten') ?></a>
|
||||
<?php if ($count > 0) : ?>
|
||||
|
||||
@@ -217,7 +217,7 @@ $countdown = function (?int $remaining): string {
|
||||
<?php if ($slide->type === 'choice') :
|
||||
$multiple = (bool)$slide->setting('multiple'); ?>
|
||||
<?php if ($multiple) : ?><p class="hint"><?= __('Mehrfachauswahl möglich') ?></p><?php endif; ?>
|
||||
<div class="choices">
|
||||
<div class="choices"<?= $slide->isPrivate() ? ' aria-describedby="private-hint"' : '' ?>>
|
||||
<?php foreach ($slide->slide_options as $option) : ?>
|
||||
<label class="choice">
|
||||
<input type="<?= $multiple ? 'checkbox' : 'radio' ?>"
|
||||
@@ -227,6 +227,7 @@ $countdown = function (?int $remaining): string {
|
||||
</label>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?= $this->element('feedback_fields', ['slide' => $slide, 'placeholder' => __('Möchtest du deine Wahl begründen?')]) ?>
|
||||
|
||||
<?php elseif ($slide->type === 'open') : ?>
|
||||
<textarea name="text" rows="4" maxlength="500" required
|
||||
@@ -251,16 +252,7 @@ $countdown = function (?int $remaining): string {
|
||||
<span><?= h((string)$slide->setting('min_label')) ?></span>
|
||||
<span><?= h((string)$slide->setting('max_label')) ?></span>
|
||||
</div>
|
||||
<?php if ($slide->hasComments()) : ?>
|
||||
<label class="scale-comment" for="scale-comment"><?= __('Kommentar (optional)') ?></label>
|
||||
<textarea id="scale-comment" name="comment" rows="3" maxlength="500"
|
||||
placeholder="<?= __('Möchtest du deine Bewertung begründen?') ?>"></textarea>
|
||||
<?php endif; ?>
|
||||
<?php if ($slide->isPrivate()) : ?>
|
||||
<p class="hint private-hint" id="private-hint">
|
||||
🔒 <?= __('Internes Feedback: Das Ergebnis wird nicht öffentlich angezeigt und deine Bewertung nicht mit deinem Namen gespeichert.') ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?= $this->element('feedback_fields', ['slide' => $slide, 'placeholder' => __('Möchtest du deine Bewertung begründen?')]) ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?= $this->Form->button(__('Absenden'), ['class' => 'button button--primary button--block']) ?>
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
* @var string $adminToken
|
||||
* @var \App\Model\Entity\Slide $slide
|
||||
* @var list<array{text: string, created: string}> $answers
|
||||
* @var array<string, mixed>|null $scale Distribution of a scale slide, null for open questions
|
||||
* @var array<string, mixed>|null $scale Distribution of a scale slide, null otherwise
|
||||
* @var array<string, mixed>|null $choice Votes of a choice slide, null otherwise
|
||||
* @var int $participants Participants who answered
|
||||
* @var list<array{id: int, text: string, value: int, created: string}> $comments Comments of a scale, oldest first
|
||||
*/
|
||||
use Cake\I18n\DateTime;
|
||||
@@ -22,21 +24,46 @@ $count = $scale !== null ? array_sum(array_column($scale['buckets'], 'count')) :
|
||||
<section class="card">
|
||||
<p class="eyebrow">
|
||||
<?= h($slide->typeLabel()) ?>
|
||||
<?php if ($slide->isPrivate()) : ?>· 🔒 <?= $scale !== null ? __('Internes Feedback') : __('Anonymes Feedback') ?><?php endif; ?>
|
||||
<?php if ($slide->isPrivate()) : ?>· 🔒 <?= $slide->type === 'open' ? __('Anonymes Feedback') : __('Internes Feedback') ?><?php endif; ?>
|
||||
</p>
|
||||
<h1><?= h($slide->question) ?></h1>
|
||||
<?php if ($scale !== null) : ?>
|
||||
<p class="muted"><?= __n('{0} Bewertung', '{0} Bewertungen', $count, $count) ?></p>
|
||||
<?php elseif ($choice !== null) : ?>
|
||||
<p class="muted"><?= __n('{0} Person hat abgestimmt', '{0} Personen haben abgestimmt', $participants, $participants) ?></p>
|
||||
<?php else : ?>
|
||||
<p class="muted"><?= __n('{0} Antwort, neueste zuerst', '{0} Antworten, neueste zuerst', $count, $count) ?></p>
|
||||
<?php endif; ?>
|
||||
<?php if ($slide->isPrivate()) : ?>
|
||||
<p class="hint"><?= $scale !== null
|
||||
? __('Dieses Ergebnis wird weder in der Präsentation noch den Teilnehmenden angezeigt.')
|
||||
: __('Diese Antworten werden weder in der Präsentation noch den Teilnehmenden angezeigt.') ?></p>
|
||||
<p class="hint"><?= $slide->type === 'open'
|
||||
? __('Diese Antworten werden weder in der Präsentation noch den Teilnehmenden angezeigt.')
|
||||
: __('Dieses Ergebnis wird weder in der Präsentation noch den Teilnehmenden angezeigt.') ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($scale !== null) : ?>
|
||||
<?php if ($choice !== null) : ?>
|
||||
<?php if ($participants === 0) : ?>
|
||||
<p class="empty"><?= __('Noch keine Stimmen.') ?></p>
|
||||
<?php else : ?>
|
||||
<table class="scale-table">
|
||||
<caption class="sr-only"><?= __('Stimmen je Antwort') ?></caption>
|
||||
<thead>
|
||||
<tr><th scope="col"><?= __('Antwort') ?></th><th scope="col"><?= __('Anzahl') ?></th><th scope="col"><?= __('Anteil') ?></th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($choice['options'] as $option) : ?>
|
||||
<tr>
|
||||
<th scope="row"><?= h($option['label']) ?></th>
|
||||
<td><?= (int)$option['count'] ?></td>
|
||||
<td>
|
||||
<span class="scale-table__bar" style="width: <?= (float)$option['percent'] ?>%" aria-hidden="true"></span>
|
||||
<?= h($this->Number->format((float)$option['percent'], ['places' => 0, 'precision' => 1, 'locale' => 'de_DE'])) ?> %
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php endif; ?>
|
||||
<?php elseif ($scale !== null) : ?>
|
||||
<?php if ($count === 0) : ?>
|
||||
<p class="empty"><?= __('Noch keine Bewertungen.') ?></p>
|
||||
<?php else : ?>
|
||||
@@ -69,22 +96,6 @@ $count = $scale !== null ? array_sum(array_column($scale['buckets'], 'count')) :
|
||||
</tbody>
|
||||
</table>
|
||||
<?php endif; ?>
|
||||
<?php if ($slide->hasComments()) : ?>
|
||||
<h2><?= __n('{0} Kommentar', '{0} Kommentare', count($comments), count($comments)) ?></h2>
|
||||
<?php if ($comments === []) : ?>
|
||||
<p class="empty"><?= __('Noch keine Kommentare.') ?></p>
|
||||
<?php else : ?>
|
||||
<ol class="answers-page" reversed>
|
||||
<?php foreach (array_reverse($comments) as $comment) :
|
||||
$created = new DateTime($comment['created']); ?>
|
||||
<li>
|
||||
<?= h($comment['text']) ?>
|
||||
<time datetime="<?= h($comment['created']) ?>"><?= __('Bewertung {0}', $comment['value']) ?> · <?= h($created->i18nFormat('dd.MM.yyyy, HH:mm')) ?></time>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ol>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<?php elseif ($answers === []) : ?>
|
||||
<p class="empty"><?= __('Noch keine Antworten.') ?></p>
|
||||
<?php else : ?>
|
||||
@@ -98,4 +109,21 @@ $count = $scale !== null ? array_sum(array_column($scale['buckets'], 'count')) :
|
||||
<?php endforeach; ?>
|
||||
</ol>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($slide->hasComments()) : ?>
|
||||
<h2><?= __n('{0} Kommentar', '{0} Kommentare', count($comments), count($comments)) ?></h2>
|
||||
<?php if ($comments === []) : ?>
|
||||
<p class="empty"><?= __('Noch keine Kommentare.') ?></p>
|
||||
<?php else : ?>
|
||||
<ol class="answers-page" reversed>
|
||||
<?php foreach (array_reverse($comments) as $comment) :
|
||||
$created = new DateTime($comment['created']); ?>
|
||||
<li>
|
||||
<?= h($comment['text']) ?>
|
||||
<time datetime="<?= h($comment['created']) ?>"><?= $choice !== null ? __('Antwort: {0}', h($comment['value'])) : __('Bewertung {0}', $comment['value']) ?> · <?= h($created->i18nFormat('dd.MM.yyyy, HH:mm')) ?></time>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ol>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
@@ -129,6 +129,10 @@ $optionsError = $slide->getError('options_text');
|
||||
'label' => __('Mehrfachauswahl erlauben'),
|
||||
'checked' => (bool)$settings['multiple'],
|
||||
]) ?>
|
||||
<?= $this->element('feedback_settings', [
|
||||
'settings' => $settings,
|
||||
'ratingLabel' => __('Gewählte Antwort beim Kommentar in der Präsentation anzeigen'),
|
||||
]) ?>
|
||||
<?php elseif ($slide->type === 'open') : ?>
|
||||
<?= $this->Form->control('settings.private', [
|
||||
'type' => 'checkbox',
|
||||
@@ -166,23 +170,10 @@ $optionsError = $slide->getError('options_text');
|
||||
'placeholder' => __('z. B. sehr'), 'value' => $settings['max_label'],
|
||||
]) ?>
|
||||
</div>
|
||||
<?= $this->Form->control('settings.comments', [
|
||||
'type' => 'checkbox',
|
||||
'label' => __('Kommentarfeld anzeigen (Teilnehmende können ihre Bewertung optional begründen)'),
|
||||
'checked' => (bool)$settings['comments'],
|
||||
<?= $this->element('feedback_settings', [
|
||||
'settings' => $settings,
|
||||
'ratingLabel' => __('Bewertung beim Kommentar in der Präsentation anzeigen'),
|
||||
]) ?>
|
||||
<p class="hint"><?= __('Die Kommentare laufen in der Präsentation nacheinander durch (nicht bei den Teilnehmenden). Bei internem Feedback siehst du sie nur in der Auswertung.') ?></p>
|
||||
<?= $this->Form->control('settings.comment_ratings', [
|
||||
'type' => 'checkbox',
|
||||
'label' => __('Bewertung beim Kommentar in der Präsentation anzeigen'),
|
||||
'checked' => (bool)$settings['comment_ratings'],
|
||||
]) ?>
|
||||
<?= $this->Form->control('settings.private', [
|
||||
'type' => 'checkbox',
|
||||
'label' => __('Internes Feedback: Ergebnis nicht öffentlich anzeigen'),
|
||||
'checked' => (bool)$settings['private'],
|
||||
]) ?>
|
||||
<p class="hint"><?= __('Präsentation und Teilnehmende sehen nur, wie viele Bewertungen eingegangen sind. Verteilung, Durchschnitt und Kommentare siehst nur du hier in der Verwaltung (und im CSV-Export).') ?></p>
|
||||
<?php elseif ($slide->type === 'quiz') :
|
||||
$quizError = $slide->getError('quiz_options');
|
||||
$rows = $quizOptions;
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* Optional comment field and internal-feedback hint below a scale or choice on the participant page.
|
||||
*
|
||||
* @var \App\View\AppView $this
|
||||
* @var \App\Model\Entity\Slide $slide Scale or choice slide
|
||||
* @var string $placeholder Placeholder of the comment field
|
||||
*/
|
||||
?>
|
||||
<?php if ($slide->hasComments()) : ?>
|
||||
<label class="comment-label" for="feedback-comment"><?= __('Kommentar (optional)') ?></label>
|
||||
<textarea id="feedback-comment" name="comment" rows="3" maxlength="500"
|
||||
placeholder="<?= h($placeholder) ?>"></textarea>
|
||||
<?php endif; ?>
|
||||
<?php if ($slide->isPrivate()) : ?>
|
||||
<p class="hint private-hint" id="private-hint">
|
||||
🔒 <?= __('Internes Feedback: Das Ergebnis wird nicht öffentlich angezeigt und deine Antwort nicht mit deinem Namen gespeichert.') ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* Settings "comment field" and "internal feedback" of a scale or choice slide.
|
||||
*
|
||||
* @var \App\View\AppView $this
|
||||
* @var array<string, mixed> $settings Current settings
|
||||
* @var string $ratingLabel Label of the setting comment_ratings
|
||||
*/
|
||||
?>
|
||||
<?= $this->Form->control('settings.comments', [
|
||||
'type' => 'checkbox',
|
||||
'label' => __('Kommentarfeld anzeigen (Teilnehmende können ihre Antwort optional begründen)'),
|
||||
'checked' => (bool)$settings['comments'],
|
||||
]) ?>
|
||||
<p class="hint"><?= __('Die Kommentare laufen in der Präsentation nacheinander durch (nicht bei den Teilnehmenden). Bei internem Feedback siehst du sie nur in der Auswertung.') ?></p>
|
||||
<?= $this->Form->control('settings.comment_ratings', [
|
||||
'type' => 'checkbox',
|
||||
'label' => $ratingLabel,
|
||||
'checked' => (bool)$settings['comment_ratings'],
|
||||
]) ?>
|
||||
<?= $this->Form->control('settings.private', [
|
||||
'type' => 'checkbox',
|
||||
'label' => __('Internes Feedback: Ergebnis nicht öffentlich anzeigen'),
|
||||
'checked' => (bool)$settings['private'],
|
||||
]) ?>
|
||||
<p class="hint"><?= __('Präsentation und Teilnehmende sehen nur, wie viele abgestimmt haben. Das Ergebnis und die Kommentare siehst nur du hier in der Verwaltung (und im CSV-Export).') ?></p>
|
||||
Reference in new issue
Block a user