Führe eine zentrale Widget-Registry mit visuellem Seiteneditor ein.
CI Feature / test (push) Successful in 31s

- Codebasiertes Widget-Register (config/cms.php) mit Vertrag
  {id, type, v, variant, settings, data, refs}: Typkennung, Schemaversion,
  Prüfregeln, freigegebene Varianten, Editorfelder, Blade-Ansicht,
  Verweisauflösung und Medienliste je Widget-Art.
- Die sechs Bestandsbausteine bleiben als Version 1 lesbar; gespeicherte
  Revisionen werden nicht umgeschrieben, sondern beim Lesen angehoben
  (Bild und Text: Version 2 mit Titel, formatiertem Text, Bild links/rechts).
  Wiederherstellen kopiert eine Revision unverändert.
- Neue Widgets: Einstieg (Hero) und Programm-/Modulkarten. Letztere speichern
  nur Verweise; Titel und Kurzbeschreibung kommen aus den Fachdaten. Öffentlich
  erscheinen nur Programme mit Anzeigefreigabe (gleiche Regel wie /programme,
  jetzt in PublicCatalogReader); Module nur in der Redaktionsvorschau, bis
  öffentliche Profile (ADR-29) bestehen.
- Ein Renderer für öffentliche Seite, Vorschau und Blockvorschau im Editor.
- Seiteneditor als Filament-Builder: Auswahl mit Beschreibung und Schema,
  kompakte Abschnitte mit Vorschau, Bearbeitung im Dialog, Sortieren,
  Duplizieren. Speichern erzeugt nur einen Entwurf.
- Vorschau einer Revision in 390/768/1440 px; Vorschauroute nutzt den
  Personal-Guard (vorher war sie für Redakteure ohne Mitgliedersitzung
  nicht erreichbar).
- Basislayout in Komponenten (Marke, Kopf, Fuß, Seitenvorlage).
- Navigation: bearbeiten, ausblenden, löschen, per Ziehen sortieren;
  unsichere Adressen (javascript:) werden abgewiesen und nicht ausgegeben.
  Ergänzende Migration is_visible (Vorgabe sichtbar).
- Pfadfehler und doppelte Pfade erscheinen am Pfadfeld statt still zu scheitern.

Tests: BlockRegistryTest geht in WidgetRegistryTest auf (gleiche Prüfungen
plus Registrierung, Versionierung, Bereinigung). Bestandsseiten werden gegen
Textfixtures aus dem Stand vor der Umstellung geprüft.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Opus 5.5 committed 2026-11-17 17:49:30 +01:00
1 parent cfdd6de0c7
commit 9d936bfa4a
76 files changed
+4237 -475

No files matched your search

