diff --git a/app/Domain/Media/ThumbnailDeriver.php b/app/Domain/Media/ThumbnailDeriver.php
index 6be195c..dcd6ff6 100644
--- a/app/Domain/Media/ThumbnailDeriver.php
+++ b/app/Domain/Media/ThumbnailDeriver.php
@@ -58,6 +58,91 @@ public function forCompositionFromElement(Composition $composition, ContentEleme
$this->rememberChoice($composition, 'element:'.$element->id);
}
+ public function forCompositionFrame(Composition $composition, ContentElementVersion $version, float $seconds): void
+ {
+ $version->loadMissing('element');
+
+ if ($version->element?->output_class !== 'film') {
+ $this->failComposition($composition, 'Aus dieser Filmstelle ließ sich kein Titelbild erzeugen.');
+
+ return;
+ }
+
+ $bytes = $this->jpegAtVersion($version, $seconds);
+
+ if (! is_string($bytes)) {
+ $this->failComposition($composition, 'Aus dieser Filmstelle ließ sich kein Titelbild erzeugen.');
+
+ return;
+ }
+
+ $name = 'komposition-'.$composition->id;
+ $path = 'vorschau/'.$name.'.jpg';
+ Storage::disk('media_derived')->put($path, $bytes);
+ $this->still($composition, Storage::disk('media_derived'), $path, $name);
+ $this->rememberChoice($composition, 'frame:'.$version->id.'@'.$this->secondText($seconds));
+ }
+
+ public function jpegAtVersion(ContentElementVersion $version, float $seconds): ?string
+ {
+ $file = is_array($version->metadata) ? ($version->metadata['file'] ?? null) : null;
+
+ if (! is_string($file) || $file === '' || str_contains($file, '..') || ! str_starts_with($file, 'inhalte/')) {
+ return null;
+ }
+
+ if ($seconds < 0 || $seconds > 7200) {
+ return null;
+ }
+
+ $disk = Storage::disk('media_derived');
+
+ if (! $disk->exists($file)) {
+ return null;
+ }
+
+ $binary = (new ExecutableFinder)->find('ffmpeg');
+
+ if ($binary === null) {
+ return null;
+ }
+
+ $process = new Process([
+ $binary,
+ '-hide_banner',
+ '-loglevel',
+ 'error',
+ '-i',
+ $disk->path($file),
+ '-ss',
+ $this->secondText($seconds),
+ '-frames:v',
+ '1',
+ '-f',
+ 'image2pipe',
+ '-vcodec',
+ 'mjpeg',
+ 'pipe:1',
+ ]);
+ $process->setTimeout(30);
+ $process->run();
+ $bytes = $process->getOutput();
+
+ if (! $process->isSuccessful() || ! str_starts_with($bytes, "\xFF\xD8")) {
+ return null;
+ }
+
+ return $bytes;
+ }
+
+ private function secondText(float $seconds): string
+ {
+ $seconds = max(0, min(7200, $seconds));
+ $text = number_format($seconds, 3, '.', '');
+
+ return rtrim(rtrim($text, '0'), '.') ?: '0';
+ }
+
private function frame(ContentElement $element, string $file): void
{
$binary = (new ExecutableFinder)->find('ffmpeg');
diff --git a/app/Filament/Resources/Compositions/Pages/EditComposition.php b/app/Filament/Resources/Compositions/Pages/EditComposition.php
index e626f89..47132f6 100644
--- a/app/Filament/Resources/Compositions/Pages/EditComposition.php
+++ b/app/Filament/Resources/Compositions/Pages/EditComposition.php
@@ -20,6 +20,8 @@
use App\Domain\Catalog\IdentityProfile;
use App\Domain\Catalog\StructureNode;
use App\Filament\Support\EditorialCatalog;
+use App\Http\Controllers\ContentPreviewController;
+use App\Jobs\DeriveCompositionFrame;
use App\Jobs\DeriveThumbnail;
use App\Models\User;
use Filament\Actions\Action;
@@ -101,6 +103,26 @@ abstract class EditComposition extends EditRecord
public string $imageQuery = '';
+ public bool $moduleOpen = false;
+
+ public string $moduleTab = 'beschreibung';
+
+ public bool $partOpen = false;
+
+ public string $imageMode = 'film';
+
+ public string $imagePick = '';
+
+ public ?int $frameVersionId = null;
+
+ public string $frameSecond = '';
+
+ /** @var array */
+ public array $moduleSnapshot = [];
+
+ /** @var list> */
+ public array $partSnapshot = [];
+
/** @var list> */
public array $members = [];
@@ -260,6 +282,14 @@ public function hits(): array
public function openPicker(): void
{
+ if ($this->moduleOpen) {
+ $this->closeModule();
+ }
+
+ if ($this->partOpen) {
+ $this->closePart();
+ }
+
$this->pickerOpen = true;
$this->textOpen = false;
$this->pickerSelected = '';
@@ -296,15 +326,67 @@ public function pickerDetail(): ?array
return null;
}
- return app(EditorialCatalog::class)->rowForTarget(
+ $row = app(EditorialCatalog::class)->rowForTarget(
$this->pickerSelected,
(int) $this->getRecord()->getKey(),
);
+
+ if ($row === null) {
+ return null;
+ }
+
+ $row['file_url'] = null;
+
+ if (preg_match('/^element:(\d+)$/', (string) $row['target'], $match) === 1) {
+ $version = ContentElementVersion::query()->find($match[1]);
+ $row['file_url'] = $version instanceof ContentElementVersion
+ ? app(ContentPreviewController::class)->fileUrl($version)
+ : null;
+ }
+
+ return $row;
+ }
+
+ /**
+ * @return list
+ */
+ public function pickerVersions(): array
+ {
+ $detail = $this->pickerDetail();
+
+ if ($detail === null) {
+ return [];
+ }
+
+ $options = app(EditorialCatalog::class)->alternatives(
+ (string) ($detail['identity'] ?? ''),
+ (int) $this->getRecord()->getKey(),
+ );
+
+ if ($options === []) {
+ return [];
+ }
+
+ $current = $options[array_key_last($options)]['target'];
+
+ return array_map(
+ fn (array $option): array => $option + ['current' => $option['target'] === $current],
+ $options,
+ );
+ }
+
+ public function pickerMatches(string $identity): bool
+ {
+ $detail = $this->pickerDetail();
+
+ return $detail !== null && ($detail['identity'] ?? '') === $identity;
}
public function openText(): void
{
$this->pickerOpen = false;
+ $this->moduleOpen = false;
+ $this->partOpen = false;
$this->textOpen = true;
}
@@ -611,7 +693,12 @@ public function addPart(string $target): void
$this->search = '';
$this->pickerOpen = false;
$this->pickerSelected = '';
- $this->feedback = $row['title'].' ist in den Aufbau übernommen. Die Datei wird nicht kopiert. Gespeichert ist das erst mit „Entwurf speichern“.';
+
+ if (! $this->persistDraft()) {
+ return;
+ }
+
+ $this->feedback = $row['title'].' ist in den Aufbau übernommen. Die Datei wird nicht kopiert. Der Entwurf ist gespeichert. Es entsteht keine neue Fassung.';
}
public function removePart(int $index): void
@@ -625,7 +712,9 @@ public function removePart(int $index): void
$this->selected = null;
$this->roleDraft = '';
$this->panel = 'angaben';
- $this->feedback = 'Der Bestandteil ist aus dem Arbeitsstand genommen. Gespeichert ist das erst mit einer neuen Fassung.';
+ $this->partOpen = false;
+ $this->partSnapshot = [];
+ $this->feedback = 'Der Bestandteil ist aus dem Arbeitsstand genommen. Entwurf speichern hält das fest. Eine freigegebene Fassung bleibt unverändert.';
}
public function movePart(int $index, int $direction): void
@@ -663,7 +752,7 @@ public function useVersion(int $index, string $target): void
$row['role'] = $this->members[$index]['role'] ?? $row['kind'];
$this->members[$index] = $row;
$this->syncRoleDraft();
- $this->feedback = $row['version_label'].' ist für diese Stelle ausgewählt. Übernehmen legt dafür eine neue Fassung an.';
+ $this->feedback = $row['version_label'].' ist für diese Stelle ausgewählt. Der Entwurf speichert das. Eine freigegebene Fassung bleibt unverändert.';
}
public function loadTemplate(int $versionId): void
@@ -678,7 +767,7 @@ public function loadTemplate(int $versionId): void
$this->applyVersion($version);
$this->templateNumber = $version->number;
- $this->feedback = 'Fassung '.$version->number.' ist als Arbeitsstand geladen. Übernehmen legt eine neue Fassung an und lässt die geladene Fassung unverändert.';
+ $this->feedback = 'Fassung '.$version->number.' ist als Arbeitsstand geladen. Die geladene Fassung bleibt unverändert.';
}
public function addText(): void
@@ -706,7 +795,7 @@ public function addText(): void
$this->newTextBody = '';
$this->textOpen = false;
$this->addPart('element:'.$version->id);
- $this->feedback = $title.' ist angelegt und in den Aufbau übernommen. Derselbe Text kann später woanders wiederverwendet werden. Gespeichert ist das erst mit „Entwurf speichern“.';
+ $this->feedback = $title.' ist angelegt und in den Aufbau übernommen. Derselbe Text kann später woanders wiederverwendet werden. Der Entwurf ist gespeichert. Es entsteht keine neue Fassung dieses Eintrags.';
}
public function startModule(): void
@@ -727,27 +816,197 @@ public function startModule(): void
public function saveDisplay(): void
{
- /** @var Composition $record */
- $record = $this->getRecord();
- $name = trim($this->designation);
+ if (! $this->persistPresentation()) {
+ return;
+ }
- if ($name === '') {
- $this->feedback = 'Der Name fehlt.';
+ $this->feedback = 'Die Anzeige ist gespeichert. Die Fassung bleibt unverändert.';
+ }
+
+ public function openModule(): void
+ {
+ $this->moduleSnapshot = [
+ 'designation' => $this->designation,
+ 'displayTitle' => $this->displayTitle,
+ 'summary' => $this->summary,
+ 'description' => $this->description,
+ 'learningGoal' => $this->learningGoal,
+ 'durationMinutes' => $this->durationMinutes,
+ 'materialNote' => $this->materialNote,
+ 'revisionNote' => $this->revisionNote,
+ 'thumbnailAlt' => $this->thumbnailAlt,
+ 'dimensionIds' => $this->dimensionIds,
+ 'imageMode' => $this->imageMode,
+ 'imagePick' => $this->imagePick,
+ 'frameVersionId' => $this->frameVersionId,
+ 'frameSecond' => $this->frameSecond,
+ ];
+ $this->pickerOpen = false;
+ $this->partOpen = false;
+ $this->textOpen = false;
+ $this->moduleTab = 'beschreibung';
+ $films = $this->frameFilms();
+ $this->imageMode = $films === [] ? 'bestand' : 'film';
+
+ if ($films !== [] && $this->frameVersionId === null) {
+ $this->frameVersionId = $films[0]['version_id'];
+ }
+
+ $this->moduleOpen = true;
+ }
+
+ public function closeModule(): void
+ {
+ foreach ($this->moduleSnapshot as $key => $value) {
+ $this->{$key} = $value;
+ }
+
+ $this->moduleOpen = false;
+ $this->moduleSnapshot = [];
+ $this->previewUpload = null;
+ }
+
+ public function saveModule(): void
+ {
+ if ($this->minutes($this->durationMinutes) === false) {
+ $this->feedback = 'Der Zeitbedarf ist eine Zahl von Minuten oder bleibt leer.';
return;
}
- $record->designation = $name;
- app(IdentityProfile::class)->fill($record, [
- 'display_title' => $this->displayTitle,
- 'summary' => $this->summary,
- 'description' => $this->description,
- 'thumbnail_alt' => $this->thumbnailAlt,
- ], $this->actor());
- $this->syncDimensions($record, array_map(intval(...), $this->dimensionIds));
- $record->refresh();
- $this->getRecord()->setRawAttributes($record->getAttributes());
- $this->feedback = 'Die Anzeige ist gespeichert. Die Fassung bleibt unverändert.';
+ if (! $this->persistPresentation()) {
+ return;
+ }
+
+ $image = $this->applyChosenImage();
+
+ if ($image === false) {
+ return;
+ }
+
+ /** @var Composition $record */
+ $record = $this->getRecord();
+
+ if ($this->needsRevision() || app(EditorialWorkingDraft::class)->read($record) !== null) {
+ $this->persistDraft();
+ }
+
+ $this->moduleOpen = false;
+ $this->moduleSnapshot = [];
+ $this->previewUpload = null;
+ $this->imagePick = '';
+ $this->feedback = trim('Die Angaben sind übernommen. Es entsteht keine neue Fassung.'.($image === '' ? '' : ' '.$image));
+ }
+
+ public function openPart(int $index): void
+ {
+ $this->selectPart($index);
+ $this->partSnapshot = $this->members;
+ $this->moduleOpen = false;
+ $this->pickerOpen = false;
+ $this->textOpen = false;
+ $this->partOpen = true;
+ }
+
+ public function closePart(): void
+ {
+ if ($this->partSnapshot !== []) {
+ $this->members = $this->partSnapshot;
+ }
+
+ $this->partOpen = false;
+ $this->partSnapshot = [];
+ $this->syncRoleDraft();
+ }
+
+ public function savePart(): void
+ {
+ if (trim($this->roleDraft) === '') {
+ $this->feedback = 'Die Rolle fehlt.';
+
+ return;
+ }
+
+ $this->commitRoleDraft();
+
+ if (! $this->persistDraft()) {
+ return;
+ }
+
+ $this->partOpen = false;
+ $this->partSnapshot = [];
+ $this->feedback = 'Die Angaben zum Bestandteil sind im Entwurf. Es entsteht keine neue Fassung.';
+ }
+
+ /**
+ * @return list
+ */
+ public function frameFilms(): array
+ {
+ $preview = app(ContentPreviewController::class);
+ $films = [];
+
+ foreach ($this->members as $member) {
+ if (preg_match('/^element:(\d+)$/', (string) ($member['target'] ?? ''), $match) !== 1) {
+ continue;
+ }
+
+ $version = ContentElementVersion::query()->with('element')->find($match[1]);
+
+ if (! $version instanceof ContentElementVersion || $version->element?->output_class !== 'film') {
+ continue;
+ }
+
+ $films[] = [
+ 'version_id' => $version->id,
+ 'title' => (string) ($member['title'] ?? $version->element->working_title),
+ 'label' => 'Fassung '.$version->number,
+ 'file_url' => $preview->fileUrl($version),
+ ];
+ }
+
+ return $films;
+ }
+
+ public function framePreviewUrl(): ?string
+ {
+ if ($this->frameVersionId === null || ! is_numeric($this->frameSecond) || trim($this->frameSecond) === '') {
+ return null;
+ }
+
+ return route('editorial.frame', [
+ 'version' => $this->frameVersionId,
+ 'sekunde' => $this->frameSecond,
+ ]);
+ }
+
+ public function imageCaption(): ?string
+ {
+ /** @var Composition $composition */
+ $composition = $this->getRecord();
+ $composition->refresh();
+ $source = $composition->thumbnail_source;
+
+ if (! is_string($source) || $source === '') {
+ return null;
+ }
+
+ if (preg_match('/^frame:(\d+)@([\d.]+)$/', $source, $match) === 1) {
+ $version = ContentElementVersion::query()->with('element')->find($match[1]);
+ $title = $version?->element?->working_title ?: 'dem Film';
+
+ return 'Titelbild aus '.$title.' bei '.$match[2].' Sekunden.';
+ }
+
+ if ($source === 'eigen') {
+ return 'Eigenes Titelbild.';
+ }
+
+ if (str_starts_with($source, 'element:')) {
+ return 'Titelbild aus einem vorhandenen Bild.';
+ }
+
+ return null;
}
public function savePreview(): void
@@ -1228,6 +1487,120 @@ protected function syncDimensions(Composition $composition, array $ids): void
}
}
+ protected function persistPresentation(): bool
+ {
+ /** @var Composition $record */
+ $record = $this->getRecord();
+ $name = trim($this->designation);
+
+ if ($name === '') {
+ $this->feedback = 'Der Name fehlt.';
+
+ return false;
+ }
+
+ $record->designation = $name;
+ app(IdentityProfile::class)->fill($record, [
+ 'display_title' => $this->displayTitle,
+ 'summary' => $this->summary,
+ 'description' => $this->description,
+ 'thumbnail_alt' => $this->thumbnailAlt,
+ ], $this->actor());
+ $this->syncDimensions($record, array_map(intval(...), $this->dimensionIds));
+ $record->refresh();
+ $this->getRecord()->setRawAttributes($record->getAttributes());
+
+ return true;
+ }
+
+ protected function persistDraft(): bool
+ {
+ if ($this->minutes($this->durationMinutes) === false) {
+ $this->feedback = 'Der Zeitbedarf ist eine Zahl von Minuten oder bleibt leer.';
+
+ return false;
+ }
+
+ /** @var Composition $record */
+ $record = $this->getRecord();
+ app(EditorialWorkingDraft::class)->write($record, $this->payload());
+
+ return true;
+ }
+
+ protected function applyChosenImage(): string|false
+ {
+ if ($this->imageMode === 'upload' && $this->previewUpload instanceof TemporaryUploadedFile) {
+ $extension = strtolower($this->previewUpload->getClientOriginalExtension());
+
+ if (! in_array($extension, ['png', 'jpg', 'jpeg', 'webp'], true)) {
+ $this->feedback = 'Das Vorschaubild muss eine Bilddatei sein.';
+
+ return false;
+ }
+
+ $path = $this->previewUpload->storeAs(
+ 'vorschau',
+ 'karte-'.bin2hex(random_bytes(4)).'.'.$extension,
+ 'cms_incoming',
+ );
+ $this->previewUpload = null;
+
+ if (! is_string($path)) {
+ $this->feedback = 'Das Vorschaubild wurde nicht übernommen.';
+
+ return false;
+ }
+
+ $this->storePreview($path);
+
+ return str_contains($this->feedback, 'unverändert') ? $this->feedback : false;
+ }
+
+ if ($this->imageMode === 'bestand' && ctype_digit($this->imagePick)) {
+ $this->adoptPicture((int) $this->imagePick);
+
+ return str_contains($this->feedback, 'unverändert') ? $this->feedback : false;
+ }
+
+ if ($this->imageMode === 'film' && $this->frameVersionId !== null && trim($this->frameSecond) !== '') {
+ if (! is_numeric($this->frameSecond) || (float) $this->frameSecond < 0 || (float) $this->frameSecond > 7200) {
+ $this->feedback = 'Die Zeitposition muss eine Zahl in Sekunden sein.';
+
+ return false;
+ }
+
+ $version = ContentElementVersion::query()->with('element')->find($this->frameVersionId);
+ $target = 'element:'.(int) $this->frameVersionId;
+ $known = array_map(fn (array $member): string => (string) ($member['target'] ?? ''), $this->members);
+
+ if (! $version instanceof ContentElementVersion || $version->element?->output_class !== 'film' || ! in_array($target, $known, true)) {
+ $this->feedback = 'Die Filmfassung gehört nicht zu diesem Aufbau.';
+
+ return false;
+ }
+
+ /** @var Composition $record */
+ $record = $this->getRecord();
+ $before = $record->versions()->count();
+ DeriveCompositionFrame::dispatch($record->id, $version->id, (float) $this->frameSecond);
+ $record->refresh();
+ $this->thumbnailPath = $record->thumbnail_path;
+ $this->thumbnailError = $record->thumbnail_error;
+ $note = $this->previewFeedback($record, $before);
+
+ if (! str_contains($note, 'unverändert')) {
+ $this->feedback = $note;
+
+ return false;
+ }
+
+ return $note;
+ }
+
+ return '';
+ }
+
protected function storePreview(string $path): void
{
if (! str_starts_with($path, 'vorschau/') || str_contains($path, '..')) {
diff --git a/app/Filament/Support/EditorialCatalog.php b/app/Filament/Support/EditorialCatalog.php
index 69cb1da..5f62bae 100644
--- a/app/Filament/Support/EditorialCatalog.php
+++ b/app/Filament/Support/EditorialCatalog.php
@@ -205,12 +205,16 @@ public function browse(string $query, string $kind, string $dimension, int $exce
$dimensionId = ctype_digit($dimension) ? (int) $dimension : 0;
if ($kind !== 'modul') {
- $elements = ContentElementVersion::query()
+ $latestElements = ContentElementVersion::query()
+ ->selectRaw('MAX(id)')
->where('status', ContentVersionStatus::Bereit)
- ->with('element.editorialContentKind')
->whereHas('element', function ($builder) use ($query, $like, $kind, $dimensionId): void {
$this->constrainElement($builder, $query, $like, $kind, $dimensionId);
})
+ ->groupBy('content_element_id');
+ $elements = ContentElementVersion::query()
+ ->with('element.editorialContentKind')
+ ->whereIn('id', $latestElements)
->orderByDesc('id')
->limit($limit + 1)
->get();
@@ -225,10 +229,10 @@ public function browse(string $query, string $kind, string $dimension, int $exce
}
if (in_array($kind, ['alle', 'modul'], true)) {
- $versions = CompositionVersion::query()
+ $latestCompositions = CompositionVersion::query()
+ ->selectRaw('MAX(id)')
->where('status', ContentVersionStatus::Bereit)
->where('composition_id', '!=', $exceptCompositionId)
- ->with('composition.editorialContentKind')
->whereHas('composition', function ($builder) use ($query, $like, $kind, $dimensionId): void {
if ($kind === 'modul') {
$builder->where('kind', CompositionKind::Uebung);
@@ -248,6 +252,10 @@ public function browse(string $query, string $kind, string $dimension, int $exce
->orWhere('summary', 'like', $like);
});
})
+ ->groupBy('composition_id');
+ $versions = CompositionVersion::query()
+ ->with('composition.editorialContentKind')
+ ->whereIn('id', $latestCompositions)
->orderByDesc('id')
->limit($limit + 1)
->get();
diff --git a/app/Http/Controllers/EditorialPreviewController.php b/app/Http/Controllers/EditorialPreviewController.php
index 9273f51..8f2c406 100644
--- a/app/Http/Controllers/EditorialPreviewController.php
+++ b/app/Http/Controllers/EditorialPreviewController.php
@@ -10,8 +10,11 @@
use App\Domain\Catalog\ContentVersionStatus;
use App\Domain\Catalog\StructureNode;
use App\Domain\Identity\StaffRole;
+use App\Domain\Media\ThumbnailDeriver;
use App\Filament\Support\EditorialCatalog;
use App\Models\User;
+use Illuminate\Http\Request;
+use Illuminate\Http\Response;
use Illuminate\Support\Facades\Storage;
use Illuminate\View\View;
use Symfony\Component\HttpFoundation\StreamedResponse;
@@ -146,6 +149,23 @@ private function render(
]);
}
+ public function frame(ContentElementVersion $version, Request $request): Response
+ {
+ $this->authorizeStaff();
+ $version->loadMissing('element');
+ abort_unless($version->element?->output_class === 'film', 404);
+ $seconds = $request->query('sekunde');
+ abort_unless(is_numeric($seconds), 404);
+
+ $bytes = app(ThumbnailDeriver::class)->jpegAtVersion($version, (float) $seconds);
+ abort_unless(is_string($bytes), 404);
+
+ return response($bytes, 200, [
+ 'Content-Type' => 'image/jpeg',
+ 'Cache-Control' => 'private, no-store',
+ ]);
+ }
+
/**
* @return array
*/
diff --git a/app/Jobs/DeriveCompositionFrame.php b/app/Jobs/DeriveCompositionFrame.php
new file mode 100644
index 0000000..f8d3d98
--- /dev/null
+++ b/app/Jobs/DeriveCompositionFrame.php
@@ -0,0 +1,32 @@
+find($this->compositionId);
+ $version = ContentElementVersion::query()->find($this->versionId);
+
+ if (! $composition instanceof Composition || ! $version instanceof ContentElementVersion) {
+ return;
+ }
+
+ $deriver->forCompositionFrame($composition, $version, $this->atSecond);
+ }
+}
diff --git a/resources/views/filament/editorial/editor.blade.php b/resources/views/filament/editorial/editor.blade.php
index 33b3ba6..5eed695 100644
--- a/resources/views/filament/editorial/editor.blade.php
+++ b/resources/views/filament/editorial/editor.blade.php
@@ -20,7 +20,7 @@
@endif
- @if ($this->feedback !== '')
+ @if ($this->feedback !== '' && ! $this->moduleOpen && ! $this->partOpen)
{{ $this->feedback }}
@endif
@if ($this->releaseArmed)
@@ -40,7 +40,7 @@
Aufbau
Bestandteil hinzufügen
- Die Bausteine bleiben sichtbar, auch wenn rechts ein Bestandteil bearbeitet wird. Ziehen sortiert sie. Nach oben und Nach unten tun dasselbe ohne Ziehen.
+ Der Aufbau ist die Arbeitsfläche. Das Stiftsymbol öffnet die Eigenschaften eines Bestandteils. Ziehen ändert die Reihenfolge, Nach oben und Nach unten tun dasselbe ohne Ziehen.
@if ($this->members === [])
@if ($this->isProgram())
@@ -63,21 +63,33 @@
@dragenter.prevent="over = {{ $index }}"
:class="{ 'is-drop': over === {{ $index }} && from !== {{ $index }} }">
selected === $index) aria-current="true" @endif>
- @if (! empty($member['image']))
-
- @else
- {{ mb_substr((string) $member['kind'], 0, 1) }}
- @endif
+
+ @if (! empty($member['image']))
+
+ @else
+
+
+
+
+ Kein Titelbild
+ @endif
+
- {{ $member['role'] }}
+ {{ $member['kind'] }}
{{ $member['title'] }}
- {{ $member['kind'] }} · {{ $member['version_label'] }}
+ {{ $member['role'] }} · {{ $member['version_label'] }}
@if ($children = $this->childrenOf((string) $member['target']))
Enthält {{ $children }}
@endif
+
+
+
+
+
+
Nach oben
members) - 1) aria-label="{{ $member['title'] }} nach unten">Nach unten
@@ -87,187 +99,75 @@
@endif
-
-
-
Eigenschaften des {{ $this->hostLabel() }}s
-
selected === null)>Ausgewählter Bestandteil
-
Freigegebene Fassungen
+
+ {{ $this->hostLabel() }}
+ {{ trim($this->displayTitle) !== '' ? $this->displayTitle : $this->designation }}
+
+ @foreach ($this->presentationChips() as $chip)
+ {{ $chip['label'] }}
+ @endforeach
-
- @if ($this->panel === 'bestandteil' && $this->selectedMember())
- @php($member = $this->selectedMember())
- Bestandteil an dieser Stelle
- {{ $member['title'] }}
- {{ $member['kind'] }} · {{ $member['version_label'] }}
-
- Rolle an dieser Stelle
-
-
- Die Rolle gilt nur hier. Dasselbe Medium kann woanders eine andere Rolle haben.
- @if (count($this->selectedAlternatives()) > 1)
- Vorhandene Fassung
-
- @foreach ($this->selectedAlternatives() as $alternative)
- {{ $alternative['label'] }}
- @endforeach
-
- @endif
-
- @elseif ($this->panel === 'fassungen')
- Nur freigegebene Stände
- Freigegebene Fassungen
- @if ($this->versionChoices() === [])
- Noch keine freigegebene Fassung. Sie entsteht mit „Freigeben“, nicht beim Speichern des Entwurfs.
+ @php($cover = $this->coverPicture())
+ Katalogvorschau
+
+ @if ($cover['url'])
+
@else
-
+
+
+
+
@endif
-
Eine freigegebene Fassung wird nicht überschrieben. Als Vorlage laden ändert nur den Arbeitsstand.
- @else
-
{{ $this->hostLabel() }}
-
{{ trim($this->displayTitle) !== '' ? $this->displayTitle : $this->designation }}
-
Titel, Texte, Einordnung und Titelbild beschreiben die Karte. Sie legen keine Inhaltsfassung an. Lernziel, Zeit und Material gehören zum fachlichen Stand darunter.
-
- @foreach ($this->presentationChips() as $chip)
- {{ $chip['label'] }}
- @endforeach
-
- @php($cover = $this->coverPicture())
-
Katalogvorschau
-
- @if ($cover['url'])
-
- @else
-
-
-
-
+ @if ($cover['note'])
+
{{ $cover['note'] }}
+ @endif
+
+
{{ trim($this->summary) !== '' ? \Illuminate\Support\Str::limit(trim($this->summary), 180) : 'Noch keine Kurzbeschreibung' }}
+ @if (trim($this->learningGoal) !== '')
+
Lernziel: {{ \Illuminate\Support\Str::limit(trim($this->learningGoal), 140) }}
+ @endif
+ @if (trim($this->durationMinutes) !== '' || trim($this->materialNote) !== '')
+
+ @if (trim($this->durationMinutes) !== '')
+ {{ $this->durationMinutes }} Minuten
@endif
- @if ($cover['note'])
- {{ $cover['note'] }}
+ @if (trim($this->materialNote) !== '')
+ · {{ \Illuminate\Support\Str::limit(trim($this->materialNote), 80) }}
@endif
-
-
- {{ trim($this->displayTitle) !== '' ? $this->displayTitle : ($this->designation !== '' ? $this->designation : 'Ohne Titel') }}
- {{ trim($this->summary) !== '' ? \Illuminate\Support\Str::limit(trim($this->summary), 160) : 'Noch keine Kurzbeschreibung' }}
-
- Name in der Verwaltung
-
-
-
- Titel
-
-
-
- Kurzbeschreibung
-
- Steht auf der Katalogkarte.
-
-
- Fachliche Beschreibung
-
- Ausführlicher Text für die Mitgliederbibliothek und eine spätere öffentliche Produktseite. Preis und Nutzungsrechte bleiben beim Angebot.
-
- @foreach ($this->dimensionGroups() as $group)
-
- {{ $group['label'] }}
- @foreach ($group['values'] as $value)
-
-
- {{ $value['label'] }}
-
- @endforeach
-
- @endforeach
- Titelbild
- Ein selbst gewähltes Bild hat Vorrang vor einem Vorschlag. Ein Bild aus einem Film bleibt geschützt und wird nicht auf der öffentlichen Website ausgegeben.
- @if ($this->thumbnailError)
- {{ $this->thumbnailError }}
- @endif
- @php($films = $this->filmChoices())
- @php($suggestion = $this->suggestedFilm())
- @if ($suggestion)
- Vorschlag aus dem Film {{ $suggestion['title'] }}.
- Vorschlag als Titelbild übernehmen
- @endif
- @if ($films !== [])
- Mehrere Filme sind enthalten. Wähle das Titelbild.
- @foreach ($films as $film)
-
-
-
{{ $film['title'] }}
-
{{ $film['title'] }} als Titelbild
-
- @endforeach
- @endif
-
- Alternativtext
-
-
-
- Eigenes Titelbild
-
-
-
- Bild aus vorhandenem Medium
-
-
- @foreach ($this->mediaChoices() as $medium)
-
-
-
{{ $medium['kind'] }} {{ $medium['title'] }}
-
Dieses Bild übernehmen
-
- @endforeach
-
- Anzeige speichern
- Titelbild speichern
-
+ @endif
+ @if ($caption = $this->imageCaption())
+ {{ $caption }}
+ @endif
+
+ {{ $this->hostLabel() }} bearbeiten
+
+ @if ($member = $this->selectedMember())
+ Ausgewählt: {{ $member['title'] }}, Rolle {{ $member['role'] }}. Das Stiftsymbol öffnet die Bearbeitung.
+ @endif
- Zum fachlichen Stand
- Lernziel, Zeit und Material gehören zum Aufbau. Speichern schreibt sie in den Entwurf. Erst Freigeben erzeugt eine neue Fassung.
-
- Lernziel
-
-
-
- Zeitbedarf in Minuten
-
-
-
- Material
-
-
-
- Notiz zur nächsten Freigabe
-
-
- {{ $this->publishHint() }}
+ Freigegebene Fassungen
+ @if ($this->versionChoices() === [])
+ Noch keine freigegebene Fassung. Sie entsteht mit „Freigeben“, nicht beim Speichern des Entwurfs.
+ @else
+
@endif
@if ($this->usageLines() !== [])
@@ -290,11 +190,209 @@
+ @if ($this->moduleOpen)
+
+
+
+
{{ $this->hostLabel() }} bearbeiten
+ Abbrechen
+
+
Übernehmen schreibt die Angaben. Eine freigegebene Fassung bleibt dabei unverändert.
+ @if ($this->feedback !== '')
+
{{ $this->feedback }}
+ @endif
+
+ Beschreibung
+ Didaktik
+ Einordnung
+ Titelbild
+
+
+ @if ($this->moduleTab === 'beschreibung')
+
+ Name in der Verwaltung
+
+
+
+ Titel
+
+
+
+ Kurzbeschreibung
+
+
+
+ Ausführliche Beschreibung
+
+
+ @elseif ($this->moduleTab === 'didaktik')
+
Lernziel, Zeit und Material gehören zum fachlichen Stand. Sie landen im Entwurf und erzeugen erst mit Freigeben eine neue Fassung.
+
+ Lernziel
+
+
+
+ Zeitbedarf in Minuten
+
+
+
+ Materialbedarf
+
+
+
+ Notiz zur nächsten Freigabe
+
+
+ @elseif ($this->moduleTab === 'einordnung')
+ @forelse ($this->dimensionGroups() as $group)
+
+ {{ $group['label'] }}
+ @foreach ($group['values'] as $value)
+
+
+ {{ $value['label'] }}
+
+ @endforeach
+
+ @empty
+
Es sind noch keine fachlichen Themen angelegt.
+ @endforelse
+ @else
+ @php($cover = $this->coverPicture())
+
+ @if ($cover['url'])
+
+ @else
+
+
+
+
+ @endif
+ @if ($cover['note'])
+
{{ $cover['note'] }}
+ @endif
+
+ @if ($caption = $this->imageCaption())
+
{{ $caption }}
+ @endif
+ @if ($this->thumbnailError)
+
{{ $this->thumbnailError }}
+ @endif
+
+ Alternativtext
+
+
+
+ Aus Film
+ Vorhandenes Bild
+ Hochladen
+
+ @if ($this->imageMode === 'film')
+ @php($films = $this->frameFilms())
+ @if ($films === [])
+
In diesem Aufbau ist kein Film. Nimm zuerst einen Film in den Aufbau auf.
+ @else
+
+ @foreach ($films as $film)
+ {{ $film['title'] }}, {{ $film['label'] }}
+ @endforeach
+
+ @php($chosen = collect($films)->firstWhere('version_id', (int) $this->frameVersionId))
+ @if (is_array($chosen) && filled($chosen['file_url']))
+
+
Die Vorschau zeigt die Stelle, die als Titelbild übernommen wird. Die Filmdatei selbst bleibt unverändert.
+ @if ($frameUrl = $this->framePreviewUrl())
+
+ @endif
+ @elseif (is_array($chosen))
+
Für diese Filmfassung liegt noch keine abspielbare Datei vor.
+ @endif
+ @endif
+ @elseif ($this->imageMode === 'bestand')
+
+ Bild aus vorhandenem Medium
+
+
+ @forelse ($this->mediaChoices() as $medium)
+
+
+
{{ $medium['kind'] }} {{ $medium['title'] }}
+
Auswählen
+
+ @empty
+
Mindestens zwei Buchstaben zeigen vorhandene Bilder.
+ @endforelse
+ @else
+
+ Eigenes Titelbild
+
+
+
Ein geschütztes Bild bleibt für die öffentliche Website gesperrt. Daran ändert das Titelbild nichts.
+ @endif
+ @endif
+
+
+ Übernehmen
+ Abbrechen
+
+
+
+ @endif
+
+ @if ($this->partOpen && $this->selectedMember())
+ @php($member = $this->selectedMember())
+
+
+
+
Bestandteil bearbeiten
+ Abbrechen
+
+
{{ $member['kind'] }}
+
{{ $member['title'] }}
+
{{ $member['version_label'] }}
+ @if ($this->feedback !== '')
+
{{ $this->feedback }}
+ @endif
+
+ Rolle an dieser Stelle
+
+
+
Die Rolle gilt nur in diesem Aufbau. Dieselbe Fassung kann woanders eine andere Rolle haben.
+ @if (count($this->selectedAlternatives()) > 1)
+
Zulässige Fassung
+
+ @foreach ($this->selectedAlternatives() as $alternative)
+ {{ $alternative['label'] }}
+ @endforeach
+
+ @endif
+
+
Übernehmen
+
Abbrechen
+ @if ($member['open_url'])
+
Ansehen
+ @endif
+ @if ($member['edit_url'])
+
Im eigenen Editor öffnen
+ @endif
+
Aus dem Aufbau nehmen
+
+
+
+ @endif
+
@if ($this->pickerOpen)
-
Bestandteil hinzufügen
+ Material auswählen
Schließen
@@ -327,16 +425,25 @@
@foreach ($result['items'] as $hit)
-
- @if (! empty($hit['image']))
-
- @else
- {{ mb_substr((string) $hit['kind'], 0, 1) }}
- @endif
-
+
+
+ @if (! empty($hit['image']))
+
+ @else
+
+
+
+
+ Kein Titelbild
+ @endif
+
+
{{ $hit['kind'] }}
{{ $hit['title'] }}
- {{ $hit['version_label'] }}
+ @if (filled($hit['summary'] ?? null))
+ {{ \Illuminate\Support\Str::limit((string) $hit['summary'], 120) }}
+ @endif
+ Aktueller Stand · {{ $hit['version_label'] }}
@@ -351,7 +458,25 @@
@if (filled($detail['summary'] ?? null))
{{ $detail['summary'] }}
@endif
- Übernehmen verweist auf diese vorhandene Fassung. Es wird nichts kopiert.
+ @if (($detail['tone'] ?? '') === 'film')
+ @if (filled($detail['file_url'] ?? null))
+
+ @else
+ Für diese Fassung liegt noch keine abspielbare Datei vor. Ansehen öffnet die vorhandene Vorschau.
+ @endif
+ @endif
+ @if (count($this->pickerVersions()) > 1)
+ Fassungen
+ Standard ist der aktuelle Stand. Eine andere zulässige Fassung wählst du vor dem Übernehmen.
+
+ @foreach ($this->pickerVersions() as $version)
+ {{ $version['label'] }}@if ($version['current']) , aktueller Stand @endif
+ @endforeach
+
+ @else
+ Das ist der aktuelle Stand. Eine weitere zulässige Fassung liegt nicht vor.
+ @endif
+ Übernehmen verweist auf diese vorhandene Fassung. Es wird nichts kopiert und keine neue Fassung des Eintrags angelegt.
@if ($detail['open_url'])
Ansehen
@@ -359,7 +484,7 @@
Übernehmen
@else
- Wähle einen Eintrag, um ihn anzusehen und zu übernehmen.
+ Wähle einen Eintrag, sieh ihn dir an und übernimm ihn in den Entwurf.
@endif
diff --git a/resources/views/filament/editorial/styles.blade.php b/resources/views/filament/editorial/styles.blade.php
index b18b089..05a1e3f 100644
--- a/resources/views/filament/editorial/styles.blade.php
+++ b/resources/views/filament/editorial/styles.blade.php
@@ -28,7 +28,7 @@
.luf-feedback { background: #e7f3ee; }
.luf-split {
display: grid;
- grid-template-columns: minmax(16rem, 1.1fr) minmax(18rem, 0.9fr);
+ grid-template-columns: minmax(18rem, 1.4fr) minmax(16rem, 0.8fr);
gap: 1.25rem;
align-items: start;
}
@@ -118,6 +118,7 @@
min-height: 2.75rem;
}
.luf-scopes, .luf-actions, .luf-tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.6rem 0; }
+ .luf-tabs button[aria-selected="true"], .luf-scopes button[aria-pressed="true"] { background: var(--luf-ink); color: #fff; border-color: var(--luf-ink); }
.luf-empty {
margin: 0 0 1rem;
padding: 0.8rem 0.9rem;
@@ -137,8 +138,8 @@
.luf-inline input { flex: 1; min-width: 10rem; font: inherit; border: 1px solid var(--luf-line); padding: 0.45rem 0.65rem; min-height: 2.75rem; }
.luf-kicker { margin: 0; color: var(--luf-pine); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; font-size: 0.78rem; }
.luf-blocks, .luf-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
- .luf-cards { grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); }
- .luf-block, .luf-card {
+ .luf-cards { grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); }
+ .luf-block {
display: grid;
grid-template-columns: 1fr auto;
gap: 0.45rem;
@@ -146,11 +147,33 @@
background: #fff;
border: 1px solid var(--luf-line);
border-left-width: 6px;
- padding: 0.35rem;
+ padding: 0.45rem;
}
- .luf-card { grid-template-columns: auto 1fr; width: 100%; text-align: left; color: inherit; text-decoration: none; }
+ .luf-card {
+ display: flex;
+ flex-direction: column;
+ align-items: stretch;
+ width: 100%;
+ padding: 0;
+ text-align: left;
+ color: inherit;
+ background: #fff;
+ border: 1px solid var(--luf-line);
+ border-top: 4px solid var(--luf-pine);
+ overflow: hidden;
+ }
+ .luf-card-body { display: grid; gap: 0.25rem; padding: 0.65rem 0.7rem 0.8rem; }
+ .luf-card-body strong { font-size: 1.05rem; line-height: 1.3; }
.luf-block.is-selected, .luf-card[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--luf-pine); }
.luf-block.is-drop { outline: 3px solid var(--luf-yellow); }
+ .luf-block-figure { display: block; width: 8.75rem; aspect-ratio: 16 / 9; flex: 0 0 auto; background: #e7eee9; overflow: hidden; position: relative; }
+ .luf-block-figure img, .luf-block-figure .luf-mark { width: 100%; height: 100%; object-fit: cover; display: block; }
+ .luf-icon { display: inline-flex; align-items: center; justify-content: center; width: 2.75rem; min-height: 2.75rem; border: 1px solid var(--luf-line); background: #fff; color: var(--luf-ink); }
+ .luf-card.luf-tone-film { border-top-color: #1b2838; }
+ .luf-card.luf-tone-dokument { border-top-color: #1769aa; }
+ .luf-card.luf-tone-text { border-top-color: var(--luf-yellow); }
+ .luf-card.luf-tone-audio { border-top-color: #7a4e8a; }
+ .luf-card.luf-tone-modul, .luf-card.luf-tone-programm { border-top-color: var(--luf-pine); }
.luf-tone-film { border-left-color: #1b2838; }
.luf-tone-dokument { border-left-color: #1769aa; }
.luf-tone-text { border-left-color: var(--luf-yellow); }
@@ -214,12 +237,15 @@
.luf-chip-ink { color: var(--luf-ink); }
.luf-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.luf-frame { position: relative; aspect-ratio: 16 / 9; max-width: 22rem; background: #e7eee9; margin: 0 0 0.8rem; }
+ .luf-frame-still { width: min(100%, 28rem); aspect-ratio: 16 / 9; object-fit: cover; background: #111; display: block; margin: 0.4rem 0 0.8rem; }
+ .luf-video { width: 100%; max-height: 18rem; background: #111; margin: 0.4rem 0 0.8rem; }
+ .luf-work input[type="range"] { min-height: 2rem; padding: 0; }
.luf-choice { display: grid; grid-template-columns: 5.5rem 1fr auto; gap: 0.6rem; align-items: center; background: #fff; border: 1px solid var(--luf-line); padding: 0.35rem; margin: 0 0 0.45rem; }
.luf-choice img { width: 5.5rem; height: 3.1rem; object-fit: cover; }
.luf-picker { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(14rem, 0.8fr); gap: 0.8rem; align-items: start; }
.luf-detail { background: var(--luf-paper); border: 1px solid var(--luf-line); padding: 0.8rem; }
.luf-modal { position: fixed; inset: 0; z-index: 50; background: rgba(27, 40, 56, 0.46); display: grid; place-items: center; padding: 1rem; }
- .luf-modal-card { width: min(68rem, 100%); max-height: calc(100vh - 2rem); overflow: auto; background: #fff; border: 1px solid var(--luf-line); padding: 1rem 1.1rem 1.25rem; }
+ .luf-modal-card { width: min(76rem, 100%); max-height: calc(100vh - 2rem); overflow: auto; background: #fff; border: 1px solid var(--luf-line); padding: 1rem 1.1rem 1.25rem; }
.luf-modal-narrow { width: min(36rem, 100%); }
.luf-confirm { margin: 0 0 1rem; padding: 0.9rem 1rem; background: #fff; border: 1px solid var(--luf-yellow); }
.luf-work select { width: 100%; font: inherit; min-height: 2.75rem; border: 1px solid var(--luf-line); background: #fff; color: inherit; padding: 0.4rem 0.6rem; }
@@ -227,7 +253,10 @@
.luf-split, .luf-desk-create, .luf-picker { grid-template-columns: 1fr; }
.luf-move { grid-auto-flow: column; }
.luf-part-row, .luf-block { grid-template-columns: 1fr; }
+ .luf-block-figure { width: 100%; }
.luf-cards, .luf-catalogs { grid-template-columns: 1fr; }
.luf-choice { grid-template-columns: 5.5rem 1fr; }
+ .luf-modal { padding: 0.4rem; align-items: stretch; }
+ .luf-modal-card, .luf-modal-narrow { width: 100%; max-height: calc(100vh - 0.8rem); }
}
diff --git a/routes/web.php b/routes/web.php
index f0a2375..f7034c2 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -42,6 +42,9 @@
Route::get('/redaktion/aufbau/{composition}/{version?}', [EditorialPreviewController::class, 'show'])
->middleware('auth:staff')
->name('editorial.preview');
+Route::get('/redaktion/frame/{version}', [EditorialPreviewController::class, 'frame'])
+ ->middleware('auth:staff')
+ ->name('editorial.frame');
Route::get('/redaktion/karte/{kind}/{subject}', [EditorialPreviewController::class, 'card'])
->middleware('auth:staff')
->whereIn('kind', ['element', 'komposition'])
diff --git a/tests/Feature/EditorialEditorTest.php b/tests/Feature/EditorialEditorTest.php
index 8759a12..bed9aa0 100644
--- a/tests/Feature/EditorialEditorTest.php
+++ b/tests/Feature/EditorialEditorTest.php
@@ -7,6 +7,7 @@
use App\Domain\Catalog\CompositionKind;
use App\Domain\Catalog\ContentElementVersion;
use App\Domain\Catalog\ContentService;
+use App\Domain\Catalog\ContentVersionStatus;
use App\Filament\Pages\EditorialDesk;
use App\Filament\Resources\Courses\CourseResource;
use App\Filament\Resources\Courses\Pages\EditCourse;
@@ -337,6 +338,8 @@ public function test_catalog_cards_show_text_status_and_a_single_film_suggestion
->assertSee('In Mitgliederbibliothek anzeigen')
->assertSee('Vorschlag aus dem Film Lara im Park')
->assertSee('Katalogvorschau')
+ ->assertSee('Modul bearbeiten')
+ ->assertDontSee('Anzeige speichern')
->assertDontSee('Zur Anzeige freigeben');
}
@@ -357,8 +360,15 @@ public function test_a_chosen_picture_and_description_do_not_create_a_version():
Livewire::actingAs($editor, 'staff')
->test(EditExercise::class, ['record' => $version->composition_id])
- ->assertSee('Lara im Park als Titelbild')
- ->assertSee('Lara im Hof als Titelbild')
+ ->call('openModule')
+ ->set('moduleTab', 'titelbild')
+ ->assertSee('Aus Film')
+ ->assertSee('Vorhandenes Bild')
+ ->assertSee('Hochladen')
+ ->assertSee('Lara im Park')
+ ->assertSee('Lara im Hof')
+ ->assertDontSee('Anzeige speichern')
+ ->assertDontSee('Titelbild speichern')
->assertDontSee('Vorschlag aus dem Film')
->call('adoptPicture', $first->element->id)
->assertSet('feedback', 'Das Vorschaubild ist gespeichert. Die Fassung bleibt unverändert.')
@@ -377,6 +387,145 @@ public function test_a_chosen_picture_and_description_do_not_create_a_version():
$this->get('/medien/'.$composition->thumbnail_path)->assertNotFound();
}
+ public function test_the_module_dialog_saves_text_without_a_new_version(): void
+ {
+ $content = app(ContentService::class);
+ $sheet = $content->publishElementVersion($content->createElement('text', 'text', 'Blatt'), 'Hinweis');
+ $version = $content->publishComposition(
+ $content->createComposition('Dialog Modul', CompositionKind::Uebung),
+ [['role' => 'Unterlage', 'target' => $sheet]],
+ );
+ $editor = $this->editor();
+
+ Livewire::actingAs($editor, 'staff')
+ ->test(EditExercise::class, ['record' => $version->composition_id])
+ ->assertDontSee('Anzeige speichern')
+ ->call('openModule')
+ ->assertSee('Beschreibung')
+ ->assertSee('Didaktik')
+ ->assertSee('Einordnung')
+ ->assertSee('Titelbild')
+ ->set('description', 'Weg damit')
+ ->call('closeModule')
+ ->assertSet('description', '');
+
+ Livewire::actingAs($editor, 'staff')
+ ->test(EditExercise::class, ['record' => $version->composition_id])
+ ->set('description', 'Ausführlicher Dialogtext')
+ ->set('summary', 'Kurzer Dialogtext')
+ ->call('saveModule')
+ ->assertSet('moduleOpen', false)
+ ->assertSee('Es entsteht keine neue Fassung');
+
+ $composition = $version->composition->fresh();
+ $this->assertSame(1, $composition->versions()->count());
+ $this->assertSame('Ausführlicher Dialogtext', $composition->description);
+ $this->assertNull($composition->working_draft);
+
+ Livewire::actingAs($editor, 'staff')
+ ->test(EditExercise::class, ['record' => $version->composition_id])
+ ->set('learningGoal', 'Nur im Entwurf')
+ ->set('durationMinutes', '9')
+ ->call('saveModule');
+
+ $composition->refresh();
+ $this->assertSame(1, $composition->versions()->count());
+ $this->assertSame(ContentVersionStatus::Bereit, $composition->versions()->first()->status);
+ $this->assertSame('Nur im Entwurf', $composition->working_draft['learning_goal']);
+ $this->assertSame(9, $composition->working_draft['duration_minutes']);
+ }
+
+ public function test_the_picker_groups_versions_and_adopts_the_chosen_one(): void
+ {
+ $content = app(ContentService::class);
+ $element = $content->createElement('film', 'film', 'Lara im Park');
+ $first = $content->publishElementVersion($element, 'Erste Stelle');
+ $second = $content->publishElementVersion($element, 'Zweite Stelle');
+ $module = $content->createComposition('Fassungswahl', CompositionKind::Uebung);
+
+ $component = Livewire::actingAs($this->editor(), 'staff')
+ ->test(EditExercise::class, ['record' => $module->id])
+ ->call('openPicker')
+ ->set('pickerQuery', 'Lara')
+ ->set('pickerSelected', 'element:'.$second->id);
+
+ $items = $component->instance()->pickerResult()['items'];
+ $this->assertCount(1, $items);
+ $this->assertSame('element:'.$second->id, $items[0]['target']);
+
+ $component
+ ->assertSee('Fassung 1')
+ ->assertSee('aktueller Stand')
+ ->set('pickerSelected', 'element:'.$first->id)
+ ->call('addPart', 'element:'.$first->id);
+ $module->refresh();
+ $this->assertSame(0, $module->versions()->count());
+ $this->assertSame('element:'.$first->id, $module->working_draft['members'][0]['target']);
+ }
+
+ public function test_the_part_dialog_saves_a_role_without_a_new_version(): void
+ {
+ $content = app(ContentService::class);
+ $sheet = $content->publishElementVersion($content->createElement('text', 'text', 'Blatt'), 'Hinweis');
+ $version = $content->publishComposition(
+ $content->createComposition('Rollendialog', CompositionKind::Uebung),
+ [['role' => 'Unterlage', 'target' => $sheet]],
+ );
+
+ Livewire::actingAs($this->editor(), 'staff')
+ ->test(EditExercise::class, ['record' => $version->composition_id])
+ ->call('openPart', 0)
+ ->assertSee('Bestandteil bearbeiten')
+ ->set('roleDraft', 'Einstieg')
+ ->call('savePart')
+ ->assertSet('partOpen', false)
+ ->assertSee('Es entsteht keine neue Fassung');
+
+ $composition = $version->composition->fresh();
+ $this->assertSame(1, $composition->versions()->count());
+ $this->assertSame('Unterlage', $composition->versions()->first()->members()->first()->role);
+ $this->assertSame('Einstieg', $composition->working_draft['members'][0]['role']);
+ }
+
+ public function test_a_missing_film_frame_does_not_create_a_version(): void
+ {
+ Storage::fake('media_derived');
+ $content = app(ContentService::class);
+ $element = $content->createElement('film', 'film', 'Lara im Park');
+ $film = $content->publishElementVersion($element, null, ['file' => 'inhalte/lara.mp4']);
+ $version = $content->publishComposition(
+ $content->createComposition('Rahmen Modul', CompositionKind::Uebung),
+ [['role' => 'Film', 'target' => $film]],
+ );
+ $editor = $this->editor();
+
+ $this->get(route('editorial.frame', ['version' => $film, 'sekunde' => '4.5']))
+ ->assertRedirect();
+ $this->actingAs($editor, 'staff')
+ ->get(route('editorial.frame', ['version' => $film, 'sekunde' => '4.5']))
+ ->assertNotFound();
+ $this->actingAs($editor, 'staff')
+ ->get(route('editorial.frame', ['version' => $film, 'sekunde' => 'nein']))
+ ->assertNotFound();
+
+ Livewire::actingAs($editor, 'staff')
+ ->test(EditExercise::class, ['record' => $version->composition_id])
+ ->call('openModule')
+ ->set('imageMode', 'film')
+ ->set('frameVersionId', $film->id)
+ ->set('frameSecond', '4.5')
+ ->call('saveModule')
+ ->assertSet('moduleOpen', true);
+
+ $composition = $version->composition->fresh();
+ $film->refresh();
+ $this->assertSame(1, $composition->versions()->count());
+ $this->assertNull($composition->thumbnail_path);
+ $this->assertNotNull($composition->thumbnail_error);
+ $this->assertSame('inhalte/lara.mp4', $film->metadata['file']);
+ Storage::disk('media_derived')->assertMissing('inhalte/lara.mp4');
+ }
+
private function filmWithPicture(ContentService $content, string $title): ContentElementVersion
{
$element = $content->createElement('film', 'film', $title);