Nimm die kleine Filmstufe für die Titelbildwahl und verankere Hinweise ohne neue Fassung.
Deploy Test / test (push) Successful in 24s
Deploy Test / deploy (push) Successful in 28s

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-11-16 21:17:35 +01:00
1 parent c47c3b9b32
commit f86032cb5f
14 files changed
+283 -46

No files matched your search

@@ -65,6 +65,15 @@ abstract class EditComposition extends EditRecord
public string $roleDraft = '';
public string $noteDraft = '';
public string $imageCaptionText = '';
public ?string $thumbnailSource = null;
/** @var list<array{version_id: int, title: string, label: string, file_url: ?string}> */
public array $frameFilmChoices = [];
public string $panel = 'angaben';
public bool $pickerOpen = false;
@@ -685,6 +694,7 @@ public function addPart(string $target): void
}
$row['role'] = app(EditorialCatalog::class)->defaultRole((string) $row['kind']);
$row['note'] = '';
$this->members[] = $row;
$this->members = array_values($this->members);
$this->selected = array_key_last($this->members);
@@ -711,6 +721,7 @@ public function removePart(int $index): void
$this->members = array_values($this->members);
$this->selected = null;
$this->roleDraft = '';
$this->noteDraft = '';
$this->panel = 'angaben';
$this->partOpen = false;
$this->partSnapshot = [];
@@ -750,6 +761,7 @@ public function useVersion(int $index, string $target): void
$this->commitRoleDraft();
$row['role'] = $this->members[$index]['role'] ?? $row['kind'];
$row['note'] = $this->members[$index]['note'] ?? '';
$this->members[$index] = $row;
$this->syncRoleDraft();
$this->feedback = $row['version_label'].' ist für diese Stelle ausgewählt. Der Entwurf speichert das. Eine freigegebene Fassung bleibt unverändert.';
@@ -845,7 +857,8 @@ public function openModule(): void
$this->partOpen = false;
$this->textOpen = false;
$this->moduleTab = 'beschreibung';
$films = $this->frameFilms();
$this->frameFilmChoices = $this->frameFilms();
$films = $this->frameFilmChoices;
$this->imageMode = $films === [] ? 'bestand' : 'film';
if ($films !== [] && $this->frameVersionId === null) {
@@ -982,20 +995,31 @@ public function framePreviewUrl(): ?string
public function imageCaption(): ?string
{
/** @var Composition $composition */
$composition = $this->getRecord();
$composition->refresh();
$source = $composition->thumbnail_source;
return $this->imageCaptionText !== '' ? $this->imageCaptionText : null;
}
protected function captionFor(mixed $source): string
{
if (! is_string($source) || $source === '') {
return null;
return '';
}
if (preg_match('/^frame:(\d+)@([\d.]+)$/', $source, $match) === 1) {
$version = ContentElementVersion::query()->with('element')->find($match[1]);
$title = $version?->element?->working_title ?: 'dem Film';
$title = null;
return 'Titelbild aus '.$title.' bei '.$match[2].' Sekunden.';
foreach ($this->members as $member) {
if (($member['target'] ?? '') === 'element:'.$match[1]) {
$title = $member['title'] ?? null;
break;
}
}
if ($title === null) {
$version = ContentElementVersion::query()->with('element')->find($match[1]);
$title = $version?->element?->working_title;
}
return 'Titelbild aus '.($title ?: 'dem Film').' bei '.$match[2].' Sekunden.';
}
if ($source === 'eigen') {
@@ -1006,7 +1030,13 @@ public function imageCaption(): ?string
return 'Titelbild aus einem vorhandenen Bild.';
}
return null;
return '';
}
protected function rememberCaption(Composition $record): void
{
$this->thumbnailSource = $record->thumbnail_source;
$this->imageCaptionText = $this->captionFor($record->thumbnail_source);
}
public function savePreview(): void
@@ -1064,6 +1094,7 @@ public function adoptPicture(int $elementId): void
$record->refresh();
$this->thumbnailPath = $record->thumbnail_path;
$this->thumbnailError = $record->thumbnail_error;
$this->rememberCaption($record);
$this->feedback = $this->previewFeedback($record, $before);
}
@@ -1172,7 +1203,11 @@ public function publishRevision(): bool
return false;
}
$payload[] = ['role' => $role, 'target' => $model];
$payload[] = [
'role' => $role,
'target' => $model,
'note' => trim((string) ($member['note'] ?? '')),
];
}
/** @var Composition $record */
@@ -1258,6 +1293,8 @@ protected function loadEditor(): void
$this->thumbnailPath = $composition->thumbnail_path;
$this->thumbnailAlt = (string) ($composition->thumbnail_alt ?? '');
$this->thumbnailError = $composition->thumbnail_error;
$this->thumbnailSource = $composition->thumbnail_source;
$this->imageCaptionText = $this->captionFor($composition->thumbnail_source);
$this->dimensionIds = IdentityDimensionValue::query()
->where('subject_type', $composition->getMorphClass())
->where('subject_id', $composition->id)
@@ -1313,6 +1350,7 @@ protected function applyDraft(array $draft): void
}
$row['role'] = (string) ($member['role'] ?? $row['kind']);
$row['note'] = trim((string) ($member['note'] ?? ''));
$rows[] = $row;
}
@@ -1323,6 +1361,7 @@ protected function applyDraft(array $draft): void
$this->revisionNote = (string) ($draft['revision_note'] ?? '');
$this->selected = null;
$this->roleDraft = '';
$this->noteDraft = '';
$this->panel = 'angaben';
if ($requested > count($rows) && $this->feedback === '') {
@@ -1338,6 +1377,7 @@ protected function applyVersion(CompositionVersion $version): void
$this->materialNote = (string) ($version->material_note ?? '');
$this->selected = null;
$this->roleDraft = '';
$this->noteDraft = '';
$this->panel = 'angaben';
}
@@ -1353,13 +1393,14 @@ protected function commitRoleDraft(?string $value = null): void
}
$this->members[$this->selected]['role'] = trim($value ?? $this->roleDraft);
$this->members[$this->selected]['note'] = trim($this->noteDraft);
}
protected function syncRoleDraft(): void
{
$this->roleDraft = $this->selected !== null && isset($this->members[$this->selected])
? (string) ($this->members[$this->selected]['role'] ?? '')
: '';
$member = $this->selected !== null ? ($this->members[$this->selected] ?? null) : null;
$this->roleDraft = is_array($member) ? (string) ($member['role'] ?? '') : '';
$this->noteDraft = is_array($member) ? (string) ($member['note'] ?? '') : '';
}
public function releaseDisplay(): void
@@ -1421,10 +1462,10 @@ protected function sameMembers(CompositionVersion $version): bool
? 'element:'.$member->content_element_version_id
: 'composition:'.$member->nested_composition_version_id;
return $member->role.'|'.$target;
return $member->role.'|'.$target.'|'.trim((string) ($member->placement_note ?? ''));
})->all();
$next = array_values(array_map(
fn (array $member): string => trim((string) ($member['role'] ?? '')).'|'.($member['target'] ?? ''),
fn (array $member): string => trim((string) ($member['role'] ?? '')).'|'.($member['target'] ?? '').'|'.trim((string) ($member['note'] ?? '')),
$this->members,
));
@@ -1587,6 +1628,7 @@ protected function applyChosenImage(): string|false
$record->refresh();
$this->thumbnailPath = $record->thumbnail_path;
$this->thumbnailError = $record->thumbnail_error;
$this->rememberCaption($record);
$note = $this->previewFeedback($record, $before);
if (! str_contains($note, 'unverändert')) {
@@ -1616,6 +1658,7 @@ protected function storePreview(string $path): void
$record->refresh();
$this->thumbnailPath = $record->thumbnail_path;
$this->thumbnailError = $record->thumbnail_error;
$this->rememberCaption($record);
$this->feedback = $this->previewFeedback($record, $before);
}
@@ -1663,6 +1706,7 @@ protected function payload(): array
fn (array $member): array => [
'role' => trim((string) ($member['role'] ?? '')),
'target' => (string) ($member['target'] ?? ''),
'note' => trim((string) ($member['note'] ?? '')),
],
$members,
)),
@@ -1713,6 +1757,7 @@ protected function readyPayload(): array
fn (array $row): array => [
'role' => trim((string) ($row['role'] ?? '')),
'target' => (string) ($row['target'] ?? ''),
'note' => trim((string) ($row['note'] ?? '')),
],
$rows,
)),
@@ -1735,6 +1780,7 @@ protected function normalizePayload(array $payload): array
$members[] = [
'role' => trim((string) ($member['role'] ?? '')),
'target' => (string) ($member['target'] ?? ''),
'note' => trim((string) ($member['note'] ?? '')),
];
}
@@ -70,6 +70,9 @@ public static function table(Table $table): Table
fn (ContentElement $record): string => static::getUrl('view', ['record' => $record])
)->columns([
TextColumn::make('working_title')->label('Arbeitstitel')->searchable(),
TextColumn::make('summary')->label('Kurzbeschreibung')->limit(80),
TextColumn::make('usage_note')->label('Einsatzhinweis')->limit(80),
TextColumn::make('license_note')->label('Lizenzvermerk')->limit(40),
TextColumn::make('kind')->label('Art'),
TextColumn::make('pillar_names')->label('Säulen')->state(
fn (ContentElement $record): string => $record->pillars->pluck('name')->join(', ') ?: '—'
@@ -58,7 +58,11 @@ public function form(Schema $schema): Schema
->helperText('Erscheint in der Bibliothek. Leer lässt den Arbeitstitel stehen. Speichern legt keine Fassung an.'),
Textarea::make('summary')->label('Kurzbeschreibung')->rows(3),
Textarea::make('description')->label('Beschreibung')->rows(4)
->helperText('Gilt für das Medium, nicht für eine einzelne Fassung.'),
->helperText('Allgemeine Beschreibung des Mediums. Gilt nicht für eine einzelne Fassung und nicht nur für ein Modul.'),
Textarea::make('usage_note')->label('Hinweise für den Einsatz')->rows(4)
->helperText('Gilt für das Medium in jeder Verwendung. Speichern legt keine Fassung an.'),
Textarea::make('license_note')->label('Interner Lizenzvermerk')->rows(3)
->helperText('Nur in der Verwaltung sichtbar. Erscheint nicht in der Bibliothek und nicht auf der Website.'),
Select::make('editorial_content_kind_id')
->label('Inhaltsart')
->options(fn (): array => EditorialContentKind::selectOptions())
@@ -170,6 +174,8 @@ protected function mutateFormDataBeforeFill(array $data): array
'working_title' => $this->getRecord()->working_title,
'display_title' => $this->getRecord()->display_title,
'description' => $this->getRecord()->description,
'usage_note' => $this->getRecord()->usage_note,
'license_note' => $this->getRecord()->license_note,
'summary' => $this->getRecord()->summary,
'editorial_content_kind_id' => $this->getRecord()->editorial_content_kind_id,
'dimension_ids' => IdentityDimensionValue::query()
@@ -193,6 +199,8 @@ protected function handleRecordUpdate(Model $record, array $data): Model
app(IdentityProfile::class)->fill($record, [
'display_title' => $data['display_title'] ?? null,
'summary' => $data['summary'] ?? null,
'usage_note' => $data['usage_note'] ?? null,
'license_note' => $data['license_note'] ?? null,
], auth()->user());
if (array_key_exists('editorial_content_kind_id', $data)) {
$record->editorial_content_kind_id = filled($data['editorial_content_kind_id'] ?? null)
@@ -6,6 +6,7 @@
use App\Domain\Catalog\ContentElementVersion;
use App\Domain\Catalog\ContentService;
use App\Domain\Catalog\ContentVersionStatus;
use App\Domain\Catalog\IdentityProfile;
use App\Domain\Catalog\Pillar;
use App\Domain\Catalog\PillarService;
use App\Filament\Resources\ContentElements\ContentElementResource;
@@ -91,12 +92,17 @@ protected function getHeaderActions(): array
->fillForm(fn (): array => [
'working_title' => $this->getRecord()->working_title,
'description' => $this->getRecord()->description,
'usage_note' => $this->getRecord()->usage_note,
'license_note' => $this->getRecord()->license_note,
'pillars' => $this->getRecord()->pillars()->pluck('pillars.id')->all(),
])
->schema([
TextInput::make('working_title')->label('Arbeitstitel')->required(),
Textarea::make('description')->label('Beschreibung')->rows(4)
->helperText('Gilt für das Medium. Speichern legt keine neue Fassung an.'),
Textarea::make('usage_note')->label('Hinweise für den Einsatz')->rows(4),
Textarea::make('license_note')->label('Interner Lizenzvermerk')->rows(3)
->helperText('Nur in der Verwaltung. Nicht in der Bibliothek und nicht auf der Website.'),
CheckboxList::make('pillars')
->label('Fachliche Säulen')
->options(fn (): array => Pillar::query()->orderBy('name')->pluck('name', 'id')->all()),
@@ -106,6 +112,10 @@ protected function getHeaderActions(): array
/** @var ContentElement $element */
$element = $this->getRecord();
app(ContentService::class)->describe($element, (string) $data['working_title'], $data['description'] ?? null);
app(IdentityProfile::class)->fill($element, [
'usage_note' => $data['usage_note'] ?? null,
'license_note' => $data['license_note'] ?? null,
], auth()->user());
app(PillarService::class)->assign($element, array_map(intval(...), $data['pillars'] ?? []));
}, 'Die Beschreibung ist gespeichert.');
$this->getRecord()->refresh();
@@ -47,6 +47,7 @@ public function rows(CompositionVersion $version, int $exceptCompositionId): arr
}
$row['role'] = $member->role;
$row['note'] = trim((string) ($member->placement_note ?? ''));
$rows[] = $row;
}
@@ -80,6 +81,9 @@ public function rowForTarget(string $target, int $exceptCompositionId, bool $all
'title' => $title,
'kind' => $kind,
'summary' => (string) ($element->summary ?: $element->description ?: ''),
'medium_description' => (string) ($element->description ?? ''),
'usage_note' => (string) ($element->usage_note ?? ''),
'license_note' => (string) ($element->license_note ?? ''),
'tone' => $this->tone((string) $element->output_class, $kind),
'image' => $this->cardUrl('element', $element->id, $element->thumbnail_path),
'version_label' => 'Fassung '.$version->number,