+209 -2
View File
@@ -235,9 +235,21 @@ .image-text {
@media (min-width: 48rem) {
.image-text {
grid-template-columns: minmax(12rem, 16rem) 1fr;
grid-template-columns: minmax(12rem, 22rem) 1fr;
align-items: start;
}
.image-text-right {
grid-template-columns: 1fr minmax(12rem, 22rem);
}
.image-text-right > img {
order: 2;
}
.image-text-no-image {
grid-template-columns: 1fr;
}
}
.image-text img {
@@ -245,6 +257,184 @@ .image-text img {
height: auto;
}
.image-text-copy > :first-child {
margin-top: 0;
}
.prose ul,
.prose ol {
margin: 0 0 1rem;
padding-left: 1.4rem;
}
.prose li > p {
margin: 0;
}
/* Widgets: Einstieg (Hero). Varianten: standard, highlight. */
.hero {
display: grid;
gap: 1.5rem;
align-items: center;
}
.hero .lede {
font-size: 1.2rem;
}
.hero-image {
width: 100%;
height: auto;
display: block;
}
@media (min-width: 48rem) {
.hero-with-image {
grid-template-columns: 1.1fr 1fr;
}
}
.hero-highlight {
background: var(--color-ink);
color: #f4f7f5;
padding: clamp(1.5rem, 4vw, 3rem);
}
.hero-highlight h1,
.hero-highlight h2,
.hero-highlight .lede {
color: inherit;
}
.button {
display: inline-block;
margin-top: 0.5rem;
background: var(--color-pine);
color: #ffffff;
text-decoration: none;
padding: 0.65rem 1.05rem;
font-weight: 600;
}
.button:hover {
text-decoration: underline;
}
.hero-highlight .button {
background: #f4f7f5;
color: var(--color-ink);
}
/* Widgets: redaktionelle Karten. Varianten: Raster (cards-grid), kompakte Liste (cards-compact). */
.card-image {
display: block;
width: calc(100% + 2rem);
max-width: none;
height: auto;
aspect-ratio: 16 / 9;
object-fit: cover;
margin: -1rem -1rem 0.85rem;
}
.cards-compact {
grid-template-columns: 1fr;
gap: 0;
}
.cards-compact .card {
border-top: 0;
border-bottom: 1px solid var(--color-line);
background: transparent;
padding: 0.85rem 0;
}
.cards-compact .card-image {
display: none;
}
.cards-compact .card h3 {
font-size: 1.15rem;
}
/* Widgets: Programm- und Modulkarten. Inhalte kommen aus den Fachdaten. */
.catalog-list {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
gap: 1rem;
list-style: none;
padding: 0;
margin: 1rem 0 0;
}
.catalog-card {
background: white;
border: 1px solid var(--color-line);
display: flex;
flex-direction: column;
}
.catalog-card-visual {
background: var(--color-paper);
border-bottom: 3px solid var(--color-pine);
min-height: 6rem;
display: flex;
align-items: flex-end;
padding: 0.75rem 1rem;
}
.catalog-card-visual span {
font-family: var(--font-serif);
font-size: 1.1rem;
color: var(--color-pine);
}
.catalog-card-body {
padding: 0.9rem 1rem 1.1rem;
}
.catalog-card-body h3 {
font-family: var(--font-serif);
font-size: 1.35rem;
margin: 0 0 0.4rem;
}
.catalog-card-body p {
margin: 0 0 0.5rem;
}
.catalog-card-kind {
font-size: 0.85rem;
text-transform: uppercase;
letter-spacing: 0.06em;
color: #3f5248;
}
.catalog-cards-compact .catalog-list {
grid-template-columns: 1fr;
gap: 0;
}
.catalog-cards-compact .catalog-card {
border-width: 0 0 1px;
background: transparent;
}
.catalog-cards-compact .catalog-card-body {
padding: 0.75rem 0;
}
.catalog-card-internal {
border-style: dashed;
}
.preview-note {
background: #fff4d6;
color: #3d2e04;
font-size: 0.9rem;
padding: 0.5rem 0.75rem;
margin: 0.5rem 0 0;
}
.faq {
margin: 0;
}
@@ -382,9 +572,26 @@ .site-footer {
padding: 2rem 0 3rem;
}
.site-footer-inner {
display: flex;
flex-wrap: wrap;
gap: 1rem 2rem;
align-items: baseline;
justify-content: space-between;
}
.wordmark-compact {
padding-top: 0;
}
.wordmark-compact strong {
font-size: 1.5rem;
}
.site-footer nav {
display: flex;
gap: 1rem;
flex-wrap: wrap;
gap: 0.5rem 1rem;
}
.site-footer a {
@@ -0,0 +1,10 @@
{{--
Markenzeichen der Website. Solange keine freigegebene Wortmarke als Datei vorliegt
(docs/Brand-UI-Kit/README.md, Abschnitt Markenleitlinien Nr. 5), bleibt es die Textwortmarke.
Eine freigegebene Datei wird ausschließlich hier eingesetzt.
--}}
@props(['compact' => false])
<div {{ $attributes->class(['wordmark', 'wordmark-compact' => $compact]) }}>
<a href="{{ route('home') }}"><strong>Lara &amp; Felix</strong></a>
<span>Stark im Alltag</span>
</div>
@@ -0,0 +1,13 @@
@props(['navigation'])
<footer class="site-footer">
<div class="site-footer-inner">
<x-site.brand compact />
<nav aria-label="Rechtliches und Service">
@foreach ($navigation->where('placement', 'footer') as $item)
@if ($item->href())
<a href="{{ $item->href() }}">{{ $item->label }}</a>
@endif
@endforeach
</nav>
</div>
</footer>
@@ -0,0 +1,18 @@
@props(['navigation', 'page' => null])
<header class="masthead">
<div class="masthead-inner">
<x-site.brand />
<nav class="site-nav" aria-label="Hauptnavigation">
@foreach ($navigation->where('placement', 'header') as $item)
@if ($item->href())
<a href="{{ $item->href() }}" @if($page !== null && $item->page_id === $page->id) aria-current="page" @endif>{{ $item->label }}</a>
@endif
@endforeach
@auth('web')
<a href="{{ route('member.dashboard') }}">Mitgliederbereich</a>
@else
<a href="{{ route('register') }}">Registrieren</a>
@endauth
</nav>
</div>
</header>
@@ -0,0 +1,9 @@
<style>
.luf-widget-pick { display: flex; gap: .75rem; align-items: flex-start; text-align: start; white-space: normal; }
.luf-widget-pick-schematic { flex: none; border: 1px solid rgb(0 0 0 / 12%); border-radius: 3px; }
.luf-widget-pick-text { display: flex; flex-direction: column; gap: .15rem; }
.luf-widget-pick-name { font-weight: 600; }
.luf-widget-pick-desc { font-size: .8rem; line-height: 1.3; opacity: .8; }
.luf-widget-preview-frame { display: block; width: 100%; min-height: 4rem; border: 0; pointer-events: none; background: #f7faf8; }
.luf-widget-preview-empty { margin: 0; padding: 1rem; font-size: .875rem; opacity: .75; }
</style>
@@ -0,0 +1,22 @@
{{--
Blockvorschau im Seiteneditor. Das Widget wird mit derselben Ansicht wie auf der öffentlichen Seite gerendert
und in einem eigenen Dokument angezeigt, damit Website- und Verwaltungsstile sich nicht überlagern.
--}}
@php
$document = '<!DOCTYPE html><html lang="de"><head><meta charset="utf-8"><base target="_blank">'
.$stylesheets
.'<style>html{background:var(--color-sheet,#f7faf8)}body{margin:0;padding:1.25rem 1.5rem;min-height:0}main{display:block}</style>'
.'</head><body><main class="sheet-preview">'.$html.'</main></body></html>';
@endphp
@if (trim($html) === '')
<p class="luf-widget-preview-empty">Dieser Abschnitt zeigt öffentlich nichts an. Bitte Inhalte ergänzen.</p>
@else
<iframe
class="luf-widget-preview-frame"
title="Vorschau des Abschnitts"
tabindex="-1"
srcdoc="{{ $document }}"
loading="lazy"
onload="this.style.height = (this.contentDocument?.documentElement?.scrollHeight ?? 200) + 'px'"
></iframe>
@endif
+2 -31
View File
@@ -15,42 +15,13 @@
</head>
<body>
<a class="skip" href="#inhalt">Zum Inhalt</a>
<header class="masthead">
<div class="masthead-inner">
<div class="wordmark">
<a href="{{ route('home') }}"><strong>Lara &amp; Felix</strong></a>
<span>Stark im Alltag</span>
</div>
<nav class="site-nav" aria-label="Hauptnavigation">
@foreach (($navigation ?? collect())->where('placement', 'header') as $item)
@if ($item->href())
<a href="{{ $item->href() }}" @if(isset($page) && $item->page_id === $page->id) aria-current="page" @endif>{{ $item->label }}</a>
@endif
@endforeach
@auth
<a href="{{ route('member.dashboard') }}">Mitgliederbereich</a>
@else
<a href="{{ route('register') }}">Registrieren</a>
@endauth
</nav>
</div>
</header>
<x-site.header :navigation="$navigation ?? collect()" :page="$page ?? null" />
<main id="inhalt" class="sheet">
@if (session('status'))
<p class="status" role="status">{{ session('status') }}</p>
@endif
@yield('content')
</main>
<footer class="site-footer">
<div class="site-footer-inner">
<nav aria-label="Rechtliches und Service">
@foreach (($navigation ?? collect())->where('placement', 'footer') as $item)
@if ($item->href())
<a href="{{ $item->href() }}">{{ $item->label }}</a>
@endif
@endforeach
</nav>
</div>
</footer>
<x-site.footer :navigation="$navigation ?? collect()" />
</body>
</html>
@@ -1,7 +0,0 @@
<div class="cta">
<h2>{{ $block['heading'] }}</h2>
@if (filled($block['text'] ?? null))
<p>{{ $block['text'] }}</p>
@endif
<a href="{{ $block['url'] }}">{{ $block['label'] }}</a>
</div>
@@ -1,19 +0,0 @@
<ul class="cards">
@foreach ($block['items'] as $item)
<li class="card">
@if (filled($item['url'] ?? null))
<a href="{{ $item['url'] }}">
<h3>{{ $item['title'] }}</h3>
@if (filled($item['text'] ?? null))
<p>{{ $item['text'] }}</p>
@endif
</a>
@else
<h3>{{ $item['title'] }}</h3>
@if (filled($item['text'] ?? null))
<p>{{ $item['text'] }}</p>
@endif
@endif
</li>
@endforeach
</ul>
@@ -1,6 +0,0 @@
<dl class="faq">
@foreach ($block['items'] as $item)
<dt>{{ $item['question'] }}</dt>
<dd>{{ $item['answer'] }}</dd>
@endforeach
</dl>
@@ -1,8 +0,0 @@
@if (! empty($first))
<h1>{{ $block['heading'] }}</h1>
@else
<h2>{{ $block['heading'] }}</h2>
@endif
@if (filled($block['intro'] ?? null))
<p class="lede">{{ $block['intro'] }}</p>
@endif
@@ -1,10 +0,0 @@
<div class="image-text">
@if (filled($block['image'] ?? null))
<img src="{{ route('media.public', ['path' => $block['image']]) }}" alt="{{ $block['alt'] }}">
@endif
<div class="prose">
@foreach (preg_split("/\n\s*\n/", trim($block['body'])) as $paragraph)
<p>{{ $paragraph }}</p>
@endforeach
</div>
</div>
@@ -1,5 +0,0 @@
<div class="prose">
@foreach (preg_split("/\n\s*\n/", trim($block['body'])) as $paragraph)
<p>{{ $paragraph }}</p>
@endforeach
</div>
+1 -11
View File
@@ -8,15 +8,5 @@
@if ($preview)
<p class="preview-banner" role="status">Vorschau einer unveröffentlichten Revision. Die öffentliche Seite bleibt unverändert.</p>
@endif
@foreach ($revision->blocks as $block)
<section class="block">
@include('public.blocks.'.$block['type'], ['block' => $block, 'first' => $loop->first])
</section>
@endforeach
@if ($page->path === '/' && ($themes ?? collect())->isNotEmpty())
<section class="block">
<h2>Themenbereiche</h2>
@include('public.themes.list', ['themes' => $themes])
</section>
@endif
@include($template, ['content' => $content, 'page' => $page, 'themes' => $themes ?? collect()])
@endsection
@@ -0,0 +1,58 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex, nofollow">
<title>Vorschau {{ $page->path }} · Revision {{ $revision->id }}</title>
<style>
:root { color-scheme: light; --ink: #1b2838; --line: #c5d2cb; --pine: #0f6e56; }
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Source Sans 3', 'Segoe UI', sans-serif; background: #dfe6e2; color: var(--ink); }
.bar { position: sticky; top: 0; z-index: 1; display: flex; flex-wrap: wrap; gap: .75rem 1.25rem; align-items: center; padding: .75rem 1rem; background: var(--ink); color: #f4f7f5; }
.bar strong { font-size: 1rem; }
.bar p { margin: 0; font-size: .9rem; }
.widths { display: flex; gap: .4rem; margin-left: auto; }
.widths button { font: inherit; border: 1px solid rgb(255 255 255 / 45%); background: transparent; color: inherit; padding: .35rem .8rem; border-radius: .25rem; cursor: pointer; }
.widths button[aria-pressed='true'] { background: #f4f7f5; color: var(--ink); }
.widths button:focus-visible, .bar a:focus-visible { outline: 3px solid #fcd10a; outline-offset: 2px; }
.bar a { color: inherit; }
.stage { overflow-x: auto; padding: 1.25rem 1rem 3rem; }
.device { margin-inline: auto; background: white; box-shadow: 0 1px 4px rgb(0 0 0 / 18%); transition: none; }
.device iframe { display: block; width: 100%; height: calc(100vh - 7rem); min-height: 36rem; border: 0; }
.size { text-align: center; font-size: .85rem; margin: 0 0 .5rem; }
</style>
</head>
<body>
<div class="bar">
<strong>Vorschau {{ $page->path }}</strong>
<p>Revision {{ $revision->id }} · {{ $isLive ? 'veröffentlicht' : 'nicht veröffentlicht' }}</p>
<div class="widths" role="group" aria-label="Ansichtsbreite">
<button type="button" data-width="390" aria-pressed="false">Smartphone 390 px</button>
<button type="button" data-width="768" aria-pressed="false">Tablet 768 px</button>
<button type="button" data-width="1440" aria-pressed="true">Desktop 1440 px</button>
</div>
<p><a href="{{ route('pages.preview', $revision) }}" target="_blank" rel="noopener">Ohne Rahmen öffnen</a></p>
</div>
<div class="stage">
<p class="size" id="preview-size" aria-live="polite">Desktop, 1440 px</p>
<div class="device" id="preview-device" style="width: 1440px">
<iframe src="{{ route('pages.preview', $revision) }}" title="Seitenvorschau {{ $page->path }}"></iframe>
</div>
</div>
<script>
(() => {
const names = { 390: 'Smartphone', 768: 'Tablet', 1440: 'Desktop' };
const device = document.getElementById('preview-device');
const size = document.getElementById('preview-size');
const buttons = document.querySelectorAll('[data-width]');
buttons.forEach((button) => button.addEventListener('click', () => {
const width = Number(button.dataset.width);
device.style.width = width + 'px';
size.textContent = names[width] + ', ' + width + ' px';
buttons.forEach((other) => other.setAttribute('aria-pressed', String(other === button)));
}));
})();
</script>
</body>
</html>
@@ -0,0 +1,10 @@
{{-- Seitenvorlage „standard“: Widgets in voller Inhaltsbreite untereinander. --}}
<div class="page-template page-template-standard">
{{ $content }}
@if ($page->path === '/' && $themes->isNotEmpty())
<section class="block">
<h2>Themenbereiche</h2>
@include('public.themes.list', ['themes' => $themes])
</section>
@endif
</div>
@@ -0,0 +1,9 @@
<div class="cta">
<h2>{{ $data['heading'] ?? '' }}</h2>
@if (filled($data['text'] ?? null))
<p>{{ $data['text'] }}</p>
@endif
@if (\App\Domain\Cms\Widgets\Support\SafeUrl::isSafe($data['url'] ?? null))
<a href="{{ $data['url'] }}">{{ $data['label'] ?? '' }}</a>
@endif
</div>
+27
View File
@@ -0,0 +1,27 @@
@if ($items !== [])
<ul class="cards cards-{{ $variant === 'compact' ? 'compact' : 'grid' }}">
@foreach ($items as $item)
<li class="card @if ($item['imageUrl']) card-with-image @endif">
@if ($item['url'])
<a href="{{ $item['url'] }}">
@if ($item['imageUrl'])
<img class="card-image" src="{{ $item['imageUrl'] }}" alt="" loading="lazy">
@endif
<h3>{{ $item['title'] }}</h3>
@if (filled($item['text']))
<p>{{ $item['text'] }}</p>
@endif
</a>
@else
@if ($item['imageUrl'])
<img class="card-image" src="{{ $item['imageUrl'] }}" alt="" loading="lazy">
@endif
<h3>{{ $item['title'] }}</h3>
@if (filled($item['text']))
<p>{{ $item['text'] }}</p>
@endif
@endif
</li>
@endforeach
</ul>
@endif
@@ -0,0 +1,39 @@
@if ($entries !== [] || $context->preview)
<div class="catalog-cards catalog-cards-{{ $variant === 'compact' ? 'compact' : 'standard' }}">
@if (filled($data['heading'] ?? null))
<h2>{{ $data['heading'] }}</h2>
@endif
@if (filled($data['intro'] ?? null))
<p class="lede">{{ $data['intro'] }}</p>
@endif
@if ($entries === [])
<p class="preview-note">Noch kein Programm oder Modul gewählt, oder keines ist öffentlich sichtbar. Öffentlich erscheint dieser Abschnitt nicht.</p>
@else
<ul class="catalog-list">
@foreach ($entries as $entry)
<li class="catalog-card @unless ($entry->public) catalog-card-internal @endunless">
@if ($variant !== 'compact')
<div class="catalog-card-visual" aria-hidden="true"><span>{{ $entry->kindLabel }}</span></div>
@endif
<div class="catalog-card-body">
<p class="catalog-card-kind">{{ $entry->kindLabel }}</p>
<h3>
@if ($entry->url)
<a href="{{ $entry->url }}">{{ $entry->title }}</a>
@else
{{ $entry->title }}
@endif
</h3>
@if ($variant !== 'compact' && filled($entry->summary))
<p>{{ $entry->summary }}</p>
@endif
@unless ($entry->public)
<p class="preview-note">Nur in der Redaktionsvorschau sichtbar: Für diese Inhaltsart gibt es noch keine öffentliche Freigabe (öffentliches Profil, ADR-29).</p>
@endunless
</div>
</li>
@endforeach
</ul>
@endif
</div>
@endif
+6
View File
@@ -0,0 +1,6 @@
<dl class="faq">
@foreach ($data['items'] ?? [] as $item)
<dt>{{ $item['question'] ?? '' }}</dt>
<dd>{{ $item['answer'] ?? '' }}</dd>
@endforeach
</dl>
@@ -0,0 +1,8 @@
@if (! empty($first))
<h1>{{ $data['heading'] ?? '' }}</h1>
@else
<h2>{{ $data['heading'] ?? '' }}</h2>
@endif
@if (filled($data['intro'] ?? null))
<p class="lede">{{ $data['intro'] }}</p>
@endif
+18
View File
@@ -0,0 +1,18 @@
<div class="hero hero-{{ $variant === 'highlight' ? 'highlight' : 'standard' }} @if ($imageUrl) hero-with-image @endif">
<div class="hero-copy">
@if (! empty($first))
<h1>{{ $data['heading'] ?? '' }}</h1>
@else
<h2>{{ $data['heading'] ?? '' }}</h2>
@endif
@if (filled($data['text'] ?? null))
<p class="lede">{{ $data['text'] }}</p>
@endif
@if ($action)
<a class="button" href="{{ $action['url'] }}">{{ $action['label'] }}</a>
@endif
</div>
@if ($imageUrl)
<img class="hero-image" src="{{ $imageUrl }}" alt="{{ $data['alt'] ?? '' }}">
@endif
</div>
@@ -0,0 +1,15 @@
<div class="image-text image-text-{{ $variant === 'image_right' ? 'right' : 'left' }} @unless ($imageUrl) image-text-no-image @endunless">
@if ($imageUrl)
<img src="{{ $imageUrl }}" alt="{{ $data['alt'] ?? '' }}" loading="lazy">
@endif
<div class="image-text-copy">
@if (filled($data['title'] ?? null))
@if (! empty($first))
<h1>{{ $data['title'] }}</h1>
@else
<h2>{{ $data['title'] }}</h2>
@endif
@endif
<div class="prose">{!! $body !!}</div>
</div>
</div>
+7
View File
@@ -0,0 +1,7 @@
@if (filled($data['body'] ?? null))
<div class="prose">
@foreach (preg_split("/\n\s*\n/", trim($data['body'])) as $paragraph)
<p>{{ $paragraph }}</p>
@endforeach
</div>
@endif