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\Captcha\CaptchaFactory;
use App\Mailer\PollMailer; use App\Mailer\PollMailer;
use App\Model\Entity\Slide;
use App\Model\Table\PollsTable; use App\Model\Table\PollsTable;
use App\Service\ThrottleService; use App\Service\ThrottleService;
use Cake\Core\Configure; use Cake\Core\Configure;
@@ -47,6 +48,18 @@ class HomeController extends AppController
$poll = $this->Polls->newEmptyEntity(); $poll = $this->Polls->newEmptyEntity();
$captcha = CaptchaFactory::create('create')->challenge($this->request); $captcha = CaptchaFactory::create('create')->challenge($this->request);
$this->set(compact('poll', 'captcha')); $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. // Re-render the start page with errors.
$this->set('poll', $poll); $this->set('poll', $poll);
$this->set('captcha', $captcha->challenge($this->request)); $this->set('captcha', $captcha->challenge($this->request));
$this->setSlideTypes();
$this->render('index'); $this->render('index');
return null; return null;
+12 -5
View File
@@ -5,6 +5,8 @@
* @var \App\View\AppView $this * @var \App\View\AppView $this
* @var \App\Model\Entity\Poll $poll * @var \App\Model\Entity\Poll $poll
* @var array<string, mixed> $captcha * @var array<string, mixed> $captcha
* @var array<string, string> $typeLabels
* @var array<string, string> $typeDescriptions
*/ */
$this->assign('title', __('Live-Umfragen ohne Login')); $this->assign('title', __('Live-Umfragen ohne Login'));
?> ?>
@@ -53,9 +55,14 @@ $this->assign('title', __('Live-Umfragen ohne Login'));
</section> </section>
</div> </div>
<section class="features"> <section class="features-section" aria-labelledby="features-title">
<div><strong><?= __('Multiple Choice') ?></strong><span><?= __('Balkendiagramm in Echtzeit') ?></span></div> <h2 id="features-title"><?= __('Folientypen') ?></h2>
<div><strong><?= __('Wortwolke') ?></strong><span><?= __('Begriffe sammeln und gewichten') ?></span></div> <ul class="features">
<div><strong><?= __('Offene Fragen') ?></strong><span><?= __('Freitext-Antworten live') ?></span></div> <?php foreach ($typeLabels as $type => $label) : ?>
<div><strong><?= __('Skala') ?></strong><span><?= __('Bewertungen mit Durchschnitt') ?></span></div> <li class="features__item type-card--<?= h($type) ?>">
<strong><?= h($label) ?></strong>
<span><?= h($typeDescriptions[$type] ?? '') ?></span>
</li>
<?php endforeach; ?>
</ul>
</section> </section>
@@ -3,6 +3,7 @@ declare(strict_types=1);
namespace App\Test\TestCase\Controller; namespace App\Test\TestCase\Controller;
use App\Model\Entity\Slide;
use App\Test\TestCase\PlenarioTestTrait; use App\Test\TestCase\PlenarioTestTrait;
use Cake\Cache\Cache; use Cake\Cache\Cache;
use Cake\Core\Configure; use Cake\Core\Configure;
@@ -42,6 +43,15 @@ class HomeControllerTest extends TestCase
$this->assertResponseContains('Teilnahme-Code'); $this->assertResponseContains('Teilnahme-Code');
} }
public function testIndexListsAllSlideTypes(): void
{
$this->get('/');
foreach (Slide::typeLabels() as $type => $label) {
$this->assertResponseContains('type-card--' . $type, $type);
$this->assertResponseContains(h($label), $type);
}
}
public function testCreateWithValidMathCaptchaSendsAdminMail(): void public function testCreateWithValidMathCaptchaSendsAdminMail(): void
{ {
$this->session(['Captcha.math.create' => 7]); $this->session(['Captcha.math.create' => 7]);
+5 -2
View File
@@ -116,8 +116,11 @@ h3 { font-size: 1.05rem; margin-top: 1.6em; }
.hero { text-align: center; max-width: 760px; margin: 16px auto 40px; } .hero { text-align: center; max-width: 760px; margin: 16px auto 40px; }
.hero h1 { font-size: clamp(1.9rem, 4.5vw, 3rem); } .hero h1 { font-size: clamp(1.9rem, 4.5vw, 3rem); }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-top: 16px; } .features-section { margin-top: 16px; }
.features div { padding: 16px; border-radius: var(--radius); background: var(--surface-2); } .features-section h2 { text-align: center; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin: 0; padding: 0; list-style: none; }
/* border colour per type: .type-card--{type} below */
.features__item { padding: 16px; border-radius: var(--radius); background: var(--surface-2); border-top: 4px solid var(--c0); }
.features strong { display: block; } .features strong { display: block; }
.features span { color: var(--muted); font-size: .9rem; } .features span { color: var(--muted); font-size: .9rem; }