Merge pull request 'List all slide types on the start page' (#14) from fix/home-slide-types into main
Reviewed-on: #14
This commit was merged in pull request #14.
This commit is contained in:
commit
187af50bcf
4 files changed
+41
-7
No files matched your search
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user