Add internal feedback and comments to scale slides
- Setting "private": distribution and average are only shown in the
admin evaluation page and CSV export, the stage shows just the count.
- Setting "comments": optional comment field for participants; on public
scales the comments rotate on the results ("Kommentar X von N") with
previous/next/pause controls.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a138425ab0
commit
238797ecfd
15 files changed
+665
-23
No files matched your search
@@ -99,7 +99,8 @@ $url = fn(string $name, array $params = []) => ['_name' => $name, 'token' => $ad
|
||||
<?php elseif ($slide->isOrder() && !$slide->is_voting_open) : ?>
|
||||
<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->isPrivate()) : ?><span class="badge" title="<?= __('Antworten werden nicht öffentlich angezeigt') ?>">🔒 <?= __('anonym') ?></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 endif; ?>
|
||||
</div>
|
||||
<a class="slide-item__title" href="<?= $this->Url->build($url('slides:edit', ['id' => $slide->id])) ?>"><?= h($slide->question) ?></a>
|
||||
@@ -134,8 +135,8 @@ $url = fn(string $name, array $params = []) => ['_name' => $name, 'token' => $ad
|
||||
'title' => __('Diese Folie jetzt den Teilnehmenden zeigen'),
|
||||
]) ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($slide->type === 'open' && $count > 0) : ?>
|
||||
<a class="button button--small" href="<?= $this->Url->build($url('slides:answers', ['id' => $slide->id])) ?>"><?= __('Antworten') ?></a>
|
||||
<?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>
|
||||
<?php endif; ?>
|
||||
<a class="button button--small" href="<?= $this->Url->build($url('slides:edit', ['id' => $slide->id])) ?>"><?= __('Bearbeiten') ?></a>
|
||||
<?php if ($count > 0) : ?>
|
||||
|
||||
@@ -239,7 +239,7 @@ $countdown = function (?int $remaining): string {
|
||||
<?php endif; ?>
|
||||
|
||||
<?php elseif ($slide->type === 'scale') : ?>
|
||||
<div class="scale">
|
||||
<div class="scale"<?= $slide->isPrivate() ? ' aria-describedby="private-hint"' : '' ?>>
|
||||
<?php for ($v = (int)$slide->setting('scale_min'); $v <= (int)$slide->setting('scale_max'); $v++) : ?>
|
||||
<label class="scale__step">
|
||||
<input type="radio" name="value" value="<?= $v ?>" required>
|
||||
@@ -251,6 +251,16 @@ $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; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?= $this->Form->button(__('Absenden'), ['class' => 'button button--primary button--block']) ?>
|
||||
|
||||
@@ -1,34 +1,91 @@
|
||||
<?php
|
||||
/**
|
||||
* All answers of an open question – the only place where anonymous feedback
|
||||
* (private open questions) can be read, besides the CSV export.
|
||||
* All answers of an open question or the ratings of a scale – the only place where
|
||||
* anonymous/internal feedback (private slides) can be read, besides the CSV export.
|
||||
*
|
||||
* @var \App\View\AppView $this
|
||||
* @var \App\Model\Entity\Poll $poll
|
||||
* @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 list<array{id: int, text: string, value: int, created: string}> $comments Comments of a scale, oldest first
|
||||
*/
|
||||
use Cake\I18n\DateTime;
|
||||
|
||||
$this->assign('title', $slide->question);
|
||||
$this->assign('noindex', '1');
|
||||
$count = count($answers);
|
||||
$count = $scale !== null ? array_sum(array_column($scale['buckets'], 'count')) : count($answers);
|
||||
?>
|
||||
<p><a href="<?= $this->Url->build(['_name' => 'admin', 'token' => $adminToken]) ?>">← <?= __('Zurück zur Verwaltung') ?></a></p>
|
||||
|
||||
<section class="card">
|
||||
<p class="eyebrow">
|
||||
<?= h($slide->typeLabel()) ?>
|
||||
<?php if ($slide->isPrivate()) : ?>· 🔒 <?= __('Anonymes Feedback') ?><?php endif; ?>
|
||||
<?php if ($slide->isPrivate()) : ?>· 🔒 <?= $scale !== null ? __('Internes Feedback') : __('Anonymes Feedback') ?><?php endif; ?>
|
||||
</p>
|
||||
<h1><?= h($slide->question) ?></h1>
|
||||
<p class="muted"><?= __n('{0} Antwort, neueste zuerst', '{0} Antworten, neueste zuerst', $count, $count) ?></p>
|
||||
<?php if ($scale !== null) : ?>
|
||||
<p class="muted"><?= __n('{0} Bewertung', '{0} Bewertungen', $count, $count) ?></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"><?= __('Diese Antworten werden weder in der Präsentation noch den Teilnehmenden angezeigt.') ?></p>
|
||||
<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>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($answers === []) : ?>
|
||||
<?php if ($scale !== null) : ?>
|
||||
<?php if ($count === 0) : ?>
|
||||
<p class="empty"><?= __('Noch keine Bewertungen.') ?></p>
|
||||
<?php else : ?>
|
||||
<p class="scale-average">
|
||||
<?= __('Durchschnitt') ?>:
|
||||
<strong><?= h($this->Number->format((float)$scale['average'], ['places' => 1, 'precision' => 1, 'locale' => 'de_DE'])) ?></strong>
|
||||
<span class="muted">/ <?= (int)$scale['max'] ?></span>
|
||||
</p>
|
||||
<table class="scale-table">
|
||||
<caption class="sr-only"><?= __('Verteilung der Bewertungen') ?></caption>
|
||||
<thead>
|
||||
<tr><th scope="col"><?= __('Wert') ?></th><th scope="col"><?= __('Anzahl') ?></th><th scope="col"><?= __('Anteil') ?></th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($scale['buckets'] as $i => $bucket) :
|
||||
$label = match (true) {
|
||||
$i === 0 && $scale['minLabel'] !== '' => $scale['minLabel'],
|
||||
$i === count($scale['buckets']) - 1 && $scale['maxLabel'] !== '' => $scale['maxLabel'],
|
||||
default => '',
|
||||
}; ?>
|
||||
<tr>
|
||||
<th scope="row"><?= (int)$bucket['value'] ?><?php if ($label !== '') : ?> <span class="muted">(<?= h($label) ?>)</span><?php endif; ?></th>
|
||||
<td><?= (int)$bucket['count'] ?></td>
|
||||
<td>
|
||||
<span class="scale-table__bar" style="width: <?= (float)$bucket['percent'] ?>%" aria-hidden="true"></span>
|
||||
<?= h($this->Number->format((float)$bucket['percent'], ['places' => 0, 'precision' => 1, 'locale' => 'de_DE'])) ?> %
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</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 : ?>
|
||||
<ol class="answers-page" reversed>
|
||||
|
||||
@@ -166,6 +166,18 @@ $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'],
|
||||
]) ?>
|
||||
<p class="hint"><?= __('Die Kommentare laufen bei den Ergebnissen nacheinander durch – außer bei internem Feedback, dann siehst du sie nur in der Auswertung.') ?></p>
|
||||
<?= $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;
|
||||
|
||||
Reference in new issue
Block a user