Add hiding slides from the presentation
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:
1 parent
e2f24877dd
commit
3c978e6f22
15 files changed
+333
-35
No files matched your search
@@ -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.
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user