List all slide types on the start page
CI / Deploy / test (push) Successful in 1m2s
CI / Deploy / deploy (push) Skipped

The feature list was hard-coded and missed quiz, Q&A, content and
YouTube slides. It is now rendered from Slide::typeLabels().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
gnilebeinandClaude Opus 5.5 committed 2026-11-07 16:17:39 +01:00
1 parent f0c6687100
commit 69d557c15a
4 files changed
+41 -7

No files matched your search

+14
View File
@@ -5,6 +5,7 @@ namespace App\Controller;
use App\Captcha\CaptchaFactory;
use App\Mailer\PollMailer;
use App\Model\Entity\Slide;
use App\Model\Table\PollsTable;
use App\Service\ThrottleService;
use Cake\Core\Configure;
@@ -47,6 +48,18 @@ class HomeController extends AppController
$poll = $this->Polls->newEmptyEntity();
$captcha = CaptchaFactory::create('create')->challenge($this->request);
$this->set(compact('poll', 'captcha'));
$this->setSlideTypes();
}
/**
* Slide types for the start page, listed from the model so new types show up automatically.
*
* @return void
*/
protected function setSlideTypes(): void
{
$this->set('typeLabels', Slide::typeLabels());
$this->set('typeDescriptions', Slide::typeDescriptions());
}
/**
@@ -91,6 +104,7 @@ class HomeController extends AppController
// Re-render the start page with errors.
$this->set('poll', $poll);
$this->set('captcha', $captcha->challenge($this->request));
$this->setSlideTypes();
$this->render('index');
return null;