Führe Abschnitte mit Raster, gemeinsames Designsystem und globales Website-Gerüst ein.
CI Feature / test (push) Failing after 20s
CI Feature / test (push) Failing after 20s
- Seite → Abschnitte → Plätze → Widgets: sechs Raster mit höchstens vier Einheiten, Hintergrund, Breite, Abstand und Trenner als Aufzählungswerte; je Platz ein Widget aus dem bestehenden Register. Neue Spalte page_revisions.sections (ergänzend); blocks erhält weiterhin alle Widgets in Lesereihenfolge als Rollback-Fassung. - Widgets erhalten Mindest- und Vorzugsbreite; Darstellung über Container-Abfragen. - Editor: Abschnitts-Repeater mit grafischer Rasterauswahl, Plätzen im Rasterverhältnis, breiter Arbeitsfläche, kompakten Vorschauen ohne Bildlaufleiste, Meldungen mit Abschnitt und Platz; Rasterwechsel entfernt nie ein Widget. Seite duplizieren. - Designsystem: Marken- und Bedeutungs-Tokens (vorläufig), gemeinsame Grundkomponenten, Nunito/Source Sans 3 lokal; Mitgliederbereich nutzt dieselben Tokens und die Wortmarke. - Kopfzeile, mobile Navigation, Untermenü (parent_id, ergänzend), Fußbereichsgruppen, vorbereiteter Warenkorbzugang (abgeschaltet). Öffentliche Seiten gleich für alle Besucher. - cms:revert-published als Wiederherstellungsweg vor einem Code-Rollback. Die Editor-Tests der ersten Iteration sind bewusst auf den neuen Formularzustand (sections statt blocks) umgestellt; ihre Prüfungen gelten unverändert für die Widgets. Der Vorschautest erwartet keine anmeldeabhängige Kopfzeile mehr (ADR-32). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
db4bd30319
commit
480d55989b
57 files changed
+4730
-818
No files matched your search
@@ -4,11 +4,13 @@
|
||||
|
||||
use App\Domain\Catalog\Pillar;
|
||||
use App\Domain\Cms\Page;
|
||||
use App\Domain\Cms\PageService;
|
||||
use App\Filament\Resources\Pages\Pages\CreatePage;
|
||||
use App\Filament\Resources\Pages\Pages\EditPage;
|
||||
use App\Filament\Resources\Pages\Pages\ListPages;
|
||||
use App\Filament\Resources\Pages\RelationManagers\RevisionsRelationManager;
|
||||
use App\Filament\Support\WidgetEditor;
|
||||
use App\Filament\Support\SectionEditor;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Forms\Components\CheckboxList;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
@@ -17,6 +19,7 @@
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
||||
class PageResource extends Resource
|
||||
{
|
||||
@@ -36,6 +39,8 @@ public static function form(Schema $schema): Schema
|
||||
Section::make('Seite und Suchmaschinen')
|
||||
->description('Adresse, Titel für Suchmaschinen und Zuordnung zu Themenbereichen.')
|
||||
->collapsible()
|
||||
->collapsed(fn (string $operation): bool => $operation === 'edit')
|
||||
->persistCollapsed()
|
||||
->columns(2)
|
||||
->columnSpanFull()
|
||||
->schema([
|
||||
@@ -55,13 +60,14 @@ public static function form(Schema $schema): Schema
|
||||
->label('Fachliche Säulen')
|
||||
->options(fn (): array => Pillar::query()->orderBy('name')->pluck('name', 'id')->all())
|
||||
->helperText('Eine veröffentlichte Seite erscheint auf den gewählten Themenbereichen der Website. Eine Seite kann mehreren Säulen zugeordnet sein.')
|
||||
->columns(1),
|
||||
->columns(['default' => 1, 'lg' => 2]),
|
||||
]),
|
||||
Section::make('Inhalt der Seite')
|
||||
->description('Abschnitte hinzufügen, per Klick auf die Vorschau bearbeiten, mit den Pfeilen sortieren. Speichern legt einen Entwurf an; veröffentlicht wird erst über „Veröffentlichen“.')
|
||||
->description('Abschnitt hinzufügen, Raster wählen, Widgets in die Plätze einsetzen. Ein Klick auf die Vorschau eines Widgets öffnet seinen Dialog; Hintergrund, Breite, Abstand und Trenner stehen unter „Gestaltung des Abschnitts“. Speichern legt einen Entwurf an; veröffentlicht wird erst über „Veröffentlichen“.')
|
||||
->columnSpanFull()
|
||||
->extraAttributes(['class' => 'luf-page-content'])
|
||||
->schema([
|
||||
WidgetEditor::builder('blocks'),
|
||||
SectionEditor::repeater('sections'),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
@@ -76,7 +82,34 @@ public static function table(Table $table): Table
|
||||
->formatStateUsing(fn ($state): string => $state ? 'Ja' : 'Entwurf'),
|
||||
TextColumn::make('updated_at')->label('Geändert')->dateTime('d.m.Y H:i'),
|
||||
])
|
||||
->recordUrl(fn (Page $record): string => static::getUrl('edit', ['record' => $record]));
|
||||
->recordUrl(fn (Page $record): string => static::getUrl('edit', ['record' => $record]))
|
||||
->recordActions([
|
||||
Action::make('duplicate')
|
||||
->label('Duplizieren')
|
||||
->icon('heroicon-o-document-duplicate')
|
||||
->color('gray')
|
||||
->tooltip('Neue, unveröffentlichte Seite mit dem zuletzt gespeicherten Stand dieser Seite anlegen')
|
||||
->authorize(fn (): bool => auth()->user()?->can('create', Page::class) ?? false)
|
||||
->modalHeading(fn (Page $record): string => 'Seite '.$record->path.' duplizieren')
|
||||
->modalDescription('Die Kopie ist ein Entwurf unter neuer Adresse. Die Vorlage bleibt unverändert.')
|
||||
->schema([
|
||||
TextInput::make('path')
|
||||
->label('Pfad der neuen Seite')
|
||||
->required()
|
||||
->maxLength(255)
|
||||
->helperText('Zum Beispiel /neue-landingpage'),
|
||||
])
|
||||
->modalSubmitActionLabel('Duplizieren')
|
||||
->action(function (Page $record, array $data, PageService $service) {
|
||||
try {
|
||||
$copy = $service->duplicate($record, $data['path'], auth()->user());
|
||||
} catch (ValidationException $exception) {
|
||||
throw ValidationException::withMessages(['mountedActions.0.data.path' => $exception->errors()['path'] ?? $exception->errors()]);
|
||||
}
|
||||
|
||||
return redirect(static::getUrl('edit', ['record' => $copy]));
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
|
||||
@@ -6,16 +6,23 @@
|
||||
use App\Domain\Cms\Page;
|
||||
use App\Domain\Cms\PageService;
|
||||
use App\Filament\Resources\Pages\PageResource;
|
||||
use App\Filament\Support\WidgetEditor;
|
||||
use App\Filament\Support\ReportsSectionErrors;
|
||||
use App\Filament\Support\SectionEditor;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
use Filament\Support\Enums\Width;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
||||
class CreatePage extends CreateRecord
|
||||
{
|
||||
use ReportsSectionErrors;
|
||||
|
||||
protected static string $resource = PageResource::class;
|
||||
|
||||
/** Breite Arbeitsfläche, damit mehrspaltige Raster im Editor erkennbar bleiben. */
|
||||
protected Width|string|null $maxContentWidth = Width::Full;
|
||||
|
||||
protected static bool $canCreateAnother = false;
|
||||
|
||||
/**
|
||||
@@ -24,17 +31,17 @@ class CreatePage extends CreateRecord
|
||||
protected function handleRecordCreation(array $data): Model
|
||||
{
|
||||
$service = app(PageService::class);
|
||||
$blocks = WidgetEditor::fromBuilderState($data['blocks'] ?? []);
|
||||
$content = SectionEditor::fromEditorState($data['sections'] ?? []);
|
||||
|
||||
try {
|
||||
return DB::transaction(function () use ($service, $data, $blocks): Page {
|
||||
return DB::transaction(function () use ($service, $data, $content): Page {
|
||||
$page = Page::query()->create([
|
||||
'path' => $service->availablePath($data['path']),
|
||||
]);
|
||||
|
||||
$service->saveRevision(
|
||||
$page,
|
||||
$blocks,
|
||||
$content,
|
||||
$data['seo_title'] ?? null,
|
||||
$data['seo_description'] ?? null,
|
||||
auth()->user(),
|
||||
@@ -45,10 +52,10 @@ protected function handleRecordCreation(array $data): Model
|
||||
return $page;
|
||||
});
|
||||
} catch (ValidationException $exception) {
|
||||
WidgetEditor::notifyErrors($exception->errors(), $blocks);
|
||||
SectionEditor::notifyErrors($exception->errors(), $this->data['sections'] ?? []);
|
||||
|
||||
throw ValidationException::withMessages(
|
||||
WidgetEditor::mapErrors($exception->errors(), array_keys($this->data['blocks'] ?? [])),
|
||||
SectionEditor::mapErrors($exception->errors(), $this->data['sections'] ?? []),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,17 +6,24 @@
|
||||
use App\Domain\Cms\Page;
|
||||
use App\Domain\Cms\PageService;
|
||||
use App\Filament\Resources\Pages\PageResource;
|
||||
use App\Filament\Support\WidgetEditor;
|
||||
use App\Filament\Support\ReportsSectionErrors;
|
||||
use App\Filament\Support\SectionEditor;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
use Filament\Support\Enums\Width;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
||||
class EditPage extends EditRecord
|
||||
{
|
||||
use ReportsSectionErrors;
|
||||
|
||||
protected static string $resource = PageResource::class;
|
||||
|
||||
/** Breite Arbeitsfläche, damit mehrspaltige Raster im Editor erkennbar bleiben. */
|
||||
protected Width|string|null $maxContentWidth = Width::Full;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
@@ -85,7 +92,7 @@ protected function afterSave(): void
|
||||
protected function mutateFormDataBeforeFill(array $data): array
|
||||
{
|
||||
$revision = $this->record->latestRevision ?? $this->record->publishedRevision;
|
||||
$data['blocks'] = WidgetEditor::toBuilderState($revision?->blocks);
|
||||
$data['sections'] = SectionEditor::toEditorState($revision?->sections() ?? []);
|
||||
$data['seo_title'] = $revision?->seo_title;
|
||||
$data['seo_description'] = $revision?->seo_description;
|
||||
$data['pillars'] = $this->record->pillars()->pluck('pillars.id')->all();
|
||||
@@ -100,16 +107,16 @@ protected function handleRecordUpdate(Model $record, array $data): Model
|
||||
{
|
||||
/** @var Page $record */
|
||||
$service = app(PageService::class);
|
||||
$blocks = WidgetEditor::fromBuilderState($data['blocks'] ?? []);
|
||||
$content = SectionEditor::fromEditorState($data['sections'] ?? []);
|
||||
|
||||
try {
|
||||
$path = $service->availablePath($data['path'], $record);
|
||||
$service->saveRevision($record, $blocks, $data['seo_title'] ?? null, $data['seo_description'] ?? null, auth()->user());
|
||||
$service->saveRevision($record, $content, $data['seo_title'] ?? null, $data['seo_description'] ?? null, auth()->user());
|
||||
} catch (ValidationException $exception) {
|
||||
WidgetEditor::notifyErrors($exception->errors(), $blocks);
|
||||
SectionEditor::notifyErrors($exception->errors(), $this->data['sections'] ?? []);
|
||||
|
||||
throw ValidationException::withMessages(
|
||||
WidgetEditor::mapErrors($exception->errors(), array_keys($this->data['blocks'] ?? [])),
|
||||
SectionEditor::mapErrors($exception->errors(), $this->data['sections'] ?? []),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,8 +24,11 @@ public function table(Table $table): Table
|
||||
TextColumn::make('id')->label('Nr.'),
|
||||
TextColumn::make('created_at')->label('Gespeichert')->dateTime('d.m.Y H:i'),
|
||||
TextColumn::make('author.name')->label('Von'),
|
||||
TextColumn::make('sections')
|
||||
TextColumn::make('section_count')
|
||||
->label('Abschnitte')
|
||||
->state(fn (PageRevision $record): int => count($record->sections())),
|
||||
TextColumn::make('widget_count')
|
||||
->label('Widgets')
|
||||
->state(fn (PageRevision $record): int => count($record->widgets())),
|
||||
TextColumn::make('published')
|
||||
->label('Live')
|
||||
|
||||
Reference in new issue
Block a user