Add a star rating style to scale slides
Scales can now be shown as stars (1 to n) instead of numbered steps: participants tap stars, the stage shows the average as partly filled stars and the distribution as bars from most to fewest stars, and the evaluation page and PDF export print ratings as stars. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1ee870d67c
commit
c1f9be2eef
14 files changed
+400
-31
No files matched your search
@@ -43,12 +43,12 @@ $count = $scale !== null ? array_sum(array_column($scale['buckets'], 'count')) :
|
||||
<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>
|
||||
<span class="muted"><?= $slide->isStarRating() ? __('von {0} Sternen', (int)$scale['max']) : '/ ' . (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>
|
||||
<tr><th scope="col"><?= $slide->isStarRating() ? __('Sterne') : __('Wert') ?></th><th scope="col"><?= __('Anzahl') ?></th><th scope="col"><?= __('Anteil') ?></th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($scale['buckets'] as $i => $bucket) :
|
||||
@@ -58,7 +58,7 @@ $count = $scale !== null ? array_sum(array_column($scale['buckets'], 'count')) :
|
||||
default => '',
|
||||
}; ?>
|
||||
<tr>
|
||||
<th scope="row"><?= (int)$bucket['value'] ?><?php if ($label !== '') : ?> <span class="muted">(<?= h($label) ?>)</span><?php endif; ?></th>
|
||||
<th scope="row"><?= $this->element('rating', ['slide' => $slide, 'value' => (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>
|
||||
@@ -79,7 +79,7 @@ $count = $scale !== null ? array_sum(array_column($scale['buckets'], 'count')) :
|
||||
$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>
|
||||
<time datetime="<?= h($comment['created']) ?>"><?= __('Bewertung') ?> <?= $this->element('rating', ['slide' => $slide, 'value' => (int)$comment['value']]) ?> · <?= h($created->i18nFormat('dd.MM.yyyy, HH:mm')) ?></time>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ol>
|
||||
|
||||
Reference in new issue
Block a user