Add hiding slides from the presentation
CI / Deploy / test (push) Successful in 57s
CI / Deploy / deploy (push) Skipped

Hidden slides stay prepared in the dashboard but are skipped when
presenting (start, next/prev, goto), can not go live via embed and are
left out of the PDF export. Hiding the live or paused slide pauses the
poll like deleting it and resumes with the next visible slide.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
gnilebeinandClaude Opus 5.5 committed 2026-11-11 15:25:41 +01:00
1 parent e2f24877dd
commit 3c978e6f22
15 files changed
+331 -33

No files matched your search

+9 -1
View File
@@ -58,7 +58,7 @@ src/
HomeController Startseite, Anlegen (/create), Bestätigung, Join, Recover
AdminAppController Basis für /admin/{token}: löst Poll über Token-Hash auf (404 sonst), setzt Privacy-Header (no-referrer, no-store)
AdminController Dashboard, Settings, Present, State-JSON, Control, QR, PDF-Export, Token rotieren, Zurücksetzen, Löschen
SlidesController Folien-CRUD, Duplizieren (`duplicate` → `SlidesTable::duplicate()`, Kopie direkt dahinter, öffnet das Formular der Kopie), Antworten offener Fragen bzw. Skala-Auswertung (`answers`), Sortieren (Drag & Drop/Pfeiltasten via `reorder`, JSON; erfordert JS), Antworten zurücksetzen,
SlidesController Folien-CRUD, Ein-/Ausblenden (`visibility`), Duplizieren (`duplicate` → `SlidesTable::duplicate()`, Kopie direkt dahinter, öffnet das Formular der Kopie), Antworten offener Fragen bzw. Skala-Auswertung (`answers`), Sortieren (Drag & Drop/Pfeiltasten via `reorder`, JSON; erfordert JS), Antworten zurücksetzen,
YouTube-Link prüfen (`youtubeCheck`, JSON)
ParticipateController /p/{code}: Ansicht, State-JSON, Abstimmen, eigene Antwort/Kommentar bearbeiten; anonymes Cookie plenario_pid
EmbedController /e/{key}/{id}: eine Folie zum Einbetten (z. B. Canva), activate/heartbeat/pause/control
@@ -95,6 +95,7 @@ tests/ PHPUnit; PlenarioTestTrait erzeugt Testdaten, Fixtures
`embed_key` (Einbett-Schlüssel), `embed_seen_at` (letztes Lebenszeichen der eingebetteten Live-Folie),
`paused_slide_id` (Folie vor der Pause), `comment_speed` (Tempo der Skala-Kommentare in Prozent, Standard 100)
- `slides`: `type` (`choice|wordcloud|open|scale|content|quiz|youtube|qa|order`), `question`, `description`, `position`,
`is_hidden` (ausgeblendet: vorbereitet, aber nicht Teil der Präsentation),
`settings` (JSON, je Typ siehe `Slide::DEFAULT_SETTINGS`), `is_voting_open`,
`voting_started_at` / `voting_ends_at` (nur Quiz: Start und Deadline, `null` = manuell beenden),
`stage` / `focus_response_id` (nur Q&A: Phase und gerade besprochene Frage)
@@ -199,6 +200,13 @@ tests/ PHPUnit; PlenarioTestTrait erzeugt Testdaten, Fixtures
inkl. `is_correct`, **nie Antworten**. Die Kopie landet direkt hinter dem Original und startet wie eine neue Folie
(`Slide::startFresh()`: Quiz `ready`, Q&A `collect`, sonst offen) – auch `add()` nutzt `startFresh()`.
Tests: `DuplicateSlideTest.php`.
- **Ausgeblendete Folien** (`is_hidden`, `slides:visibility` mit `hidden=1|0`, explizit statt Toggle → idempotent):
bleiben in der Verwaltung (gestrichelt, Badge „ausgeblendet“), gehören aber nicht zur Präsentation. Präsentation =
`SlidesTable::listForPoll($pollId, true)`: Start, →/←, `goto` (400 für ausgeblendete), Zähler im Presenter-State
(`count` ohne, `hiddenCount` = ausgeblendete), PDF-Export (Nummerierung wie in der Präsentation). Einbettung einer
ausgeblendeten Folie geht nicht live (`isHidden` im Embed-State). Eine ausgeblendete Folie darf nie live/pausiert sein:
Ausblenden der Live- oder pausierten Folie pausiert wie Löschen (`forgetSlide()` + `SlidesTable::replacementFor()` =
nächste sichtbare Folie, sonst die vorige). `is_hidden` ist nicht mass-assignable. Tests: `HiddenSlideTest.php`.
- **Pause:** `current_slide_id = null` + `paused_slide_id` = Pause (Teilnehmende sehen „Kurze Pause“), ohne
`paused_slide_id` = noch nicht gestartet. Immer über `Poll::showSlide()` / `showEmbeddedSlide()` / `pause()` /
`forgetSlide()` setzen, nie `current_slide_id` direkt. Presenter: P bzw. der Pause-Button schaltet um (Aktionen `stop`/`resume`, beide idempotent, kein Server-Toggle),
@@ -0,0 +1,37 @@
<?php
declare(strict_types=1);
use Migrations\BaseMigration;
/**
* Hidden slides stay prepared in the dashboard but are skipped in the presentation,
* can not go live and are left out of the PDF export.
*/
class AddIsHiddenToSlides extends BaseMigration
{
/**
* @return void
*/
public function up(): void
{
$table = $this->table('slides');
if (!$table->hasColumn('is_hidden')) {
$table->addColumn('is_hidden', 'boolean', [
'null' => false,
'default' => false,
'after' => 'position',
])->update();
}
}
/**
* @return void
*/
public function down(): void
{
$table = $this->table('slides');
if ($table->hasColumn('is_hidden')) {
$table->removeColumn('is_hidden')->update();
}
}
}
+2
View File
@@ -85,6 +85,8 @@ return function (RouteBuilder $routes): void {
->setPatterns($token)->setPass(['id'])->setMethods(['POST']);
$admin->connect('/slides/{id}/duplicate', 'Slides::duplicate', ['_name' => 'slides:duplicate'])
->setPatterns($token)->setPass(['id'])->setMethods(['POST']);
$admin->connect('/slides/{id}/visibility', 'Slides::visibility', ['_name' => 'slides:visibility'])
->setPatterns($token)->setPass(['id'])->setMethods(['POST']);
$admin->connect('/slides/reorder','Slides::reorder', ['_name' => 'slides:reorder'])
->setPatterns($token)->setMethods(['POST']);
$admin->connect('/slides/youtube-check', 'Slides::youtubeCheck', ['_name' => 'slides:youtube-check'])
+3 -2
View File
@@ -161,7 +161,7 @@ class AdminController extends AdminAppController
{
if ($this->poll->current_slide_id === null && !$this->poll->isPaused()) {
$first = $this->Slides->find()
->where(['poll_id' => $this->poll->id])
->where(['poll_id' => $this->poll->id, 'is_hidden' => false])
->orderBy(['position' => 'ASC', 'id' => 'ASC'])
->first();
if ($first !== null) {
@@ -203,7 +203,8 @@ class AdminController extends AdminAppController
{
$this->request->allowMethod(['post']);
$action = (string)$this->request->getData('action');
$slides = $this->Slides->listForPoll($this->poll->id);
// Hidden slides are skipped and can not go live.
$slides = $this->Slides->listForPoll($this->poll->id, true);
$ids = array_map(fn(Slide $s) => $s->id, $slides);
$index = array_search($this->poll->current_slide_id, $ids, true);
$current = $index === false ? null : $slides[$index];
+2 -2
View File
@@ -114,14 +114,14 @@ class EmbedController extends AppController
}
/**
* The embed became visible: this slide goes live. Idempotent.
* The embed became visible: this slide goes live (unless it is hidden). Idempotent.
*
* @return \Cake\Http\Response
*/
public function activate(): Response
{
$this->request->allowMethod(['post']);
if ($this->poll->is_active) {
if ($this->poll->is_active && !$this->slide->is_hidden) {
$this->poll->showEmbeddedSlide($this->slide->id);
$this->Polls->saveOrFail($this->poll);
}
+29 -9
View File
@@ -104,15 +104,7 @@ class SlidesController extends AdminAppController
$this->request->allowMethod(['post']);
$slide = $this->loadSlide($id);
// Deleting the live (or paused) slide pauses the poll; → resumes with the slide taking its place.
$ids = $this->Slides->find()
->select(['id'])
->where(['poll_id' => $this->poll->id])
->orderBy(['position' => 'ASC', 'id' => 'ASC'])
->all()
->extract('id')
->toList();
$index = (int)array_search($slide->id, $ids, true);
$this->poll->forgetSlide($slide->id, $ids[$index + 1] ?? $ids[$index - 1] ?? null);
$this->poll->forgetSlide($slide->id, $this->Slides->replacementFor($slide));
$this->Slides->getConnection()->transactional(function () use ($slide): void {
$this->Polls->saveOrFail($this->poll);
@@ -124,6 +116,34 @@ class SlidesController extends AdminAppController
return $this->redirect($this->adminUrl());
}
/**
* Hides a slide from the presentation or shows it again. Field `hidden` (1|0) is explicit
* (not a toggle), so repeating the request changes nothing. Hiding the live (or paused)
* slide pauses the poll like deleting it.
*
* @param string $id Slide id
* @return \Cake\Http\Response|null
*/
public function visibility(string $id): ?Response
{
$this->request->allowMethod(['post']);
$slide = $this->loadSlide($id);
$hidden = filter_var($this->request->getData('hidden'), FILTER_VALIDATE_BOOLEAN);
$this->Slides->getConnection()->transactional(function () use ($slide, $hidden): void {
if ($hidden) {
$this->poll->forgetSlide($slide->id, $this->Slides->replacementFor($slide));
$this->Polls->saveOrFail($this->poll);
}
$this->Slides->updateAll(['is_hidden' => $hidden], ['id' => $slide->id]);
});
$this->Flash->success($hidden
? __('Folie „{0}“ ist ausgeblendet und wird beim Präsentieren übersprungen.', $slide->question)
: __('Folie „{0}“ ist wieder eingeblendet.', $slide->question));
return $this->redirect($this->adminUrl());
}
/**
* Copies a slide (without responses) directly behind the original and opens the copy for editing.
*
+4 -3
View File
@@ -110,10 +110,11 @@ class Poll extends Entity
}
/**
* A slide is being deleted. If it was live or is the one a pause resumes, the poll pauses
* and resumes with $resumeSlideId instead (null: no slides left = not started). Idempotent.
* A slide leaves the presentation (deleted or hidden). If it was live or is the one a pause
* resumes, the poll pauses and resumes with $resumeSlideId instead (null: no slides left =
* not started). Idempotent.
*
* @param int $slideId Deleted slide
* @param int $slideId Deleted or hidden slide
* @param int|null $resumeSlideId Slide that takes its place (must belong to this poll)
* @return void
*/
+1
View File
@@ -17,6 +17,7 @@ use Cake\ORM\Entity;
* @property string $question
* @property string|null $description
* @property int $position
* @property bool $is_hidden Prepared, but skipped in the presentation (never live)
* @property array<string, mixed>|null $settings
* @property bool $is_voting_open
* @property \Cake\I18n\DateTime|null $voting_started_at Quiz: start of the voting window
+39 -6
View File
@@ -423,18 +423,51 @@ class SlidesTable extends Table
* Ordered slides of a poll including options.
*
* @param int $pollId Poll id
* @param bool $visibleOnly Only slides that are part of the presentation (not hidden)
* @return list<\App\Model\Entity\Slide>
*/
public function listForPoll(int $pollId): array
public function listForPoll(int $pollId, bool $visibleOnly = false): array
{
/** @var list<\App\Model\Entity\Slide> $slides */
$slides = $this->find()
$query = $this->find()
->where(['Slides.poll_id' => $pollId])
->contain(['SlideOptions'])
->orderBy(['Slides.position' => 'ASC', 'Slides.id' => 'ASC'])
->all()
->toList();
->orderBy(['Slides.position' => 'ASC', 'Slides.id' => 'ASC']);
if ($visibleOnly) {
$query->where(['Slides.is_hidden' => false]);
}
/** @var list<\App\Model\Entity\Slide> $slides */
$slides = $query->all()->toList();
return $slides;
}
/**
* The visible slide that takes the place of a slide leaving the presentation
* (deleted or hidden): the next visible one behind it, otherwise the one before.
*
* @param \App\Model\Entity\Slide $slide Slide leaving the presentation
* @return int|null Slide id, null if no other visible slide is left
*/
public function replacementFor(Slide $slide): ?int
{
$rows = $this->find()
->select(['id', 'is_hidden'])
->where(['poll_id' => $slide->poll_id])
->orderBy(['position' => 'ASC', 'id' => 'ASC'])
->disableHydration()
->all()
->toList();
$index = array_search($slide->id, array_column($rows, 'id'), true);
if ($index === false) {
return null;
}
$candidates = array_merge(array_slice($rows, $index + 1), array_reverse(array_slice($rows, 0, $index)));
foreach ($candidates as $row) {
if (!$row['is_hidden']) {
return (int)$row['id'];
}
}
return null;
}
}
+4 -1
View File
@@ -83,7 +83,8 @@ class PollStateService
public function forPresenter(Poll $poll): array
{
$this->Polls->pauseIfEmbedStale($poll);
$slides = $this->Slides->listForPoll($poll->id);
// The presentation consists of the visible slides only.
$slides = $this->Slides->listForPoll($poll->id, true);
$current = null;
$index = null;
foreach ($slides as $i => $slide) {
@@ -102,6 +103,7 @@ class PollStateService
], $slides),
'index' => $index,
'count' => count($slides),
'hiddenCount' => $this->Slides->find()->where(['poll_id' => $poll->id, 'is_hidden' => true])->count(),
'slide' => $current ? $this->slidePayload($current) : null,
'results' => $current ? $this->results->forSlide($current) : null,
];
@@ -123,6 +125,7 @@ class PollStateService
return [
'poll' => $this->pollPayload($poll),
'isLive' => $poll->current_slide_id === $slide->id,
'isHidden' => $slide->is_hidden,
'index' => null,
'count' => null,
'slide' => $this->slidePayload($slide),
+2 -2
View File
@@ -16,7 +16,7 @@ use Cake\ORM\Locator\LocatorAwareTrait;
* screen. With $includeInternal it also contains their answers, distribution and comments –
* that version is meant for the poll owner only.
*
* Per slide: ['slide' => Slide, 'number' => int (position in the poll, 1-based),
* Per slide: ['slide' => Slide, 'number' => int (position in the presentation, 1-based; hidden slides are left out),
* 'internal' => bool (private slide), 'withheld' => bool (private and left out),
* 'results' => ResultsService::forSlide() shape, where
* open: 'answers' contains all texts (not only the newest ones), and
@@ -49,7 +49,7 @@ class ReportService
*/
public function build(Poll $poll, bool $includeInternal): array
{
$slides = $this->Slides->listForPoll($poll->id);
$slides = $this->Slides->listForPoll($poll->id, true);
$includeInternal = $includeInternal
&& array_filter($slides, fn(Slide $slide) => $slide->isInteractive() && $slide->isPrivate()) !== [];
$sections = [];
+20 -3
View File
@@ -15,7 +15,7 @@
$this->assign('title', $poll->title);
$this->assign('noindex', '1');
$url = fn(string $name, array $params = []) => ['_name' => $name, 'token' => $adminToken] + $params;
$hasInternal = array_filter($slides, fn($slide) => $slide->isInteractive() && $slide->isPrivate()) !== [];
$hasInternal = array_filter($slides, fn($slide) => !$slide->is_hidden && $slide->isInteractive() && $slide->isPrivate()) !== [];
?>
<div class="admin-head">
<div>
@@ -72,7 +72,7 @@ $hasInternal = array_filter($slides, fn($slide) => $slide->isInteractive() && $s
$isCurrent = $poll->current_slide_id === $slide->id;
$count = $responseCounts[$slide->id] ?? 0;
?>
<li class="slide-item<?= $isCurrent ? ' slide-item--current' : '' ?>" data-slide-id="<?= $slide->id ?>">
<li class="slide-item<?= $isCurrent ? ' slide-item--current' : '' ?><?= $slide->is_hidden ? ' slide-item--hidden' : '' ?>" data-slide-id="<?= $slide->id ?>">
<div class="slide-item__lead">
<button type="button" class="drag-handle" data-drag-handle hidden
aria-label="<?= h(__('Folie „{0}“ verschieben (Pfeiltasten)', $slide->question)) ?>"
@@ -83,6 +83,7 @@ $hasInternal = array_filter($slides, fn($slide) => $slide->isInteractive() && $s
<div class="slide-item__meta">
<span class="badge badge--type-<?= h($slide->type) ?>"><?= h($slide->typeLabel()) ?></span>
<?php if ($isCurrent) : ?><span class="badge badge--live"><?= __('live') ?></span><?php endif; ?>
<?php if ($slide->is_hidden) : ?><span class="badge badge--off" title="<?= __('Wird beim Präsentieren übersprungen und fehlt im PDF-Export') ?>"><?= __('ausgeblendet') ?></span><?php endif; ?>
<?php if ($slide->isInteractive()) : ?>
<span class="muted"><?= __n('{0} Antwort', '{0} Antworten', $count, $count) ?></span>
<?php if ($slide->isQuiz()) : ?>
@@ -133,7 +134,7 @@ $hasInternal = array_filter($slides, fn($slide) => $slide->isInteractive() && $s
</details>
</div>
<div class="slide-item__actions">
<?php if (!$isCurrent) : ?>
<?php if (!$isCurrent && !$slide->is_hidden) : ?>
<?= $this->Form->postLink(__('Live'), $url('admin:control'), [
'data' => ['action' => 'goto', 'slide_id' => $slide->id],
'class' => 'button button--small',
@@ -149,6 +150,22 @@ $hasInternal = array_filter($slides, fn($slide) => $slide->isInteractive() && $s
'title' => __('Kopie dieser Folie direkt dahinter anlegen (ohne Antworten)'),
'aria-label' => __('Folie „{0}“ duplizieren', $slide->question),
]) ?>
<?php if ($slide->is_hidden) : ?>
<?= $this->Form->postLink(__('Einblenden'), $url('slides:visibility', ['id' => $slide->id]), [
'data' => ['hidden' => 0],
'class' => 'button button--small',
'title' => __('Folie wieder in die Präsentation aufnehmen'),
'aria-label' => __('Folie „{0}“ einblenden', $slide->question),
]) ?>
<?php else : ?>
<?= $this->Form->postLink(__('Ausblenden'), $url('slides:visibility', ['id' => $slide->id]), [
'data' => ['hidden' => 1],
'class' => 'button button--small',
'title' => __('Folie behalten, aber beim Präsentieren überspringen'),
'aria-label' => __('Folie „{0}“ ausblenden', $slide->question),
'confirm' => $isCurrent ? __('Diese Folie ist gerade live. Ausblenden und die Umfrage pausieren?') : null,
]) ?>
<?php endif; ?>
<?php if ($count > 0) : ?>
<?= $this->Form->postLink(__('Zurücksetzen'), $url('slides:reset', ['id' => $slide->id]), [
'class' => 'button button--small',
@@ -0,0 +1,172 @@
<?php
declare(strict_types=1);
namespace App\Test\TestCase\Controller;
use App\Model\Entity\Slide;
use App\Test\TestCase\PlenarioTestTrait;
use Cake\TestSuite\IntegrationTestTrait;
use Cake\TestSuite\TestCase;
/**
* Hiding slides (slides:visibility): prepared, but skipped in the presentation.
*/
class HiddenSlideTest extends TestCase
{
use IntegrationTestTrait;
use PlenarioTestTrait;
/**
* @var list<string>
*/
protected array $fixtures = ['app.Polls', 'app.Slides', 'app.SlideOptions', 'app.Responses'];
protected function setUp(): void
{
parent::setUp();
$this->enableCsrfToken();
}
public function testHideAndShowAgainIsIdempotent(): void
{
[$poll, $token] = $this->createPoll();
$slide = $this->createSlide($poll);
$this->assertFalse($slide->is_hidden, 'new slides are visible');
foreach ([1, 1] as $hidden) {
$this->post("/admin/$token/slides/{$slide->id}/visibility", ['hidden' => $hidden]);
$this->assertRedirect(['_name' => 'admin', 'token' => $token]);
$this->assertTrue($this->slidesTable()->get($slide->id)->is_hidden);
}
$this->get("/admin/$token");
$this->assertResponseContains('ausgeblendet');
$this->assertResponseContains('Einblenden');
foreach ([0, 0] as $hidden) {
$this->post("/admin/$token/slides/{$slide->id}/visibility", ['hidden' => $hidden]);
$this->assertFalse($this->slidesTable()->get($slide->id)->is_hidden);
}
}
public function testPresentationSkipsHiddenSlides(): void
{
[$poll, $token] = $this->createPoll();
$first = $this->hidden($this->createSlide($poll, Slide::TYPE_CHOICE));
$second = $this->createSlide($poll, Slide::TYPE_OPEN);
$third = $this->hidden($this->createSlide($poll, Slide::TYPE_WORDCLOUD));
$fourth = $this->createSlide($poll, Slide::TYPE_SCALE);
// Starting the presentation begins with the first visible slide.
$this->get("/admin/$token/present");
$this->assertSame($second->id, $this->pollsTable()->get($poll->id)->current_slide_id);
$this->configRequest(['headers' => ['Accept' => 'application/json']]);
$this->post("/admin/$token/control", ['action' => 'next']);
$state = json_decode((string)$this->_response->getBody(), true);
$this->assertSame($fourth->id, $state['slide']['id']);
$this->assertSame(1, $state['index']);
$this->assertSame(2, $state['count']);
$this->assertSame(2, $state['hiddenCount']);
$this->assertSame([$second->id, $fourth->id], array_column($state['slides'], 'id'));
$this->post("/admin/$token/control", ['action' => 'prev']);
$this->assertSame($second->id, $this->pollsTable()->get($poll->id)->current_slide_id);
// A hidden slide can not go live.
$this->post("/admin/$token/control", ['action' => 'goto', 'slide_id' => $third->id]);
$this->assertResponseCode(400);
$this->assertSame($second->id, $this->pollsTable()->get($poll->id)->current_slide_id);
$this->assertNotSame($first->id, $this->pollsTable()->get($poll->id)->current_slide_id);
}
public function testHidingTheLiveSlidePausesWithTheNextVisibleSlide(): void
{
[$poll, $token] = $this->createPoll();
$live = $this->createSlide($poll, Slide::TYPE_CHOICE);
$this->hidden($this->createSlide($poll, Slide::TYPE_OPEN));
$next = $this->createSlide($poll, Slide::TYPE_SCALE);
$this->goLive($poll, $live);
$this->post("/admin/$token/slides/{$live->id}/visibility", ['hidden' => 1]);
$poll = $this->pollsTable()->get($poll->id);
$this->assertNull($poll->current_slide_id);
$this->assertSame($next->id, $poll->paused_slide_id, 'resumes with the next visible slide');
// Participants see the pause page.
$this->get('/p/' . $poll->join_code . '/state');
$state = json_decode((string)$this->_response->getBody(), true);
$this->assertNull($state['slide']);
}
public function testHidingTheLastVisibleSlideFallsBackToThePreviousOne(): void
{
[$poll, $token] = $this->createPoll();
$previous = $this->createSlide($poll, Slide::TYPE_CHOICE);
$paused = $this->createSlide($poll, Slide::TYPE_OPEN);
$poll = $this->goLive($poll, $paused);
$poll->pause();
$this->pollsTable()->saveOrFail($poll);
$this->post("/admin/$token/slides/{$paused->id}/visibility", ['hidden' => 1]);
$this->assertSame($previous->id, $this->pollsTable()->get($poll->id)->paused_slide_id);
}
public function testDeletingSkipsHiddenSlidesForResuming(): void
{
[$poll, $token] = $this->createPoll();
$live = $this->createSlide($poll, Slide::TYPE_CHOICE);
$this->hidden($this->createSlide($poll, Slide::TYPE_OPEN));
$this->goLive($poll, $live);
$this->post("/admin/$token/slides/{$live->id}/delete");
$poll = $this->pollsTable()->get($poll->id);
$this->assertNull($poll->current_slide_id);
$this->assertNull($poll->paused_slide_id, 'no visible slide left');
}
public function testEmbeddedHiddenSlideDoesNotGoLive(): void
{
[$poll] = $this->createPoll();
$slide = $this->hidden($this->createSlide($poll, Slide::TYPE_CHOICE));
$key = $this->pollsTable()->ensureEmbedKey($poll);
$this->post("/e/$key/{$slide->id}/activate");
$this->assertResponseOk();
$state = json_decode((string)$this->_response->getBody(), true);
$this->assertFalse($state['isLive']);
$this->assertTrue($state['isHidden']);
$this->assertNull($this->pollsTable()->get($poll->id)->current_slide_id);
}
public function testPdfExportLeavesHiddenSlidesOut(): void
{
[$poll, $token] = $this->createPoll();
$this->hidden($this->createSlide($poll, Slide::TYPE_CHOICE, ['question' => 'Versteckte Frage']));
$this->createSlide($poll, Slide::TYPE_OPEN, ['question' => 'Sichtbare Frage']);
$html = $this->exportHtml($token);
$this->assertStringNotContainsString('Versteckte Frage', $html);
$this->assertStringContainsString('Sichtbare Frage', $html);
$this->assertStringContainsString('Folie 1', $html);
}
protected function hidden(Slide $slide): Slide
{
$slide->is_hidden = true;
$this->slidesTable()->saveOrFail($slide);
return $slide;
}
public function testOnlySlidesOfOwnPoll(): void
{
[, $token] = $this->createPoll();
[$other] = $this->createPoll('Andere');
$foreign = $this->createSlide($other);
$this->post("/admin/$token/slides/{$foreign->id}/visibility", ['hidden' => 1]);
$this->assertResponseCode(404);
$this->assertFalse($this->slidesTable()->get($foreign->id)->is_hidden);
}
}
+2
View File
@@ -231,6 +231,8 @@ textarea { resize: vertical; }
padding: 14px 16px; margin-bottom: 10px;
}
.slide-item--current { border-color: var(--c1); box-shadow: 0 0 0 2px rgba(224, 69, 123, .15); }
.slide-item--hidden { border-style: dashed; background: var(--surface-2); }
.slide-item--hidden .slide-item__body { opacity: .75; }
.slide-item__pos {width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-weight: 700; }
.slide-item__lead { display: flex; align-items: center; gap: 4px; }
.slide-list__hint { font-size: .85rem; margin: 0 0 8px; }
+5 -4
View File
@@ -1314,11 +1314,12 @@
if (!slide) {
q('[data-status]').textContent = state.poll.isPaused ? 'Pause' : '';
var allHidden = state.count === 0 && state.hiddenCount > 0;
q('[data-question]').textContent = state.count === 0
? 'Noch keine Folien angelegt'
? (allHidden ? 'Alle Folien sind ausgeblendet' : 'Noch keine Folien angelegt')
: state.poll.title;
q('[data-description]').textContent = state.count === 0
? 'Lege in der Verwaltung Fragen an.'
? (allHidden ? 'Blende in der Verwaltung mindestens eine Folie ein.' : 'Lege in der Verwaltung Fragen an.')
: (state.poll.isPaused
? 'Teilnehmende sehen gerade eine Pause-Seite. Drücke P oder → zum Fortsetzen.'
: 'Drücke → um zu starten.');
@@ -1437,9 +1438,9 @@
var indicator = q('[data-live]');
indicator.textContent = !state.poll.isActive
? 'Umfrage geschlossen'
: (isLive ? '● live' : 'nicht live');
: (state.isHidden ? 'ausgeblendet' : (isLive ? '● live' : 'nicht live'));
indicator.classList.toggle('is-live', isLive);
q('[data-go-live]').hidden = isLive || !state.poll.isActive;
q('[data-go-live]').hidden = isLive || !state.poll.isActive || !!state.isHidden;
}
function goLive() {
live = true;