Integriere die Premium-Karten v1.7 als Themen-, Medien- und Programmkarte.
- Drei Widget-Arten (topic_card, media_card, program_card) auf gemeinsamer Basis, eine Karte je Platz im bestehenden Abschnittsraster; kein zweites Kartenraster. - Titel, Kurzbeschreibung, Art, Zusatzangaben und Linkziel kommen zur Laufzeit aus Thema, Inhaltselement bzw. Programm/Modul; im CMS stehen nur Kennungen, Bild, Bildausschnitt, Beschriftung und Hinweis. - Medienkarten sind öffentlich nur als Bestandteil eines öffentlichen Programms (PublicMaterialReader), Module nur in der Redaktionsvorschau; keine Bibliotheksbilder, kein Preis, keine Kaufaktion. - Gleiche Höhe je Zeile über die gemeinsame Höhe „fill“; Raster 1 + 1 + 2 und 2 + 1 + 1 ergänzt. - Tests zu Raster- und Widgetliste bewusst um die neuen Raster und Arten erweitert. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
cca069be48
commit
127ea86817
16 files changed
+1579
-3
No files matched your search
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domain\Cms\Catalog;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Anzeigedaten des Fachobjekts hinter einer Premium-Karte (Thema, Medium/Material, Programm/Modul).
|
||||||
|
* Wird zur Laufzeit aus den maßgeblichen Fachdaten gelesen und nie im CMS gespeichert.
|
||||||
|
*
|
||||||
|
* - url: nur ein öffentlich freigegebenes Ziel aus dem Fachobjekt (Themenseite, Programmseite), sonst null.
|
||||||
|
* - public: false heißt „nur in der Redaktionsvorschau“; öffentlich entfällt die Karte dann.
|
||||||
|
* - notice: redaktioneller Hinweis für die Vorschau, warum die Karte öffentlich nicht erscheint.
|
||||||
|
*/
|
||||||
|
final readonly class CardSubject
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param list<string> $meta reine Anzeigetexte aus Fachdaten
|
||||||
|
*/
|
||||||
|
public function __construct(
|
||||||
|
public string $title,
|
||||||
|
public ?string $summary,
|
||||||
|
public string $kind,
|
||||||
|
public ?string $badge,
|
||||||
|
public array $meta,
|
||||||
|
public ?string $url,
|
||||||
|
public bool $public,
|
||||||
|
public ?string $notice = null,
|
||||||
|
) {}
|
||||||
|
}
|
||||||
@@ -171,6 +171,44 @@ public function entries(array $refs, bool $includeNonPublic): array
|
|||||||
return $entries;
|
return $entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Anzeigedaten für eine Programm- oder Modulkarte (Premium-Karte). Dieselbe Regel wie entries():
|
||||||
|
* Programme mit Anzeigefreigabe öffentlich mit Programmseite, Module nur in der Redaktionsvorschau.
|
||||||
|
* Die Art („Programm“ oder „Modul“) ist immer benannt. Kein Preis, kein Angebot, keine Kaufaktion.
|
||||||
|
*/
|
||||||
|
public function subject(mixed $id, bool $includeNonPublic): ?CardSubject
|
||||||
|
{
|
||||||
|
$entry = $this->entries([['type' => 'composition', 'id' => $id]], $includeNonPublic)[0] ?? null;
|
||||||
|
|
||||||
|
if ($entry === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$meta = [];
|
||||||
|
$composition = Composition::query()->find($entry->id);
|
||||||
|
$version = $composition !== null ? $this->shownVersion($composition) : null;
|
||||||
|
|
||||||
|
if ($version !== null) {
|
||||||
|
$nested = $version->members()->whereNotNull('nested_composition_version_id')->with('nestedCompositionVersion.composition.editorialContentKind')->get();
|
||||||
|
$modules = $nested->filter(fn ($member): bool => $member->nestedCompositionVersion?->composition?->editorialContentKind?->slug === 'modul')->count();
|
||||||
|
|
||||||
|
if ($modules > 0) {
|
||||||
|
$meta[] = $modules === 1 ? '1 Modul' : $modules.' Module';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new CardSubject(
|
||||||
|
title: $entry->title,
|
||||||
|
summary: $entry->summary,
|
||||||
|
kind: $entry->kindLabel,
|
||||||
|
badge: null,
|
||||||
|
meta: $meta,
|
||||||
|
url: $entry->url,
|
||||||
|
public: $entry->public,
|
||||||
|
notice: $entry->public ? null : 'Nur in der Redaktionsvorschau sichtbar: Für Module gibt es noch keine öffentliche Seitenart (öffentliches Profil, ADR-29).',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
private function title(Composition $composition): string
|
private function title(Composition $composition): string
|
||||||
{
|
{
|
||||||
return (string) ($composition->display_title ?: $composition->designation);
|
return (string) ($composition->display_title ?: $composition->designation);
|
||||||
|
|||||||
@@ -0,0 +1,196 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domain\Cms\Catalog;
|
||||||
|
|
||||||
|
use App\Domain\Catalog\CompositionStructureReader;
|
||||||
|
use App\Domain\Catalog\ContentElement;
|
||||||
|
use App\Domain\Catalog\ContentVersionStatus;
|
||||||
|
use App\Domain\Catalog\StructureNode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lesesicht „Medien und Materialien“ für Premium-Karten (Website-CMS-Zielarchitektur 6.2).
|
||||||
|
*
|
||||||
|
* Übergangsregel, solange öffentliche Fachobjektprofile (ADR-29) fehlen:
|
||||||
|
* Ein Medium oder Material hat keine eigene öffentliche Seite. Öffentlich genannt wird es heute nur als Bestandteil
|
||||||
|
* der gezeigten Fassung eines öffentlichen Programms (Programmseite /programme/{id}). Genau dann erscheint auch die
|
||||||
|
* Karte öffentlich, mit Verweis auf diese Programmseite. Sonst ist die Karte nur in der Redaktionsvorschau sichtbar.
|
||||||
|
*
|
||||||
|
* Gelesen werden nur Anzeigetitel, Kurzbeschreibung, Inhaltsart und Ausgabeart, nie Dateien, Lehrtexte,
|
||||||
|
* Vorschaubilder der Bibliothek oder Ausgabeadressen. Eine Karte gibt kein Medium frei.
|
||||||
|
*/
|
||||||
|
class PublicMaterialReader
|
||||||
|
{
|
||||||
|
/** @var array<int, array{id: int, title: string}>|null Element-ID => erstes öffentliches Programm */
|
||||||
|
private ?array $publicIndex = null;
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
private readonly PublicCatalogReader $catalog,
|
||||||
|
private readonly CompositionStructureReader $structure,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wählbar ist ein nicht archiviertes Element mit mindestens einer bereitgestellten (nicht gesperrten) Fassung.
|
||||||
|
*/
|
||||||
|
public function isSelectable(ContentElement $element): bool
|
||||||
|
{
|
||||||
|
return $element->archived_at === null
|
||||||
|
&& $element->versions()->where('status', ContentVersionStatus::Bereit->value)->exists();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Öffentliches Programm, in dessen gezeigter Fassung das Element vorkommt, sonst null.
|
||||||
|
*
|
||||||
|
* @return array{id: int, title: string}|null
|
||||||
|
*/
|
||||||
|
public function publicProgramFor(ContentElement $element): ?array
|
||||||
|
{
|
||||||
|
return $this->publicIndex()[$element->id] ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<int, string>
|
||||||
|
*/
|
||||||
|
public function search(?string $term, int $limit = 25): array
|
||||||
|
{
|
||||||
|
$term = trim((string) $term);
|
||||||
|
|
||||||
|
$candidates = ContentElement::query()
|
||||||
|
->with('editorialContentKind')
|
||||||
|
->whereNull('archived_at')
|
||||||
|
->whereHas('versions', fn ($query) => $query->where('status', ContentVersionStatus::Bereit->value))
|
||||||
|
->when($term !== '', function ($query) use ($term): void {
|
||||||
|
$like = '%'.mb_strtolower($term).'%';
|
||||||
|
$query->where(fn ($inner) => $inner
|
||||||
|
->whereRaw('LOWER(working_title) LIKE ?', [$like])
|
||||||
|
->orWhereRaw('LOWER(COALESCE(display_title, \'\')) LIKE ?', [$like]));
|
||||||
|
})
|
||||||
|
->orderBy('working_title')
|
||||||
|
->limit($limit)
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$options = [];
|
||||||
|
foreach ($candidates as $element) {
|
||||||
|
$options[$element->id] = $this->optionLabel($element);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $options;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function labelFor(mixed $id): ?string
|
||||||
|
{
|
||||||
|
$element = is_numeric($id) ? ContentElement::query()->with('editorialContentKind')->find((int) $id) : null;
|
||||||
|
|
||||||
|
return $element === null ? null : $this->optionLabel($element);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Anzeigedaten für eine Karte. Öffentlich null, wenn das Element nicht öffentlich genannt wird.
|
||||||
|
*/
|
||||||
|
public function subject(mixed $id, bool $includeNonPublic): ?CardSubject
|
||||||
|
{
|
||||||
|
$element = is_numeric($id) ? ContentElement::query()->with('editorialContentKind')->find((int) $id) : null;
|
||||||
|
|
||||||
|
if ($element === null || ! $this->isSelectable($element)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$program = $this->publicProgramFor($element);
|
||||||
|
|
||||||
|
if ($program === null && ! $includeNonPublic) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$output = self::outputLabel((string) $element->output_class);
|
||||||
|
$editorialKind = $element->editorialContentKind?->label;
|
||||||
|
|
||||||
|
return new CardSubject(
|
||||||
|
title: $this->title($element),
|
||||||
|
summary: filled($element->summary) ? (string) $element->summary : null,
|
||||||
|
kind: filled($editorialKind) ? (string) $editorialKind : $output,
|
||||||
|
badge: $output,
|
||||||
|
meta: array_values(array_filter([
|
||||||
|
$output,
|
||||||
|
$program !== null ? 'Im Programm „'.$program['title'].'“' : null,
|
||||||
|
])),
|
||||||
|
url: $program !== null ? route('public.program', $program['id']) : null,
|
||||||
|
public: $program !== null,
|
||||||
|
notice: $program === null
|
||||||
|
? 'Nur in der Redaktionsvorschau sichtbar: Dieses Medium gehört zu keinem öffentlich gezeigten Programm. Medien haben noch keine eigene öffentliche Freigabe (öffentliches Profil, ADR-29).'
|
||||||
|
: null,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Bezeichnung der Ausgabeart, wie in der Redaktionsstruktur (CompositionRelease::outputLabel). */
|
||||||
|
public static function outputLabel(string $outputClass): string
|
||||||
|
{
|
||||||
|
return match ($outputClass) {
|
||||||
|
'film' => 'Film',
|
||||||
|
'audio' => 'Hörstück',
|
||||||
|
'bild' => 'Bild',
|
||||||
|
'document', 'pdf' => 'Dokument',
|
||||||
|
default => 'Text',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private function title(ContentElement $element): string
|
||||||
|
{
|
||||||
|
return (string) ($element->display_title ?: $element->working_title);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function optionLabel(ContentElement $element): string
|
||||||
|
{
|
||||||
|
$visibility = $this->publicProgramFor($element) !== null ? 'öffentlich über Programmseite' : 'nur Redaktionsvorschau';
|
||||||
|
$kind = $element->editorialContentKind?->label ?: self::outputLabel((string) $element->output_class);
|
||||||
|
|
||||||
|
return $this->title($element).' · '.$kind.' · '.$visibility;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Index aller Elemente, die in der gezeigten Fassung eines öffentlichen Programms vorkommen (auch verschachtelt).
|
||||||
|
*
|
||||||
|
* @return array<int, array{id: int, title: string}>
|
||||||
|
*/
|
||||||
|
private function publicIndex(): array
|
||||||
|
{
|
||||||
|
if ($this->publicIndex !== null) {
|
||||||
|
return $this->publicIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
$index = [];
|
||||||
|
|
||||||
|
foreach ($this->catalog->publicPrograms() as $program) {
|
||||||
|
$version = $this->catalog->shownVersion($program);
|
||||||
|
|
||||||
|
if ($version === null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$entry = ['id' => (int) $program->id, 'title' => (string) ($program->display_title ?: $program->designation)];
|
||||||
|
|
||||||
|
foreach ($this->elementIds($this->structure->tree($version)) as $elementId) {
|
||||||
|
$index[$elementId] ??= $entry;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->publicIndex = $index;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param list<StructureNode> $nodes
|
||||||
|
* @return list<int>
|
||||||
|
*/
|
||||||
|
private function elementIds(array $nodes): array
|
||||||
|
{
|
||||||
|
$ids = [];
|
||||||
|
|
||||||
|
foreach ($nodes as $node) {
|
||||||
|
if ($node->contentElementId !== null) {
|
||||||
|
$ids[] = (int) $node->contentElementId;
|
||||||
|
}
|
||||||
|
|
||||||
|
array_push($ids, ...$this->elementIds($node->children));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ids;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,6 +22,8 @@ final class SectionLayouts
|
|||||||
'u3_1' => [3, 1],
|
'u3_1' => [3, 1],
|
||||||
'u1_2_1' => [1, 2, 1],
|
'u1_2_1' => [1, 2, 1],
|
||||||
'u1_1_1_1' => [1, 1, 1, 1],
|
'u1_1_1_1' => [1, 1, 1, 1],
|
||||||
|
'u1_1_2' => [1, 1, 2],
|
||||||
|
'u2_1_1' => [2, 1, 1],
|
||||||
];
|
];
|
||||||
|
|
||||||
/** @var array<string, string> */
|
/** @var array<string, string> */
|
||||||
@@ -32,6 +34,8 @@ final class SectionLayouts
|
|||||||
'u3_1' => 'Breit und schmal',
|
'u3_1' => 'Breit und schmal',
|
||||||
'u1_2_1' => 'Mitte betont',
|
'u1_2_1' => 'Mitte betont',
|
||||||
'u1_1_1_1' => 'Vier gleich breit',
|
'u1_1_1_1' => 'Vier gleich breit',
|
||||||
|
'u1_1_2' => 'Zwei schmal, eins breit',
|
||||||
|
'u2_1_1' => 'Eins breit, zwei schmal',
|
||||||
];
|
];
|
||||||
|
|
||||||
public static function has(mixed $key): bool
|
public static function has(mixed $key): bool
|
||||||
|
|||||||
@@ -0,0 +1,91 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domain\Cms\Widgets\Types;
|
||||||
|
|
||||||
|
use App\Domain\Catalog\ContentElement;
|
||||||
|
use App\Domain\Cms\Catalog\CardSubject;
|
||||||
|
use App\Domain\Cms\Catalog\PublicMaterialReader;
|
||||||
|
use App\Domain\Cms\Widgets\RenderContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Medien- und Materialkarte (Kit v1.7 „media“): ein Inhaltselement (Film, Dokument, Hörstück …) mit Anzeigetitel,
|
||||||
|
* Kurzbeschreibung, Inhaltsart und Ausgabeart. Öffentlich nur, wenn das Element zur gezeigten Fassung eines
|
||||||
|
* öffentlichen Programms gehört (PublicMaterialReader); die Aktion führt dann auf diese Programmseite.
|
||||||
|
* Die Karte spielt nichts ab, bietet keinen Download und gibt kein geschütztes Medium frei.
|
||||||
|
*/
|
||||||
|
class MediaCardWidget extends PremiumCardWidget
|
||||||
|
{
|
||||||
|
public function key(): string
|
||||||
|
{
|
||||||
|
return 'media_card';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function label(): string
|
||||||
|
{
|
||||||
|
return 'Medien- und Materialkarte';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function description(): string
|
||||||
|
{
|
||||||
|
return 'Karte zu einem Film oder Material aus der Bibliothek; Titel und Art kommen aus den Fachdaten, kein Abspielen, kein Download.';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function icon(): string
|
||||||
|
{
|
||||||
|
return 'heroicon-o-film';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function schematic(): array
|
||||||
|
{
|
||||||
|
return [[2, 2, 56, 32, 'line'], [5, 5, 22, 26, 'image'], [7, 7, 8, 3, 'accent'], [31, 8, 22, 4, 'ink'], [31, 15, 22, 5, 'line'], [31, 25, 14, 5, 'accent']];
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function refKey(): string
|
||||||
|
{
|
||||||
|
return 'element';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function refLabel(): string
|
||||||
|
{
|
||||||
|
return 'Medium oder Material';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function refHelp(): string
|
||||||
|
{
|
||||||
|
return 'Wählbar sind bereitgestellte, nicht archivierte Inhalte. Öffentlich erscheint die Karte nur, wenn der Inhalt zu einem öffentlich gezeigten Programm gehört; sonst nur in der Redaktionsvorschau.';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function searchSubjects(?string $term): array
|
||||||
|
{
|
||||||
|
return app(PublicMaterialReader::class)->search($term);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function subjectLabel(mixed $id): ?string
|
||||||
|
{
|
||||||
|
return app(PublicMaterialReader::class)->labelFor($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function rejectSubject(int $id): ?string
|
||||||
|
{
|
||||||
|
$element = ContentElement::query()->find($id);
|
||||||
|
|
||||||
|
return $element !== null && app(PublicMaterialReader::class)->isSelectable($element)
|
||||||
|
? null
|
||||||
|
: 'Dieser Inhalt ist nicht bereitgestellt oder archiviert.';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function subject(mixed $id, RenderContext $context): ?CardSubject
|
||||||
|
{
|
||||||
|
return app(PublicMaterialReader::class)->subject($id, includeNonPublic: $context->preview);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function defaultActionLabel(): string
|
||||||
|
{
|
||||||
|
return 'Im Programm ansehen';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function cardStyle(): string
|
||||||
|
{
|
||||||
|
return 'media';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,276 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domain\Cms\Widgets\Types;
|
||||||
|
|
||||||
|
use App\Domain\Cms\Catalog\CardSubject;
|
||||||
|
use App\Domain\Cms\Widgets\RenderContext;
|
||||||
|
use App\Domain\Cms\Widgets\Support\ImageRefFields;
|
||||||
|
use App\Domain\Cms\Widgets\Support\PremiumFields;
|
||||||
|
use App\Domain\Cms\Widgets\Support\PublicMedia;
|
||||||
|
use App\Domain\Cms\Widgets\WidgetErrors;
|
||||||
|
use App\Domain\Cms\Widgets\WidgetType;
|
||||||
|
use Filament\Forms\Components\Select;
|
||||||
|
use Filament\Forms\Components\TextInput;
|
||||||
|
use Filament\Schemas\Components\Group;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gemeinsame Basis der Premium-Karten (Brand-UI-Kit v1.7, Entwurf zur visuellen Freigabe):
|
||||||
|
* Redaktionelle Themenkarte, Medien- und Materialkarte, Modul- und Programmkarte.
|
||||||
|
*
|
||||||
|
* - Eine Karte je Widget, ein Widget je Platz. Das Raster ist das bestehende Abschnittsraster (1 bis 4 Einheiten);
|
||||||
|
* es gibt kein zweites Kartenraster.
|
||||||
|
* - refs: genau ein Fachobjekt (Kennung) und optional ein Bild aus dem öffentlichen Website-Bereich.
|
||||||
|
* Titel, Kurzbeschreibung, Art, Zusatzangaben und Linkziel kommen zur Laufzeit aus den Fachdaten.
|
||||||
|
* - data: nur Redaktionelles, das es im Fachobjekt nicht gibt: Beschriftung der Aktion, Hinweis, Alternativtext,
|
||||||
|
* Bildausschnitt. Ein freies Linkziel gibt es nicht; das Ziel ist immer die öffentliche Seite des Fachobjekts.
|
||||||
|
* - Bilder der Bibliothek (Vorschaubilder, Filmstandbilder) werden nie gezeigt.
|
||||||
|
*/
|
||||||
|
abstract class PremiumCardWidget extends WidgetType
|
||||||
|
{
|
||||||
|
public const SHOW = ['yes' => 'Anzeigen', 'no' => 'Ausblenden'];
|
||||||
|
|
||||||
|
/** Schlüssel des Fachobjekts in refs, zum Beispiel 'pillar'. */
|
||||||
|
abstract protected function refKey(): string;
|
||||||
|
|
||||||
|
abstract protected function refLabel(): string;
|
||||||
|
|
||||||
|
abstract protected function refHelp(): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<int, string>
|
||||||
|
*/
|
||||||
|
abstract protected function searchSubjects(?string $term): array;
|
||||||
|
|
||||||
|
abstract protected function subjectLabel(mixed $id): ?string;
|
||||||
|
|
||||||
|
/** Prüft beim Speichern, ob das Objekt gewählt werden darf; liefert sonst die Fehlermeldung. */
|
||||||
|
abstract protected function rejectSubject(int $id): ?string;
|
||||||
|
|
||||||
|
abstract protected function subject(mixed $id, RenderContext $context): ?CardSubject;
|
||||||
|
|
||||||
|
abstract protected function defaultActionLabel(): string;
|
||||||
|
|
||||||
|
/** Gestaltungsvariante des Kits: editorial, media oder catalog. */
|
||||||
|
abstract protected function cardStyle(): string;
|
||||||
|
|
||||||
|
public function view(): string
|
||||||
|
{
|
||||||
|
return 'widgets.premium_card';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function supportedUnits(): array
|
||||||
|
{
|
||||||
|
return [1, 2, 3, 4];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function preferredUnits(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function stages(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'stacked' => 'unter 520 px Kartenbreite: Bild oder Tafel über dem Text',
|
||||||
|
'side' => 'ab 520 px: Bild links (42 %), Text rechts (58 %); das gewählte Bildformat bleibt erhalten',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function narrowBehavior(): string
|
||||||
|
{
|
||||||
|
return 'Unter 520 px Kartenbreite steht das Bild über dem Text. Ab etwa 240 px nutzbar, empfohlen ab 280 px (eine Einheit ab Tablet). Texte werden nie gekürzt.';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function heights(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'auto' => 'Natürliche Höhe',
|
||||||
|
'fill' => 'An die Zeile angleichen',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function variants(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'adaptive' => 'Anpassend (ab 520 px Bild neben Text)',
|
||||||
|
'stacked' => 'Bild immer über dem Text',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function optionIcons(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'variant' => ['adaptive' => 'heroicon-o-view-columns', 'stacked' => 'heroicon-o-bars-3-bottom-left'],
|
||||||
|
'height' => ['auto' => 'heroicon-o-arrows-pointing-in', 'fill' => 'heroicon-o-arrows-up-down'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function settings(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'format' => ['landscape' => 'Querformat 16:9', 'square' => 'Quadrat 1:1', 'portrait' => 'Hochformat 3:4'],
|
||||||
|
'fit' => ['cover' => 'Ausschnitt füllt die Fläche', 'contain' => 'Ganzes Bild zeigen (Dokument, Poster)'],
|
||||||
|
'heading_level' => ['h3' => 'H3', 'h2' => 'H2', 'h4' => 'H4'],
|
||||||
|
'show_summary' => self::SHOW,
|
||||||
|
'show_kind' => self::SHOW,
|
||||||
|
'show_meta' => self::SHOW,
|
||||||
|
'show_action' => self::SHOW,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function settingLabels(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'format' => ['Bildformat', 'Vorgabe: Querformat 16:9. Gilt auch neben dem Text; das Motiv wird nicht nachträglich hochkant beschnitten.'],
|
||||||
|
'fit' => ['Bilddarstellung', 'Vorgabe: Ausschnitt. „Ganzes Bild“ zeigt Dokumente und Poster vollständig auf ruhiger Fläche.'],
|
||||||
|
'heading_level' => ['Überschriftenebene', 'Vorgabe: H3, passend unter einer Abschnittsüberschrift (H2).'],
|
||||||
|
'show_summary' => ['Kurzbeschreibung', 'Aus den Fachdaten. Vorgabe: anzeigen.'],
|
||||||
|
'show_kind' => ['Art oder Label', 'Zum Beispiel „Thema“ oder „Merkblatt“. Vorgabe: anzeigen.'],
|
||||||
|
'show_meta' => ['Zusatzangaben', 'Aus den Fachdaten, zum Beispiel Ausgabeart oder Programmzugehörigkeit. Vorgabe: anzeigen.'],
|
||||||
|
'show_action' => ['Aktion', 'Verweis auf die öffentliche Seite des Fachobjekts, falls es eine gibt. Vorgabe: anzeigen.'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function dataRules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'action_label' => ['nullable', 'string', 'max:60'],
|
||||||
|
'note' => ['nullable', 'string', 'max:200'],
|
||||||
|
'alt' => ['nullable', 'string', 'max:300'],
|
||||||
|
'focus_x' => ['nullable', 'numeric', 'between:0,100'],
|
||||||
|
'focus_y' => ['nullable', 'numeric', 'between:0,100'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function refRules(): array
|
||||||
|
{
|
||||||
|
return [$this->refKey() => ['required', 'integer']] + ImageRefFields::rules();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function dataFields(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
TextInput::make('action_label')
|
||||||
|
->label('Beschriftung der Aktion (optional)')
|
||||||
|
->maxLength(60)
|
||||||
|
->placeholder($this->defaultActionLabel())
|
||||||
|
->live(onBlur: true)
|
||||||
|
->helperText('Das Linkziel ist immer die öffentliche Seite des gewählten Objekts und kann nicht frei gesetzt werden.'),
|
||||||
|
TextInput::make('note')
|
||||||
|
->label('Hinweis (optional)')
|
||||||
|
->maxLength(200)
|
||||||
|
->live(onBlur: true)
|
||||||
|
->helperText('Kurzer redaktioneller Satz über der Aktion, zum Beispiel „Für die nächste Kursstunde“. Begründet keine Berechtigung.'),
|
||||||
|
PremiumFields::altField(),
|
||||||
|
...PremiumFields::focusFields(66, 45),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function refFields(): array
|
||||||
|
{
|
||||||
|
return [$this->subjectField(), ...ImageRefFields::fields(live: true)];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function editorSchema(): array
|
||||||
|
{
|
||||||
|
[$action, $note] = $this->dataFields();
|
||||||
|
|
||||||
|
return [
|
||||||
|
Group::make([$this->subjectField()])->statePath('refs'),
|
||||||
|
Group::make([$action, $note])->statePath('data'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function mediaSchema(): array
|
||||||
|
{
|
||||||
|
[, , $alt, $focusX, $focusY] = $this->dataFields();
|
||||||
|
|
||||||
|
return [
|
||||||
|
Group::make(ImageRefFields::fields('Kartenbild', live: true))->statePath('refs'),
|
||||||
|
Group::make([$alt, $focusX, $focusY])->statePath('data'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function clean(array $data, array $refs, WidgetErrors $errors): array
|
||||||
|
{
|
||||||
|
$key = $this->refKey();
|
||||||
|
$id = (int) $refs[$key];
|
||||||
|
$rejection = $this->rejectSubject($id);
|
||||||
|
|
||||||
|
if ($rejection !== null) {
|
||||||
|
$errors->add("refs.$key", $rejection);
|
||||||
|
}
|
||||||
|
|
||||||
|
$refs[$key] = $id;
|
||||||
|
$refs = ImageRefFields::clean($refs, $errors);
|
||||||
|
|
||||||
|
foreach (['action_label', 'note', 'alt'] as $field) {
|
||||||
|
$data[$field] = filled($data[$field] ?? null) ? trim((string) $data[$field]) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (['focus_x', 'focus_y'] as $field) {
|
||||||
|
$value = $data[$field] ?? null;
|
||||||
|
$data[$field] = is_numeric($value) ? (int) round(max(0, min(100, (float) $value))) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($refs['image'] !== null && $data['alt'] === null) {
|
||||||
|
$errors->add('data.alt', 'Bitte einen Alternativtext für das Bild angeben.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return [$data, $refs];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function resolve(array $widget, RenderContext $context): array
|
||||||
|
{
|
||||||
|
$settings = $widget['settings'];
|
||||||
|
$option = fn (string $key, string $default): string => is_string($settings[$key] ?? null) && isset($this->settingOptions()[$key][$settings[$key]]) ? $settings[$key] : $default;
|
||||||
|
$data = $widget['data'];
|
||||||
|
|
||||||
|
return [
|
||||||
|
'subject' => $this->subject($widget['refs'][$this->refKey()] ?? null, $context),
|
||||||
|
'cardStyle' => $this->cardStyle(),
|
||||||
|
'imageUrl' => PublicMedia::imageUrl($widget['refs']),
|
||||||
|
'alt' => is_string($data['alt'] ?? null) ? $data['alt'] : '',
|
||||||
|
'focus' => PremiumFields::focus($data, 66, 45),
|
||||||
|
'format' => $option('format', 'landscape'),
|
||||||
|
'fit' => $option('fit', 'cover'),
|
||||||
|
'headingTag' => $option('heading_level', 'h3'),
|
||||||
|
'show' => [
|
||||||
|
'summary' => $option('show_summary', 'yes') === 'yes',
|
||||||
|
'kind' => ! array_key_exists('show_kind', $this->settings()) || $option('show_kind', 'yes') === 'yes',
|
||||||
|
'meta' => $option('show_meta', 'yes') === 'yes',
|
||||||
|
'action' => $option('show_action', 'yes') === 'yes',
|
||||||
|
],
|
||||||
|
'actionLabel' => filled($data['action_label'] ?? null) ? (string) $data['action_label'] : $this->defaultActionLabel(),
|
||||||
|
'note' => filled($data['note'] ?? null) ? (string) $data['note'] : null,
|
||||||
|
'stacked' => $widget['variant'] === 'stacked',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function mediaPaths(array $widget): array
|
||||||
|
{
|
||||||
|
$image = $widget['refs']['image'] ?? null;
|
||||||
|
|
||||||
|
return PublicMedia::isPublicPath($image) ? [$image] : [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function summary(array $widget): string
|
||||||
|
{
|
||||||
|
$label = $this->subjectLabel($widget['refs'][$this->refKey()] ?? null);
|
||||||
|
|
||||||
|
return $label ?? 'Kein Objekt gewählt';
|
||||||
|
}
|
||||||
|
|
||||||
|
private function subjectField(): Select
|
||||||
|
{
|
||||||
|
return Select::make($this->refKey())
|
||||||
|
->label($this->refLabel())
|
||||||
|
->helperText($this->refHelp())
|
||||||
|
->required()
|
||||||
|
->live()
|
||||||
|
->searchable()
|
||||||
|
->getSearchResultsUsing(fn (?string $search): array => $this->searchSubjects($search))
|
||||||
|
->getOptionLabelUsing(fn (mixed $value): ?string => $this->subjectLabel($value))
|
||||||
|
->options(fn (): array => $this->searchSubjects(null));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domain\Cms\Widgets\Types;
|
||||||
|
|
||||||
|
use App\Domain\Catalog\Composition;
|
||||||
|
use App\Domain\Cms\Catalog\CardSubject;
|
||||||
|
use App\Domain\Cms\Catalog\PublicCatalogReader;
|
||||||
|
use App\Domain\Cms\Widgets\RenderContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modul- und Programmkarte (Kit v1.7 „catalog“): ein Programm oder Modul über PublicCatalogReader, dieselbe
|
||||||
|
* Freigaberegel wie die Programm- und Modulkarten (Programme öffentlich mit Programmseite, Module nur in der
|
||||||
|
* Redaktionsvorschau). Die Art ist immer sichtbar benannt. Ohne Bild trägt eine Navy-Tafel die Art.
|
||||||
|
* Kein Preis, kein Angebot, keine Kaufaktion; eine Karte ist kein Lizenzartikel.
|
||||||
|
*/
|
||||||
|
class ProgramCardWidget extends PremiumCardWidget
|
||||||
|
{
|
||||||
|
public function key(): string
|
||||||
|
{
|
||||||
|
return 'program_card';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function label(): string
|
||||||
|
{
|
||||||
|
return 'Programm- oder Modulkarte';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function description(): string
|
||||||
|
{
|
||||||
|
return 'Karte zu einem Programm oder Modul; Titel, Beschreibung und Art kommen aus den Fachdaten, ohne Preis und ohne Kaufaktion.';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function icon(): string
|
||||||
|
{
|
||||||
|
return 'heroicon-o-academic-cap';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function schematic(): array
|
||||||
|
{
|
||||||
|
return [[2, 2, 56, 32, 'line'], [5, 5, 22, 26, 'ink'], [8, 24, 10, 2, 'accent'], [31, 8, 10, 2, 'line'], [31, 13, 22, 4, 'ink'], [31, 25, 14, 5, 'ink']];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function settings(): array
|
||||||
|
{
|
||||||
|
// Die Art (Programm oder Modul) bleibt immer sichtbar; sie lässt sich nicht ausblenden.
|
||||||
|
$settings = parent::settings();
|
||||||
|
unset($settings['show_kind']);
|
||||||
|
|
||||||
|
return $settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function refKey(): string
|
||||||
|
{
|
||||||
|
return 'composition';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function refLabel(): string
|
||||||
|
{
|
||||||
|
return 'Programm oder Modul';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function refHelp(): string
|
||||||
|
{
|
||||||
|
return 'Nur zur Anzeige freigegebene Programme und Module sind wählbar. Öffentlich erscheinen Programme mit Programmseite; Module nur in der Redaktionsvorschau.';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function searchSubjects(?string $term): array
|
||||||
|
{
|
||||||
|
return app(PublicCatalogReader::class)->search($term);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function subjectLabel(mixed $id): ?string
|
||||||
|
{
|
||||||
|
return app(PublicCatalogReader::class)->labelFor($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function rejectSubject(int $id): ?string
|
||||||
|
{
|
||||||
|
$composition = Composition::query()->with('editorialContentKind')->find($id);
|
||||||
|
|
||||||
|
return $composition !== null && app(PublicCatalogReader::class)->isSelectable($composition)
|
||||||
|
? null
|
||||||
|
: 'Dieses Objekt ist kein zur Anzeige freigegebenes Programm oder Modul.';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function subject(mixed $id, RenderContext $context): ?CardSubject
|
||||||
|
{
|
||||||
|
return app(PublicCatalogReader::class)->subject($id, includeNonPublic: $context->preview);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function defaultActionLabel(): string
|
||||||
|
{
|
||||||
|
return 'Programm ansehen';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function cardStyle(): string
|
||||||
|
{
|
||||||
|
return 'catalog';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,115 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domain\Cms\Widgets\Types;
|
||||||
|
|
||||||
|
use App\Domain\Catalog\Pillar;
|
||||||
|
use App\Domain\Cms\Catalog\CardSubject;
|
||||||
|
use App\Domain\Cms\Widgets\RenderContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Redaktionelle Themenkarte (Kit v1.7 „editorial“): ein veröffentlichtes Thema (Säule) mit Name,
|
||||||
|
* öffentlicher Kurzbeschreibung und Verweis auf die Themenseite /themen/{slug}. Ruhige Textaktion mit gelber
|
||||||
|
* Unterstreichung. Ein nicht (mehr) veröffentlichtes Thema erscheint öffentlich nicht.
|
||||||
|
*/
|
||||||
|
class TopicCardWidget extends PremiumCardWidget
|
||||||
|
{
|
||||||
|
public function key(): string
|
||||||
|
{
|
||||||
|
return 'topic_card';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function label(): string
|
||||||
|
{
|
||||||
|
return 'Themenkarte';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function description(): string
|
||||||
|
{
|
||||||
|
return 'Redaktionelle Karte zu einem veröffentlichten Thema; Name, Kurzbeschreibung und Ziel kommen aus dem Thema.';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function icon(): string
|
||||||
|
{
|
||||||
|
return 'heroicon-o-bookmark-square';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function schematic(): array
|
||||||
|
{
|
||||||
|
return [[2, 2, 56, 32, 'line'], [5, 5, 22, 26, 'image'], [31, 8, 10, 2, 'accent'], [31, 13, 22, 4, 'ink'], [31, 20, 20, 3, 'line'], [31, 27, 12, 2, 'accent']];
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function refKey(): string
|
||||||
|
{
|
||||||
|
return 'pillar';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function refLabel(): string
|
||||||
|
{
|
||||||
|
return 'Thema';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function refHelp(): string
|
||||||
|
{
|
||||||
|
return 'Nur veröffentlichte Themen sind wählbar. Name und Kurzbeschreibung pflegen Sie im Thema, nicht hier.';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function searchSubjects(?string $term): array
|
||||||
|
{
|
||||||
|
$term = trim((string) $term);
|
||||||
|
|
||||||
|
return Pillar::query()
|
||||||
|
->published()
|
||||||
|
->when($term !== '', fn ($query) => $query->whereRaw('LOWER(name) LIKE ?', ['%'.mb_strtolower($term).'%']))
|
||||||
|
->limit(25)
|
||||||
|
->get()
|
||||||
|
->mapWithKeys(fn (Pillar $pillar): array => [$pillar->id => $pillar->name.' · Thema'])
|
||||||
|
->all();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function subjectLabel(mixed $id): ?string
|
||||||
|
{
|
||||||
|
$pillar = is_numeric($id) ? Pillar::query()->find((int) $id) : null;
|
||||||
|
|
||||||
|
if ($pillar === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $pillar->name.' · Thema'.($pillar->published_at === null ? ' · nicht veröffentlicht' : '');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function rejectSubject(int $id): ?string
|
||||||
|
{
|
||||||
|
return Pillar::query()->whereKey($id)->whereNotNull('published_at')->exists()
|
||||||
|
? null
|
||||||
|
: 'Dieses Thema ist nicht veröffentlicht.';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function subject(mixed $id, RenderContext $context): ?CardSubject
|
||||||
|
{
|
||||||
|
$pillar = is_numeric($id) ? Pillar::query()->find((int) $id) : null;
|
||||||
|
|
||||||
|
if ($pillar === null || $pillar->published_at === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new CardSubject(
|
||||||
|
title: (string) $pillar->name,
|
||||||
|
summary: filled($pillar->public_summary) ? (string) $pillar->public_summary : null,
|
||||||
|
kind: 'Thema',
|
||||||
|
badge: null,
|
||||||
|
meta: [],
|
||||||
|
url: $pillar->publicUrl(),
|
||||||
|
public: true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function defaultActionLabel(): string
|
||||||
|
{
|
||||||
|
return 'Thema entdecken';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function cardStyle(): string
|
||||||
|
{
|
||||||
|
return 'editorial';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,7 +7,10 @@
|
|||||||
use App\Domain\Cms\Widgets\Types\HeadingWidget;
|
use App\Domain\Cms\Widgets\Types\HeadingWidget;
|
||||||
use App\Domain\Cms\Widgets\Types\HeroWidget;
|
use App\Domain\Cms\Widgets\Types\HeroWidget;
|
||||||
use App\Domain\Cms\Widgets\Types\ImageTextWidget;
|
use App\Domain\Cms\Widgets\Types\ImageTextWidget;
|
||||||
|
use App\Domain\Cms\Widgets\Types\MediaCardWidget;
|
||||||
|
use App\Domain\Cms\Widgets\Types\ProgramCardWidget;
|
||||||
use App\Domain\Cms\Widgets\Types\ProseWidget;
|
use App\Domain\Cms\Widgets\Types\ProseWidget;
|
||||||
|
use App\Domain\Cms\Widgets\Types\TopicCardWidget;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
@@ -24,6 +27,9 @@
|
|||||||
ImageTextWidget::class,
|
ImageTextWidget::class,
|
||||||
CardsWidget::class,
|
CardsWidget::class,
|
||||||
CatalogCardsWidget::class,
|
CatalogCardsWidget::class,
|
||||||
|
TopicCardWidget::class,
|
||||||
|
MediaCardWidget::class,
|
||||||
|
ProgramCardWidget::class,
|
||||||
CallToActionWidget::class,
|
CallToActionWidget::class,
|
||||||
FaqWidget::class,
|
FaqWidget::class,
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -13,6 +13,8 @@
|
|||||||
/* Premium-Widgets nach Brand-UI-Kit v1.6; ersetzen das frühere Hero- und Bild-und-Text-CSS. */
|
/* Premium-Widgets nach Brand-UI-Kit v1.6; ersetzen das frühere Hero- und Bild-und-Text-CSS. */
|
||||||
@import './components/lf-hero.css';
|
@import './components/lf-hero.css';
|
||||||
@import './components/lf-bild-text.css';
|
@import './components/lf-bild-text.css';
|
||||||
|
/* Premium-Karten nach Brand-UI-Kit v1.7 (Entwurf zur visuellen Freigabe): Themen-, Medien- und Programmkarte. */
|
||||||
|
@import './components/lf-premium-card.css';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mitgliederbereich: eigene Anwendungsoberfläche mit eigener Navigation. Er verwendet die gemeinsamen
|
* Mitgliederbereich: eigene Anwendungsoberfläche mit eigener Navigation. Er verwendet die gemeinsamen
|
||||||
|
|||||||
@@ -0,0 +1,266 @@
|
|||||||
|
/*
|
||||||
|
* Premium-Karten (Themen-, Medien-, Programmkarte) – übernommen aus
|
||||||
|
* docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/components/lf-premium-card.css (Entwurf zur visuellen Freigabe).
|
||||||
|
*
|
||||||
|
* Anpassungen an das Repository:
|
||||||
|
* - Eine Karte je Platz im bestehenden Abschnittsraster. Das Beispielraster des Kits (.lf-pc-grid, .lf-pc-section,
|
||||||
|
* Spannweiten-Klassen) wird bewusst nicht übernommen; Spalten und Abstände bestimmt der Abschnitt.
|
||||||
|
* - Breitenumschaltung bei 520 px über den Platz-Container „slot“ (eine Karte füllt ihren Platz), nicht über das Fenster.
|
||||||
|
* - Gleiche Höhe je Zeile über die gemeinsame Höhe „fill“ (widgets.css), Aktion dann am unteren Rand.
|
||||||
|
* - Schriften und Farben ausschließlich über vorhandene Tokens (tokens.css); keine neuen Schriften.
|
||||||
|
* - Die Karte hat ihre eigene helle Fläche und setzt dafür die hellen Bedeutungswerte, auch in dunklen Abschnitten.
|
||||||
|
* - Kein line-clamp, keine feste Höhe: lange Titel und Texte brechen um.
|
||||||
|
*/
|
||||||
|
.lf-pc,
|
||||||
|
.lf-pc * {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lf-pc {
|
||||||
|
--color-heading: var(--lf-navy);
|
||||||
|
--color-text: var(--lf-ink);
|
||||||
|
--color-text-muted: var(--lf-ink-muted);
|
||||||
|
--color-border: var(--lf-line);
|
||||||
|
--color-focus: var(--lf-focus);
|
||||||
|
--pc-surface: var(--lf-white);
|
||||||
|
--pc-subtle: var(--lf-cream);
|
||||||
|
--pc-action: var(--lf-green-deep);
|
||||||
|
--pc-action-hover: #2f6407;
|
||||||
|
--pc-action-text: var(--lf-white);
|
||||||
|
--pc-accent: var(--lf-yellow);
|
||||||
|
--pc-ratio: 16 / 9;
|
||||||
|
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(0, 1fr);
|
||||||
|
grid-template-rows: auto 1fr;
|
||||||
|
min-inline-size: 0;
|
||||||
|
inline-size: 100%;
|
||||||
|
color: var(--color-text);
|
||||||
|
background: var(--pc-surface);
|
||||||
|
border: 1px solid var(--color-border);
|
||||||
|
border-radius: var(--radius-panel);
|
||||||
|
box-shadow: var(--shadow-raised);
|
||||||
|
font: 400 1rem/1.55 var(--font-reading);
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lf-pc--square { --pc-ratio: 1 / 1; }
|
||||||
|
.lf-pc--portrait { --pc-ratio: 3 / 4; }
|
||||||
|
.lf-pc--landscape { --pc-ratio: 16 / 9; }
|
||||||
|
.lf-pc--without-visual { grid-template-rows: 1fr; }
|
||||||
|
|
||||||
|
/* Gleiche Höhe je Zeile (Höhe „An die Zeile angleichen“): Karte füllt den gestreckten Platz. */
|
||||||
|
.widget-height-fill > .lf-pc {
|
||||||
|
flex: 1 1 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lf-pc__visual {
|
||||||
|
position: relative;
|
||||||
|
min-inline-size: 0;
|
||||||
|
align-self: start;
|
||||||
|
margin: 10px 10px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lf-pc__image {
|
||||||
|
display: block;
|
||||||
|
inline-size: 100%;
|
||||||
|
block-size: auto;
|
||||||
|
aspect-ratio: var(--pc-ratio);
|
||||||
|
object-fit: cover;
|
||||||
|
object-position: var(--pc-focus-x, 66%) var(--pc-focus-y, 45%);
|
||||||
|
border-radius: var(--radius-card);
|
||||||
|
background: var(--pc-subtle);
|
||||||
|
}
|
||||||
|
|
||||||
|
.lf-pc--contain .lf-pc__image {
|
||||||
|
object-fit: contain;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lf-pc__badge {
|
||||||
|
position: absolute;
|
||||||
|
inset: 12px auto auto 12px;
|
||||||
|
max-inline-size: calc(100% - 24px);
|
||||||
|
padding: 5px 10px;
|
||||||
|
border-radius: var(--radius-pill);
|
||||||
|
color: var(--lf-navy);
|
||||||
|
background: var(--lf-white);
|
||||||
|
font-size: 0.75rem;
|
||||||
|
font-weight: 600;
|
||||||
|
line-height: 1.45;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lf-pc__body {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: start;
|
||||||
|
min-inline-size: 0;
|
||||||
|
padding: clamp(20px, 4.5cqi, 32px);
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lf-pc__kind {
|
||||||
|
margin: 0;
|
||||||
|
color: var(--pc-action);
|
||||||
|
font-size: 0.75rem;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 0.06em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lf-pc .lf-pc__title {
|
||||||
|
margin: 0;
|
||||||
|
color: var(--color-heading);
|
||||||
|
font: 800 clamp(1.35rem, 4.6cqi, 1.75rem) / 1.18 var(--font-display);
|
||||||
|
letter-spacing: -0.025em;
|
||||||
|
text-wrap: balance;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lf-pc__summary {
|
||||||
|
margin: 0;
|
||||||
|
color: var(--color-text-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.lf-pc__meta {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 6px 14px;
|
||||||
|
list-style: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
color: var(--color-text-muted);
|
||||||
|
font-size: 0.875rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lf-pc__meta li {
|
||||||
|
min-inline-size: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lf-pc__footer {
|
||||||
|
margin-block-start: auto;
|
||||||
|
padding-block-start: 10px;
|
||||||
|
inline-size: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 12px;
|
||||||
|
align-items: start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lf-pc__note {
|
||||||
|
margin: 0;
|
||||||
|
color: var(--color-text-muted);
|
||||||
|
font-size: 0.8125rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lf-pc__cta {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
min-block-size: 44px;
|
||||||
|
max-inline-size: 100%;
|
||||||
|
padding: 10px 18px;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
border-radius: var(--radius-pill);
|
||||||
|
background: var(--pc-action);
|
||||||
|
color: var(--pc-action-text);
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 0.9375rem;
|
||||||
|
line-height: 1.4;
|
||||||
|
text-decoration: none;
|
||||||
|
text-align: center;
|
||||||
|
white-space: normal;
|
||||||
|
transition: background-color 0.15s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lf-pc__cta:visited { color: var(--pc-action-text); }
|
||||||
|
.lf-pc__cta:hover { background: var(--pc-action-hover); color: var(--pc-action-text); }
|
||||||
|
.lf-pc__cta:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 4px; }
|
||||||
|
|
||||||
|
/* Redaktionell: ruhige Textverlinkung mit gelber Unterstreichung. */
|
||||||
|
.lf-pc--editorial .lf-pc__cta {
|
||||||
|
padding-inline: 0;
|
||||||
|
background: transparent;
|
||||||
|
color: var(--color-heading);
|
||||||
|
border-radius: 4px;
|
||||||
|
text-align: start;
|
||||||
|
text-decoration: underline;
|
||||||
|
text-decoration-color: var(--pc-accent);
|
||||||
|
text-decoration-thickness: 3px;
|
||||||
|
text-underline-offset: 7px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lf-pc--editorial .lf-pc__cta:visited { color: var(--color-heading); }
|
||||||
|
.lf-pc--editorial .lf-pc__cta:hover { background: transparent; color: var(--color-heading); text-decoration-color: currentColor; }
|
||||||
|
|
||||||
|
/* Medien und Material: Metadatenband, grüne Aktion. */
|
||||||
|
.lf-pc--media .lf-pc__meta {
|
||||||
|
padding-block: 10px;
|
||||||
|
inline-size: 100%;
|
||||||
|
border-block: 1px solid var(--color-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Programm und Modul: Navy-Tafel mit Art und gelbem Akzent, auch ohne Foto vollständig; Navy-Aktion. */
|
||||||
|
.lf-pc__panel {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 20px;
|
||||||
|
min-block-size: 140px;
|
||||||
|
margin: 10px 10px 0;
|
||||||
|
padding: 24px;
|
||||||
|
border-radius: var(--radius-card);
|
||||||
|
background: var(--lf-navy);
|
||||||
|
color: var(--lf-white);
|
||||||
|
}
|
||||||
|
|
||||||
|
.lf-pc__panel-label {
|
||||||
|
font: 800 1.6rem / 1.15 var(--font-display);
|
||||||
|
}
|
||||||
|
|
||||||
|
.lf-pc__panel-accent {
|
||||||
|
display: block;
|
||||||
|
inline-size: 72px;
|
||||||
|
block-size: 10px;
|
||||||
|
color: var(--pc-accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.lf-pc--catalog .lf-pc__kind { color: var(--color-heading); }
|
||||||
|
.lf-pc--catalog .lf-pc__cta { background: var(--lf-navy); color: var(--lf-white); }
|
||||||
|
.lf-pc--catalog .lf-pc__cta:visited { color: var(--lf-white); }
|
||||||
|
.lf-pc--catalog .lf-pc__cta:hover { background: var(--lf-navy-deep); color: var(--lf-white); }
|
||||||
|
|
||||||
|
/* Nur in der Redaktionsvorschau sichtbare Karte: gestrichelter Rand als Hinweis. */
|
||||||
|
.lf-pc--internal { border-style: dashed; }
|
||||||
|
|
||||||
|
/* Ab 520 px Kartenbreite (= Platzbreite) Bild oder Tafel neben dem Text, außer in der Variante „Bild immer oben“. */
|
||||||
|
@container slot (min-width: 520px) {
|
||||||
|
.lf-pc:not(.lf-pc--without-visual, .lf-pc--stacked) {
|
||||||
|
grid-template-columns: minmax(0, 0.42fr) minmax(0, 0.58fr);
|
||||||
|
grid-template-rows: 1fr;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lf-pc:not(.lf-pc--stacked) .lf-pc__visual {
|
||||||
|
margin: 10px 0 10px 10px;
|
||||||
|
align-self: center;
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lf-pc:not(.lf-pc--stacked) .lf-pc__panel {
|
||||||
|
margin: 10px 0 10px 10px;
|
||||||
|
min-block-size: 220px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lf-pc--contain:not(.lf-pc--stacked) .lf-pc__visual {
|
||||||
|
align-items: center;
|
||||||
|
background: var(--pc-subtle);
|
||||||
|
border-radius: var(--radius-card);
|
||||||
|
}
|
||||||
|
|
||||||
|
.lf-pc__body { padding: clamp(22px, 4cqi, 36px); }
|
||||||
|
.lf-pc .lf-pc__title { font-size: clamp(1.45rem, 3.4cqi, 2rem); }
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion: reduce) {
|
||||||
|
.lf-pc__cta { transition: none; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
{{--
|
||||||
|
Premium-Karte (Brand-UI-Kit v1.7, Entwurf zur visuellen Freigabe) für Themen-, Medien- und Programmkarten.
|
||||||
|
Alle Texte und das Linkziel kommen aus $subject (Fachdaten zur Laufzeit, PublicCatalogReader/PublicMaterialReader);
|
||||||
|
redaktionell sind nur Bild, Alternativtext, Bildausschnitt, Beschriftung der Aktion und Hinweis.
|
||||||
|
Eine Karte, ein expliziter Link, kein über die ganze Karte gestreckter Link. Breitenabhängig über @container slot.
|
||||||
|
--}}
|
||||||
|
@if ($subject === null)
|
||||||
|
@if ($context->preview)
|
||||||
|
<p class="preview-note">Kein Objekt verknüpft, oder das verknüpfte Objekt ist nicht mehr veröffentlicht beziehungsweise freigegeben. Öffentlich erscheint diese Karte nicht.</p>
|
||||||
|
@endif
|
||||||
|
@elseif ($subject->public || $context->preview)
|
||||||
|
@php
|
||||||
|
$hasPanel = $cardStyle === 'catalog' && $imageUrl === null;
|
||||||
|
$action = $show['action'] && $subject->url !== null ? ['url' => $subject->url, 'label' => $actionLabel] : null;
|
||||||
|
$meta = $show['meta'] ? $subject->meta : [];
|
||||||
|
@endphp
|
||||||
|
<article @class([
|
||||||
|
'lf-pc',
|
||||||
|
'lf-pc--'.$cardStyle,
|
||||||
|
'lf-pc--'.$format,
|
||||||
|
'lf-pc--'.$fit,
|
||||||
|
'lf-pc--stacked' => $stacked,
|
||||||
|
'lf-pc--without-visual' => $imageUrl === null && ! $hasPanel,
|
||||||
|
'lf-pc--internal' => ! $subject->public,
|
||||||
|
]) style="--pc-focus-x: {{ $focus['x'] }}%; --pc-focus-y: {{ $focus['y'] }}%">
|
||||||
|
@if ($imageUrl !== null)
|
||||||
|
<div class="lf-pc__visual">
|
||||||
|
<img class="lf-pc__image" src="{{ $imageUrl }}" alt="{{ $alt }}" loading="lazy" decoding="async">
|
||||||
|
@if ($show['kind'] && $subject->badge !== null)
|
||||||
|
<span class="lf-pc__badge">{{ $subject->badge }}</span>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
@elseif ($hasPanel)
|
||||||
|
<div class="lf-pc__panel" aria-hidden="true">
|
||||||
|
<span class="lf-pc__panel-label">{{ $subject->kind }}</span>
|
||||||
|
<x-brand.underline class="lf-pc__panel-accent" />
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
<div class="lf-pc__body">
|
||||||
|
@if ($show['kind'] && $subject->kind !== '')
|
||||||
|
<p class="lf-pc__kind">{{ $subject->kind }}</p>
|
||||||
|
@endif
|
||||||
|
<{{ $headingTag }} class="lf-pc__title">{{ $subject->title }}</{{ $headingTag }}>
|
||||||
|
@if ($show['summary'] && filled($subject->summary))
|
||||||
|
<p class="lf-pc__summary">{{ $subject->summary }}</p>
|
||||||
|
@endif
|
||||||
|
@if ($meta !== [])
|
||||||
|
<ul class="lf-pc__meta" aria-label="Weitere Angaben">
|
||||||
|
@foreach ($meta as $item)
|
||||||
|
<li>{{ $item }}</li>
|
||||||
|
@endforeach
|
||||||
|
</ul>
|
||||||
|
@endif
|
||||||
|
@if ($action !== null || $note !== null)
|
||||||
|
<div class="lf-pc__footer">
|
||||||
|
@if ($note !== null)
|
||||||
|
<p class="lf-pc__note">{{ $note }}</p>
|
||||||
|
@endif
|
||||||
|
@if ($action !== null)
|
||||||
|
<a class="lf-pc__cta" href="{{ $action['url'] }}">{{ $action['label'] }}</a>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
@if (! $subject->public && $subject->notice !== null)
|
||||||
|
<p class="preview-note">{{ $subject->notice }}</p>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
@endif
|
||||||
@@ -0,0 +1,383 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature;
|
||||||
|
|
||||||
|
use App\Domain\Catalog\CompositionDisplayRelease;
|
||||||
|
use App\Domain\Catalog\ContentElement;
|
||||||
|
use App\Domain\Catalog\ContentService;
|
||||||
|
use App\Domain\Catalog\EditorialContentKind;
|
||||||
|
use App\Domain\Catalog\Pillar;
|
||||||
|
use App\Domain\Catalog\PillarService;
|
||||||
|
use App\Domain\Cms\Page;
|
||||||
|
use App\Domain\Cms\PageRevision;
|
||||||
|
use App\Domain\Cms\PageService;
|
||||||
|
use App\Domain\Cms\Widgets\WidgetRegistry;
|
||||||
|
use App\Filament\Resources\Pages\Pages\CreatePage;
|
||||||
|
use App\Filament\Resources\Pages\Pages\EditPage;
|
||||||
|
use App\Filament\Support\WidgetEditor;
|
||||||
|
use App\Models\User;
|
||||||
|
use Filament\Actions\Testing\TestAction;
|
||||||
|
use Filament\Facades\Filament;
|
||||||
|
use Filament\Forms\Components\Select;
|
||||||
|
use Filament\Forms\Components\Slider;
|
||||||
|
use Filament\Forms\Components\ToggleButtons;
|
||||||
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Illuminate\Validation\ValidationException;
|
||||||
|
use Livewire\Livewire;
|
||||||
|
use Tests\Support\BuildsCatalog;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Premium-Karten v1.7 (Themen-, Medien- und Programmkarte): Fachbezug ohne Kopien, Freigaberegeln,
|
||||||
|
* keine Bibliotheksbilder, kein Preis und keine Kaufaktion, Bearbeitung über den regulären Seiteneditor.
|
||||||
|
*/
|
||||||
|
class CmsPremiumCardsTest extends TestCase
|
||||||
|
{
|
||||||
|
use BuildsCatalog;
|
||||||
|
use RefreshDatabase;
|
||||||
|
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
|
||||||
|
Filament::setCurrentPanel(Filament::getPanel('verwaltung'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_the_three_card_types_are_registered_with_the_layout_contract(): void
|
||||||
|
{
|
||||||
|
$registry = app(WidgetRegistry::class);
|
||||||
|
|
||||||
|
foreach (['topic_card' => 'pillar', 'media_card' => 'element', 'program_card' => 'composition'] as $key => $ref) {
|
||||||
|
$type = $registry->get($key);
|
||||||
|
$this->assertSame([1, 2, 3, 4], $type->supportedUnits(), $key);
|
||||||
|
$this->assertSame(['auto', 'fill'], array_keys($type->heights()), $key);
|
||||||
|
$this->assertSame(['adaptive', 'stacked'], array_keys($type->variants()), $key);
|
||||||
|
$this->assertSame('widgets.premium_card', $type->view());
|
||||||
|
$this->assertArrayHasKey($ref, $type->refRules());
|
||||||
|
$this->assertArrayNotHasKey('url', $type->dataRules(), 'Kein freies Linkziel.');
|
||||||
|
$this->assertArrayNotHasKey('title', $type->dataRules(), 'Kein eigener Titel: der Titel kommt aus dem Fachobjekt.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->assertArrayNotHasKey('show_kind', $registry->get('program_card')->settingOptions(), 'Programm oder Modul bleibt immer benannt.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_topic_card_shows_a_published_theme_from_the_master_data_only(): void
|
||||||
|
{
|
||||||
|
$pillar = $this->pillar('Gefühle verstehen', 'gefuehle-verstehen', 'Geschichten und Impulse, die Kinder ins Gespräch bringen.');
|
||||||
|
|
||||||
|
$revision = $this->publish('/themenkarte', [$this->section('u2_2', [
|
||||||
|
$this->card('topic_card', ['pillar' => $pillar->id], settings: ['heading_level' => 'h2', 'show_summary' => 'yes']),
|
||||||
|
$this->card('topic_card', ['pillar' => $pillar->id], data: ['action_label' => 'Mehr zum Thema'], settings: ['show_summary' => 'no', 'show_kind' => 'no']),
|
||||||
|
])]);
|
||||||
|
|
||||||
|
$this->assertSame(['pillar' => $pillar->id, 'image' => null], $revision->sections[0]['slots'][0]['refs']);
|
||||||
|
$this->assertStringNotContainsString('Gefühle verstehen', json_encode($revision->sections), 'Keine Kopie des Themennamens im CMS.');
|
||||||
|
|
||||||
|
$html = $this->get('/themenkarte')->assertOk()->getContent();
|
||||||
|
$this->assertStringContainsString('<h2 class="lf-pc__title">Gefühle verstehen</h2>', $html);
|
||||||
|
$this->assertStringContainsString('<h3 class="lf-pc__title">Gefühle verstehen</h3>', $html);
|
||||||
|
$this->assertSame(1, substr_count($html, 'Geschichten und Impulse'), 'Kurzbeschreibung nur, wo sie angezeigt werden soll.');
|
||||||
|
$this->assertStringContainsString('href="'.route('theme', ['slug' => 'gefuehle-verstehen']).'">Thema entdecken</a>', $html);
|
||||||
|
$this->assertStringContainsString('>Mehr zum Thema</a>', $html);
|
||||||
|
$this->assertSame(1, substr_count($html, '<p class="lf-pc__kind">Thema</p>'));
|
||||||
|
|
||||||
|
$pillar->update(['name' => 'Gefühle verstehen und benennen']);
|
||||||
|
$this->get('/themenkarte')->assertSee('Gefühle verstehen und benennen');
|
||||||
|
|
||||||
|
$pillar->update(['published_at' => null]);
|
||||||
|
$this->get('/themenkarte')->assertOk()->assertDontSee('lf-pc', false)->assertDontSee('Gefühle verstehen');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_program_card_names_its_kind_and_offers_no_price_or_purchase(): void
|
||||||
|
{
|
||||||
|
$module = $this->composition('Modul Nein sagen', 'modul', summary: 'Ein Modul');
|
||||||
|
$program = $this->composition('Programm Selbstvertrauen', 'programm', summary: 'Ein roter Faden für die Kursgestaltung.');
|
||||||
|
|
||||||
|
$revision = $this->publish('/programmkarte', [$this->section('u2_2', [
|
||||||
|
$this->card('program_card', ['composition' => $program->composition_id]),
|
||||||
|
$this->card('program_card', ['composition' => $module->composition_id]),
|
||||||
|
])]);
|
||||||
|
|
||||||
|
$html = $this->get('/programmkarte')->assertOk()->getContent();
|
||||||
|
$this->assertStringContainsString('<p class="lf-pc__kind">Programm</p>', $html);
|
||||||
|
$this->assertStringContainsString('<span class="lf-pc__panel-label">Programm</span>', $html, 'Ohne Bild trägt die Navy-Tafel die Art.');
|
||||||
|
$this->assertStringContainsString('href="'.route('public.program', $program->composition_id).'">Programm ansehen</a>', $html);
|
||||||
|
$this->assertStringContainsString('Ein roter Faden', $html);
|
||||||
|
$this->assertStringNotContainsString('Modul Nein sagen', $html, 'Module erscheinen öffentlich nicht.');
|
||||||
|
$this->assertStringNotContainsString('Modul / Programm', $html);
|
||||||
|
|
||||||
|
foreach (['€', 'EUR', 'Preis', 'kaufen', 'Warenkorb', '/bereich/angebote', 'offers'] as $commerce) {
|
||||||
|
$this->assertStringNotContainsString($commerce, $this->mainHtml($html), "Keine Kaufaktion: $commerce");
|
||||||
|
}
|
||||||
|
|
||||||
|
$preview = $this->actingAs(User::factory()->redakteur()->create(), 'staff')->get(route('pages.preview', $revision))->assertOk()->getContent();
|
||||||
|
$this->assertStringContainsString('<p class="lf-pc__kind">Modul</p>', $preview);
|
||||||
|
$this->assertStringContainsString('Nur in der Redaktionsvorschau sichtbar: Für Module gibt es noch keine öffentliche Seitenart', $preview);
|
||||||
|
$this->assertStringContainsString('lf-pc--internal', $preview);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_program_card_lists_the_number_of_modules_of_the_shown_version(): void
|
||||||
|
{
|
||||||
|
$content = app(ContentService::class);
|
||||||
|
$moduleA = $this->composition('Modul Eins', 'modul');
|
||||||
|
$moduleB = $this->composition('Modul Zwei', 'modul');
|
||||||
|
$composition = $content->createComposition('Programm mit Modulen');
|
||||||
|
$composition->editorial_content_kind_id = EditorialContentKind::query()->where('slug', 'programm')->value('id');
|
||||||
|
$composition->save();
|
||||||
|
$version = $content->publishComposition($composition, [
|
||||||
|
['role' => 'Modul', 'target' => $moduleA],
|
||||||
|
['role' => 'Modul', 'target' => $moduleB],
|
||||||
|
]);
|
||||||
|
app(CompositionDisplayRelease::class)->release($version, User::factory()->create());
|
||||||
|
|
||||||
|
$this->publish('/programm-module', [$this->section('u4', [$this->card('program_card', ['composition' => $composition->id])])]);
|
||||||
|
|
||||||
|
$this->get('/programm-module')->assertOk()->assertSee('<li>2 Module</li>', false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_media_card_is_public_only_as_part_of_a_public_program_and_never_releases_the_medium(): void
|
||||||
|
{
|
||||||
|
$content = app(ContentService::class);
|
||||||
|
$film = $content->createElement('film', 'film', 'Denkpause Rohschnitt');
|
||||||
|
$film->update(['display_title' => 'Eine Pause, die stark macht', 'summary' => 'Gemeinsam innehalten und über gute nächste Schritte sprechen.', 'thumbnail_path' => 'vorschau/denkpause.jpg']);
|
||||||
|
$filmVersion = $content->publishElementVersion($film, 'Filmbeschreibung');
|
||||||
|
$sheet = $content->createElement('text', 'pdf', 'Arbeitsblatt intern');
|
||||||
|
$sheet->update(['editorial_content_kind_id' => EditorialContentKind::query()->where('slug', 'merkblatt')->value('id')]);
|
||||||
|
$content->publishElementVersion($sheet, 'Inhalt');
|
||||||
|
|
||||||
|
$composition = $content->createComposition('Programm Denkpause');
|
||||||
|
$composition->editorial_content_kind_id = EditorialContentKind::query()->where('slug', 'programm')->value('id');
|
||||||
|
$composition->save();
|
||||||
|
$version = $content->publishComposition($composition, [['role' => 'Film', 'target' => $filmVersion]]);
|
||||||
|
app(CompositionDisplayRelease::class)->release($version, User::factory()->create());
|
||||||
|
|
||||||
|
$revision = $this->publish('/medienkarte', [$this->section('u2_2', [
|
||||||
|
$this->card('media_card', ['element' => $film->id], data: ['note' => 'Für die nächste Kursstunde.']),
|
||||||
|
$this->card('media_card', ['element' => $sheet->id]),
|
||||||
|
])]);
|
||||||
|
|
||||||
|
$html = $this->get('/medienkarte')->assertOk()->getContent();
|
||||||
|
$main = $this->mainHtml($html);
|
||||||
|
$this->assertStringContainsString('Eine Pause, die stark macht', $main);
|
||||||
|
$this->assertStringContainsString('<p class="lf-pc__kind">Film</p>', $main);
|
||||||
|
$this->assertStringContainsString('<li>Im Programm „Programm Denkpause“</li>', $main);
|
||||||
|
$this->assertStringContainsString('href="'.route('public.program', $composition->id).'">Im Programm ansehen</a>', $main);
|
||||||
|
$this->assertStringContainsString('Für die nächste Kursstunde.', $main);
|
||||||
|
$this->assertStringNotContainsString('Arbeitsblatt intern', $main, 'Nicht Teil eines öffentlichen Programms: öffentlich nicht sichtbar.');
|
||||||
|
|
||||||
|
foreach (['vorschau/denkpause.jpg', '/bereich/', '/redaktion/', '/ausgabe/', '<video', 'download', 'Filmbeschreibung'] as $protected) {
|
||||||
|
$this->assertStringNotContainsString($protected, $main, "Keine geschützte Ausgabe über die Karte: $protected");
|
||||||
|
}
|
||||||
|
|
||||||
|
$preview = $this->actingAs(User::factory()->redakteur()->create(), 'staff')->get(route('pages.preview', $revision))->assertOk()->getContent();
|
||||||
|
$this->assertStringContainsString('Arbeitsblatt intern', $preview);
|
||||||
|
$this->assertStringContainsString('<p class="lf-pc__kind">Merkblatt</p>', $preview);
|
||||||
|
$this->assertStringContainsString('Dieses Medium gehört zu keinem öffentlich gezeigten Programm', $preview);
|
||||||
|
|
||||||
|
$film->update(['archived_at' => now()]);
|
||||||
|
$this->get('/medienkarte')->assertOk()->assertDontSee('Eine Pause, die stark macht');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_cards_reject_unpublished_or_unreleased_objects_and_require_alt_text_for_images(): void
|
||||||
|
{
|
||||||
|
Storage::fake('media_public');
|
||||||
|
Storage::disk('media_public')->put('cms/karte.jpg', 'bild');
|
||||||
|
$hidden = Pillar::query()->create(['name' => 'Entwurfsthema', 'slug' => 'entwurf']);
|
||||||
|
$draft = $this->composition('Programm Entwurf', 'programm', released: false);
|
||||||
|
$archived = app(ContentService::class)->createElement('film', 'film', 'Ohne Fassung');
|
||||||
|
$published = $this->pillar('Grenzen', 'grenzen', null);
|
||||||
|
|
||||||
|
$cases = [
|
||||||
|
[$this->card('topic_card', ['pillar' => $hidden->id]), 'refs.pillar'],
|
||||||
|
[$this->card('program_card', ['composition' => $draft->composition_id]), 'refs.composition'],
|
||||||
|
[$this->card('media_card', ['element' => $archived->id]), 'refs.element'],
|
||||||
|
[$this->card('topic_card', ['pillar' => $published->id, 'image' => 'cms/karte.jpg']), 'data.alt'],
|
||||||
|
[$this->card('topic_card', ['pillar' => $published->id], settings: ['format' => 'panorama']), 'settings.format'],
|
||||||
|
[$this->card('topic_card', []), 'refs.pillar'],
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($cases as [$card, $key]) {
|
||||||
|
try {
|
||||||
|
app(PageService::class)->saveRevision(Page::query()->create(['path' => '/fehler-'.Str::random(6)]), [$this->section('u4', [$card])], null, null, null);
|
||||||
|
$this->fail("Erwarteter Fehler: $key");
|
||||||
|
} catch (ValidationException $exception) {
|
||||||
|
$this->assertArrayHasKey("sections.0.slots.0.$key", $exception->errors(), json_encode($exception->errors()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_mixed_card_grids_use_the_section_grid_with_equal_height_and_image_options(): void
|
||||||
|
{
|
||||||
|
Storage::fake('media_public');
|
||||||
|
Storage::disk('media_public')->put('cms/karte.jpg', 'bild');
|
||||||
|
$pillar = $this->pillar('Hilfe holen', 'hilfe-holen', str_repeat('Ein sehr langer Text, der umbrechen muss. ', 12));
|
||||||
|
$program = $this->composition('Programm Lang', 'programm', summary: 'Kurz');
|
||||||
|
|
||||||
|
$this->publish('/kartenraster', [
|
||||||
|
$this->section('u1_1_2', [
|
||||||
|
$this->card('topic_card', ['pillar' => $pillar->id, 'image' => 'cms/karte.jpg'], data: ['alt' => 'Lara und Felix im Park', 'focus_x' => 30, 'focus_y' => 70], settings: ['height' => 'fill', 'format' => 'portrait', 'fit' => 'contain']),
|
||||||
|
$this->card('program_card', ['composition' => $program->composition_id], settings: ['height' => 'fill']),
|
||||||
|
$this->card('topic_card', ['pillar' => $pillar->id], variant: 'stacked'),
|
||||||
|
]),
|
||||||
|
$this->section('u2_2', [
|
||||||
|
$this->card('program_card', ['composition' => $program->composition_id, 'image' => 'cms/karte.jpg'], data: ['alt' => 'Kursraum']),
|
||||||
|
$this->card('topic_card', ['pillar' => $pillar->id], settings: ['show_action' => 'no', 'show_meta' => 'no']),
|
||||||
|
]),
|
||||||
|
]);
|
||||||
|
|
||||||
|
$html = $this->get('/kartenraster')->assertOk()->getContent();
|
||||||
|
$this->assertStringContainsString('section-layout-u1-1-2', $html);
|
||||||
|
$this->assertStringContainsString('--section-cols-lg: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 2fr)', $html);
|
||||||
|
$this->assertStringNotContainsString('lf-pc-grid', $html, 'Kein zweites Kartenraster.');
|
||||||
|
$this->assertSame(2, substr_count($html, 'widget-height-fill'));
|
||||||
|
$this->assertStringContainsString('lf-pc lf-pc--editorial lf-pc--portrait lf-pc--contain', $html);
|
||||||
|
$this->assertStringContainsString('--pc-focus-x: 30%; --pc-focus-y: 70%', $html);
|
||||||
|
$this->assertStringContainsString('alt="Lara und Felix im Park"', $html);
|
||||||
|
$this->assertStringContainsString('lf-pc--stacked lf-pc--without-visual', $html);
|
||||||
|
$this->assertStringContainsString('lf-pc lf-pc--catalog lf-pc--landscape lf-pc--cover"', $html, 'Programmkarte mit Bild zeigt das Bild statt der Tafel.');
|
||||||
|
$this->assertSame(2, substr_count($html, 'Thema entdecken'), 'Drei Themenkarten, auf einer ist die Aktion ausgeblendet.');
|
||||||
|
$this->assertStringContainsString(str_repeat('Ein sehr langer Text, der umbrechen muss. ', 11), html_entity_decode($html), 'Lange Texte werden nicht gekürzt.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_editor_inserts_configures_saves_and_reopens_all_three_cards(): void
|
||||||
|
{
|
||||||
|
Storage::fake('media_public');
|
||||||
|
Storage::fake('cms_incoming');
|
||||||
|
Storage::disk('media_public')->put('cms/karte.jpg', 'bild');
|
||||||
|
$pillar = $this->pillar('Gefühle', 'gefuehle', 'Kurz');
|
||||||
|
$program = $this->composition('Programm Abstand', 'programm');
|
||||||
|
$element = ContentElement::query()->where('working_title', 'Programm Abstand Blatt')->firstOrFail();
|
||||||
|
|
||||||
|
Livewire::actingAs($this->editor(), 'staff')
|
||||||
|
->test(CreatePage::class)
|
||||||
|
->fillForm([
|
||||||
|
'path' => '/karten-editor',
|
||||||
|
'sections' => [
|
||||||
|
$this->sectionState('u1_1_2', [
|
||||||
|
['type' => 'topic_card', 'data' => ['variant' => 'adaptive', 'settings' => ['height' => 'fill', 'format' => 'square', 'heading_level' => 'h2'], 'data' => ['action_label' => 'Zum Thema', 'alt' => 'Park', 'focus_x' => 20, 'focus_y' => 80], 'refs' => ['pillar' => $pillar->id, 'image' => 'cms/karte.jpg']]],
|
||||||
|
['type' => 'media_card', 'data' => ['variant' => 'stacked', 'settings' => ['height' => 'fill', 'show_meta' => 'no'], 'data' => ['note' => 'Hinweis'], 'refs' => ['element' => $element->id]]],
|
||||||
|
['type' => 'program_card', 'data' => ['variant' => 'adaptive', 'settings' => ['height' => 'fill', 'fit' => 'contain'], 'data' => [], 'refs' => ['composition' => $program->composition_id]]],
|
||||||
|
]),
|
||||||
|
],
|
||||||
|
])
|
||||||
|
->call('create')
|
||||||
|
->assertHasNoFormErrors();
|
||||||
|
|
||||||
|
$page = Page::query()->where('path', '/karten-editor')->firstOrFail();
|
||||||
|
$this->assertNull($page->published_revision_id, 'Entwurf, nicht veröffentlicht.');
|
||||||
|
[$topic, $media, $programCard] = $page->latestRevision->sections[0]['slots'];
|
||||||
|
$this->assertSame(['topic_card', 'adaptive', ['height' => 'fill', 'format' => 'square', 'heading_level' => 'h2']], [$topic['type'], $topic['variant'], $topic['settings']]);
|
||||||
|
$this->assertSame(['pillar' => $pillar->id, 'image' => 'cms/karte.jpg'], $topic['refs']);
|
||||||
|
$this->assertSame(['Zum Thema', 20, 80], [$topic['data']['action_label'], $topic['data']['focus_x'], $topic['data']['focus_y']]);
|
||||||
|
$this->assertSame(['media_card', 'stacked', $element->id], [$media['type'], $media['variant'], $media['refs']['element']]);
|
||||||
|
$this->assertSame(['program_card', $program->composition_id], [$programCard['type'], $programCard['refs']['composition']]);
|
||||||
|
|
||||||
|
// Wieder öffnen: Dialog zeigt Inhalt (Fachobjekt), Medien (Bild, Fokus) und Darstellung (Variante, Höhe, Optionen).
|
||||||
|
$component = Livewire::actingAs($this->editor(), 'staff')->test(EditPage::class, ['record' => $page->id]);
|
||||||
|
$sectionKey = array_key_first($component->get('data.sections'));
|
||||||
|
$slotKey = array_key_first($component->get("data.sections.$sectionKey.slots"));
|
||||||
|
$itemKey = array_key_first($component->get("data.sections.$sectionKey.slots.$slotKey.widget"));
|
||||||
|
$this->assertSame($pillar->id, (int) $component->get("data.sections.$sectionKey.slots.$slotKey.widget.$itemKey.data.refs.pillar"));
|
||||||
|
|
||||||
|
$component->mountAction(TestAction::make('edit')->schemaComponent("sections.$sectionKey.slots.$slotKey.widget")->arguments(['item' => $itemKey]))
|
||||||
|
->assertFormFieldExists('refs.pillar', fn ($field) => $field instanceof Select && $field->isRequired())
|
||||||
|
->assertFormFieldExists('data.action_label')
|
||||||
|
->assertFormFieldExists('data.note')
|
||||||
|
->assertFormFieldExists('refs.image')
|
||||||
|
->assertFormFieldExists('data.alt')
|
||||||
|
->assertFormFieldExists('data.focus_x', fn ($field) => $field instanceof Slider)
|
||||||
|
->assertFormFieldExists('variant', fn ($field) => $field instanceof ToggleButtons && array_keys($field->getOptions()) === ['adaptive', 'stacked'])
|
||||||
|
->assertFormFieldExists('settings.height', fn ($field) => $field instanceof ToggleButtons && array_keys($field->getOptions()) === ['auto', 'fill'])
|
||||||
|
->assertFormFieldExists('settings.format')
|
||||||
|
->assertFormFieldExists('settings.fit')
|
||||||
|
->assertFormFieldExists('settings.show_summary')
|
||||||
|
->assertFormFieldExists('settings.show_action');
|
||||||
|
|
||||||
|
// Live-Vorschau des Dialogs mit derselben Ansicht wie die öffentliche Seite.
|
||||||
|
$preview = WidgetEditor::renderPreview('topic_card', $component->get("data.sections.$sectionKey.slots.$slotKey.widget.$itemKey.data"));
|
||||||
|
$this->assertStringContainsString('lf-pc lf-pc--editorial lf-pc--square', htmlspecialchars_decode($preview));
|
||||||
|
|
||||||
|
// Speichern ohne Änderung bleibt fehlerfrei; Veröffentlichen zeigt die Karten öffentlich.
|
||||||
|
$component->call('save')->assertHasNoFormErrors();
|
||||||
|
app(PageService::class)->publish($page->refresh(), $page->latestRevision);
|
||||||
|
$html = $this->get('/karten-editor')->assertOk()->getContent();
|
||||||
|
$this->assertStringContainsString('<h2 class="lf-pc__title">Gefühle</h2>', $html);
|
||||||
|
$this->assertStringContainsString('>Zum Thema</a>', $html);
|
||||||
|
$this->assertStringContainsString('Programm Abstand', $html);
|
||||||
|
$this->assertStringContainsString('Programm Abstand Blatt', $html, 'Ein Element eines öffentlichen Programms erscheint öffentlich.');
|
||||||
|
$this->assertStringContainsString('lf-pc lf-pc--media lf-pc--landscape lf-pc--cover lf-pc--stacked', $html);
|
||||||
|
$this->assertStringNotContainsString('Im Programm „Programm Abstand“', $html, 'Zusatzangaben ausgeblendet.');
|
||||||
|
}
|
||||||
|
|
||||||
|
private function pillar(string $name, string $slug, ?string $summary): Pillar
|
||||||
|
{
|
||||||
|
$pillar = app(PillarService::class)->create($name);
|
||||||
|
app(PillarService::class)->present($pillar, $name, $slug, $summary, true, 10);
|
||||||
|
|
||||||
|
return $pillar->refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, mixed> $refs
|
||||||
|
* @param array<string, mixed> $data
|
||||||
|
* @param array<string, string> $settings
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
private function card(string $type, array $refs, array $data = [], array $settings = [], string $variant = 'adaptive'): array
|
||||||
|
{
|
||||||
|
return ['type' => $type, 'v' => 1, 'variant' => $variant, 'settings' => $settings, 'data' => $data, 'refs' => $refs];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param list<array<string, mixed>|null> $slots
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
private function section(string $layout, array $slots): array
|
||||||
|
{
|
||||||
|
return ['layout' => $layout, 'style' => [], 'slots' => $slots];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param list<array<string, mixed>> $sections
|
||||||
|
*/
|
||||||
|
private function publish(string $path, array $sections): PageRevision
|
||||||
|
{
|
||||||
|
$page = Page::query()->create(['path' => $path]);
|
||||||
|
$service = app(PageService::class);
|
||||||
|
$revision = $service->saveRevision($page, $sections, null, null, null);
|
||||||
|
$service->publish($page, $revision);
|
||||||
|
|
||||||
|
return $revision;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function mainHtml(string $html): string
|
||||||
|
{
|
||||||
|
preg_match('#<main[^>]*>(.*)</main>#s', $html, $match);
|
||||||
|
|
||||||
|
return $match[1] ?? '';
|
||||||
|
}
|
||||||
|
|
||||||
|
private function editor(): User
|
||||||
|
{
|
||||||
|
$editor = User::factory()->redakteur()->create();
|
||||||
|
$editor->saveAppAuthenticationSecret('JBSWY3DPEHPK3PXP');
|
||||||
|
|
||||||
|
return $editor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param list<array<string, mixed>|null> $widgets
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
private function sectionState(string $layout, array $widgets): array
|
||||||
|
{
|
||||||
|
$slots = [];
|
||||||
|
foreach ($widgets as $widget) {
|
||||||
|
$slots[(string) Str::uuid()] = ['widget' => $widget === null ? [] : [(string) Str::uuid() => $widget]];
|
||||||
|
}
|
||||||
|
|
||||||
|
return ['id' => null, 'layout' => $layout, 'style' => [], 'slots' => $slots];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -184,7 +184,7 @@ public function test_every_widget_renders_in_each_supported_width_and_rejects_th
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->assertSame(['u4', 'u2_2', 'u1_3', 'u3_1', 'u1_2_1', 'u1_1_1_1'], array_keys(SectionLayouts::UNITS));
|
$this->assertSame(['u4', 'u2_2', 'u1_3', 'u3_1', 'u1_2_1', 'u1_1_1_1', 'u1_1_2', 'u2_1_1'], array_keys(SectionLayouts::UNITS), 'Raster werden nur ergänzt (v1.7: 1 + 1 + 2 und 2 + 1 + 1 für gemischte Kartenraster).');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_fill_height_marks_the_widget_and_defaults_to_content_height(): void
|
public function test_fill_height_marks_the_widget_and_defaults_to_content_height(): void
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ private function heading(string $text): array
|
|||||||
|
|
||||||
public function test_required_layouts_exist_with_at_most_four_units(): void
|
public function test_required_layouts_exist_with_at_most_four_units(): void
|
||||||
{
|
{
|
||||||
$this->assertSame(['u4', 'u2_2', 'u1_3', 'u3_1', 'u1_2_1', 'u1_1_1_1'], array_keys(SectionLayouts::UNITS));
|
$this->assertSame(['u4', 'u2_2', 'u1_3', 'u3_1', 'u1_2_1', 'u1_1_1_1', 'u1_1_2', 'u2_1_1'], array_keys(SectionLayouts::UNITS), 'Raster werden nur ergänzt (v1.7: 1 + 1 + 2 und 2 + 1 + 1 für gemischte Kartenraster).');
|
||||||
|
|
||||||
foreach (SectionLayouts::UNITS as $key => $units) {
|
foreach (SectionLayouts::UNITS as $key => $units) {
|
||||||
$this->assertSame(4, array_sum($units), $key);
|
$this->assertSame(4, array_sum($units), $key);
|
||||||
@@ -45,6 +45,8 @@ public function test_required_layouts_exist_with_at_most_four_units(): void
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->assertSame('1 + 2 + 1', SectionLayouts::short('u1_2_1'));
|
$this->assertSame('1 + 2 + 1', SectionLayouts::short('u1_2_1'));
|
||||||
|
$this->assertSame('1 + 1 + 2', SectionLayouts::short('u1_1_2'));
|
||||||
|
$this->assertSame(['lg' => 'minmax(0, 1fr) minmax(0, 1fr) minmax(0, 2fr)', 'md' => 'minmax(0, 1fr)'], SectionLayouts::columns(SectionLayouts::units('u1_1_2')));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_columns_follow_the_units_and_stack_unequal_layouts_on_tablets(): void
|
public function test_columns_follow_the_units_and_stack_unequal_layouts_on_tablets(): void
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public function test_all_configured_widgets_are_registered_with_complete_contrac
|
|||||||
$types = $this->registry()->all();
|
$types = $this->registry()->all();
|
||||||
|
|
||||||
$this->assertSame(
|
$this->assertSame(
|
||||||
['hero', 'heading', 'prose', 'image_text', 'cards', 'catalog_cards', 'call_to_action', 'faq'],
|
['hero', 'heading', 'prose', 'image_text', 'cards', 'catalog_cards', 'topic_card', 'media_card', 'program_card', 'call_to_action', 'faq'],
|
||||||
array_keys($types),
|
array_keys($types),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user