Zeige Katalogkarten, Titelbilder und klare Freigabestatus im Arbeitsplatz.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
053a361801
commit
9195cdcd15
15 files changed
+795
-59
No files matched your search
@@ -12,8 +12,10 @@ class Composition extends Model
|
||||
'designation',
|
||||
'display_title',
|
||||
'summary',
|
||||
'description',
|
||||
'thumbnail_path',
|
||||
'thumbnail_alt',
|
||||
'thumbnail_source',
|
||||
'thumbnail_error',
|
||||
'public_slug',
|
||||
'kind',
|
||||
|
||||
@@ -41,6 +41,21 @@ public function forCompositionUpload(Composition $composition, string $incoming)
|
||||
}
|
||||
|
||||
$this->still($composition, Storage::disk('cms_incoming'), $incoming, 'komposition-'.$composition->id);
|
||||
$this->rememberChoice($composition, 'eigen');
|
||||
}
|
||||
|
||||
public function forCompositionFromElement(Composition $composition, ContentElement $element): void
|
||||
{
|
||||
$path = $element->thumbnail_path;
|
||||
|
||||
if (! is_string($path) || ! str_starts_with($path, 'vorschau/') || str_contains($path, '..')) {
|
||||
$this->failComposition($composition, 'Für dieses Medium liegt noch kein Vorschaubild vor.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->still($composition, Storage::disk('media_derived'), $path, 'komposition-'.$composition->id);
|
||||
$this->rememberChoice($composition, 'element:'.$element->id);
|
||||
}
|
||||
|
||||
private function frame(ContentElement $element, string $file): void
|
||||
@@ -119,11 +134,27 @@ private function still(ContentElement|Composition $subject, Filesystem $disk, st
|
||||
$path = 'vorschau/'.$name.'.jpg';
|
||||
Storage::disk('media_derived')->put($path, $bytes);
|
||||
$subject->thumbnail_path = $path;
|
||||
$subject->thumbnail_alt = $subject instanceof Composition ? $subject->designation : $subject->working_title;
|
||||
|
||||
if (! ($subject instanceof Composition && filled($subject->thumbnail_alt))) {
|
||||
$subject->thumbnail_alt = $subject instanceof Composition ? $subject->designation : $subject->working_title;
|
||||
}
|
||||
|
||||
$subject->thumbnail_error = null;
|
||||
$subject->save();
|
||||
}
|
||||
|
||||
private function rememberChoice(Composition $composition, string $source): void
|
||||
{
|
||||
$composition->refresh();
|
||||
|
||||
if ($composition->thumbnail_error !== null || ! filled($composition->thumbnail_path)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$composition->thumbnail_source = $source;
|
||||
$composition->save();
|
||||
}
|
||||
|
||||
private function fail(ContentElement $element, string $reason): void
|
||||
{
|
||||
$this->failSubject($element, $reason);
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
|
||||
use App\Domain\Catalog\Composition;
|
||||
use App\Domain\Catalog\CompositionKind;
|
||||
use App\Domain\Catalog\ContentVersionStatus;
|
||||
use App\Domain\Catalog\EditorialDimension;
|
||||
use App\Domain\Catalog\IdentityDimensionValue;
|
||||
use App\Filament\Resources\ContentElements\ContentElementResource;
|
||||
use App\Filament\Support\EditorialCatalog;
|
||||
use Filament\Pages\Page;
|
||||
@@ -31,6 +34,12 @@ class EditorialDesk extends Page
|
||||
#[Url]
|
||||
public string $kindFilter = 'alle';
|
||||
|
||||
#[Url]
|
||||
public string $pillar = '';
|
||||
|
||||
#[Url]
|
||||
public string $visibility = 'alle';
|
||||
|
||||
public string $programName = '';
|
||||
|
||||
public string $moduleName = '';
|
||||
@@ -58,18 +67,55 @@ public static function canAccess(): bool
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array{title: string, kind: string, stand: string, url: string, summary: string}>
|
||||
* @return list<array{label: string, values: list<array{id: int, label: string}>}>
|
||||
*/
|
||||
public function dimensionFilters(): array
|
||||
{
|
||||
$groups = [];
|
||||
|
||||
foreach (EditorialDimension::query()->with('values')->orderBy('label')->get() as $dimension) {
|
||||
$values = [];
|
||||
|
||||
foreach ($dimension->values as $value) {
|
||||
$values[] = ['id' => $value->id, 'label' => $value->label];
|
||||
}
|
||||
|
||||
if ($values !== []) {
|
||||
$groups[] = ['label' => $dimension->label, 'values' => $values];
|
||||
}
|
||||
}
|
||||
|
||||
return $groups;
|
||||
}
|
||||
|
||||
public function resetFilters(): void
|
||||
{
|
||||
$this->query = '';
|
||||
$this->kindFilter = 'alle';
|
||||
$this->pillar = '';
|
||||
$this->visibility = 'alle';
|
||||
}
|
||||
|
||||
public function hasActiveFilters(): bool
|
||||
{
|
||||
return trim($this->query) !== '' || $this->kindFilter !== 'alle' || $this->pillar !== '' || $this->visibility !== 'alle';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array<string, mixed>>
|
||||
*/
|
||||
public function entries(): array
|
||||
{
|
||||
$query = trim($this->query);
|
||||
$needle = mb_strtolower($query);
|
||||
$catalog = app(EditorialCatalog::class);
|
||||
$offered = $catalog->offeredCompositionIds();
|
||||
$pillarIds = $this->pillar === '' ? null : $this->pillarSubjects((int) $this->pillar);
|
||||
$rows = [];
|
||||
|
||||
$compositions = Composition::query()
|
||||
->whereIn('kind', [CompositionKind::Kurs, CompositionKind::Uebung])
|
||||
->with(['editorialContentKind', 'versions'])
|
||||
->with(['editorialContentKind', 'versions.members.contentElementVersion.element'])
|
||||
->orderBy('designation')
|
||||
->get();
|
||||
|
||||
@@ -77,7 +123,6 @@ public function entries(): array
|
||||
$kind = $composition->kind instanceof CompositionKind
|
||||
? $composition->kind
|
||||
: CompositionKind::from((string) $composition->kind);
|
||||
$label = $kind->deskLabel();
|
||||
|
||||
if ($this->kindFilter === 'programm' && $kind !== CompositionKind::Kurs) {
|
||||
continue;
|
||||
@@ -87,26 +132,98 @@ public function entries(): array
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($pillarIds !== null && ! in_array($composition->id, $pillarIds, true)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$stand = $catalog->stand($composition);
|
||||
|
||||
if (! $this->matchesVisibility($stand)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$title = $catalog->compositionTitle($composition);
|
||||
$haystack = mb_strtolower($title.' '.$composition->designation.' '.(string) $composition->summary);
|
||||
$summary = (string) ($composition->summary ?? '');
|
||||
$haystack = mb_strtolower($title.' '.$composition->designation.' '.$summary.' '.(string) $composition->description);
|
||||
|
||||
if ($needle !== '' && ! str_contains($haystack, $needle)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$cover = $catalog->cover($composition, $this->coverMembers($composition));
|
||||
$rows[] = [
|
||||
'title' => $title,
|
||||
'kind' => $label,
|
||||
'kind' => $kind->deskLabel(),
|
||||
'tone' => $kind === CompositionKind::Kurs ? 'programm' : 'modul',
|
||||
'stand' => $catalog->stand($composition)['text'],
|
||||
'summary' => $summary,
|
||||
'url' => EditorialCatalog::editUrl($composition),
|
||||
'summary' => (string) ($composition->summary ?? ''),
|
||||
'image' => $cover['url'],
|
||||
'image_note' => $cover['note'],
|
||||
'chips' => $catalog->statusChips($composition, in_array($composition->id, $offered, true)),
|
||||
];
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array{target: string}>
|
||||
*/
|
||||
private function coverMembers(Composition $composition): array
|
||||
{
|
||||
$draft = $composition->working_draft;
|
||||
|
||||
if (is_array($draft) && is_array($draft['members'] ?? null) && $draft['members'] !== []) {
|
||||
return $draft['members'];
|
||||
}
|
||||
|
||||
$version = $composition->versions
|
||||
->filter(fn ($item): bool => $item->status === ContentVersionStatus::Bereit)
|
||||
->sortByDesc('number')
|
||||
->first();
|
||||
|
||||
if ($version === null) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$members = [];
|
||||
|
||||
foreach ($version->members as $member) {
|
||||
$target = $member->content_element_version_id
|
||||
? 'element:'.$member->content_element_version_id
|
||||
: 'composition:'.$member->nested_composition_version_id;
|
||||
$members[] = ['target' => $target];
|
||||
}
|
||||
|
||||
return $members;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<int>
|
||||
*/
|
||||
private function pillarSubjects(int $valueId): array
|
||||
{
|
||||
return IdentityDimensionValue::query()
|
||||
->where('subject_type', (new Composition)->getMorphClass())
|
||||
->where('editorial_dimension_value_id', $valueId)
|
||||
->pluck('subject_id')
|
||||
->map(fn (mixed $id): int => (int) $id)
|
||||
->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array{text: string, number: int|null, released_number: int|null} $stand
|
||||
*/
|
||||
private function matchesVisibility(array $stand): bool
|
||||
{
|
||||
return match ($this->visibility) {
|
||||
'bibliothek' => $stand['released_number'] !== null,
|
||||
'verborgen' => $stand['number'] !== null && $stand['released_number'] === null,
|
||||
'entwurf' => $stand['number'] === null,
|
||||
default => true,
|
||||
};
|
||||
}
|
||||
|
||||
public function createProgram(): void
|
||||
{
|
||||
$this->create(CompositionKind::Kurs, $this->programName);
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
use App\Domain\Catalog\CompositionKind;
|
||||
use App\Domain\Catalog\CompositionStructureReader;
|
||||
use App\Domain\Catalog\CompositionVersion;
|
||||
use App\Domain\Catalog\ContentElement;
|
||||
use App\Domain\Catalog\ContentElementVersion;
|
||||
use App\Domain\Catalog\ContentService;
|
||||
use App\Domain\Catalog\ContentVersionStatus;
|
||||
@@ -42,6 +43,8 @@ abstract class EditComposition extends EditRecord
|
||||
|
||||
public string $summary = '';
|
||||
|
||||
public string $description = '';
|
||||
|
||||
public string $learningGoal = '';
|
||||
|
||||
public string $durationMinutes = '';
|
||||
@@ -92,8 +95,12 @@ abstract class EditComposition extends EditRecord
|
||||
|
||||
public ?string $thumbnailPath = null;
|
||||
|
||||
public string $thumbnailAlt = '';
|
||||
|
||||
public ?string $thumbnailError = null;
|
||||
|
||||
public string $imageQuery = '';
|
||||
|
||||
/** @var list<array<string, string|null>> */
|
||||
public array $members = [];
|
||||
|
||||
@@ -150,10 +157,10 @@ protected function getHeaderActions(): array
|
||||
->openUrlInNewTab()
|
||||
->visible(fn (): bool => $this->previewUrl() !== null),
|
||||
Action::make('displayRelease')
|
||||
->label('Zur Anzeige freigeben')
|
||||
->label('In Mitgliederbibliothek anzeigen')
|
||||
->requiresConfirmation()
|
||||
->modalHeading('Diese Fassung zur Anzeige freigeben')
|
||||
->modalDescription('Freigegeben wird die zuletzt übernommene Fassung. Eine frühere Fassung bleibt unverändert. Ungespeicherte Änderungen am Aufbau sind nicht Teil dieser Freigabe.')
|
||||
->modalHeading('In der Mitgliederbibliothek anzeigen')
|
||||
->modalDescription('Sichtbar wird die zuletzt übernommene Fassung. Das ist keine Website-Veröffentlichung und kein aktives Angebot. Eine frühere Fassung bleibt unverändert. Ungespeicherte Änderungen am Aufbau sind nicht Teil dieser Freigabe.')
|
||||
->visible(function (): bool {
|
||||
$version = $this->currentReadyVersion();
|
||||
|
||||
@@ -163,10 +170,10 @@ protected function getHeaderActions(): array
|
||||
$this->releaseDisplay();
|
||||
}),
|
||||
Action::make('displayRevoke')
|
||||
->label('Anzeige zurücknehmen')
|
||||
->label('Aus Mitgliederbibliothek ausblenden')
|
||||
->color('danger')
|
||||
->requiresConfirmation()
|
||||
->modalDescription('Nur die Anzeige dieser Fassung wird zurückgenommen. Der Inhalt der Fassung bleibt gespeichert.')
|
||||
->modalDescription('Die Fassung verschwindet aus der Mitgliederbibliothek. Der fachliche Inhalt bleibt gespeichert. Website und Angebot sind davon unabhängig.')
|
||||
->visible(function (): bool {
|
||||
$version = $this->currentReadyVersion();
|
||||
|
||||
@@ -177,7 +184,7 @@ protected function getHeaderActions(): array
|
||||
$actor = $this->actor();
|
||||
abort_unless($version !== null && $actor instanceof User, 403);
|
||||
app(CompositionDisplayRelease::class)->revoke($version, $actor);
|
||||
$this->feedback = 'Die Anzeige dieser Fassung ist zurückgenommen. Der Inhalt bleibt gespeichert.';
|
||||
$this->feedback = 'Die Fassung ist aus der Mitgliederbibliothek ausgeblendet. Der Inhalt bleibt gespeichert.';
|
||||
}),
|
||||
];
|
||||
}
|
||||
@@ -370,8 +377,8 @@ public function editorStatus(): string
|
||||
$display = $version === null
|
||||
? ''
|
||||
: (app(CompositionDisplayRelease::class)->isReleased($version)
|
||||
? ' Sie ist zur Anzeige freigegeben.'
|
||||
: ' Sie ist noch nicht zur Anzeige freigegeben.');
|
||||
? ' Sie ist in der Mitgliederbibliothek sichtbar.'
|
||||
: ' Sie ist nicht in der Mitgliederbibliothek.');
|
||||
$unsaved = $stored === null
|
||||
? $current !== $ready
|
||||
: $current !== $this->fingerprint($stored);
|
||||
@@ -453,7 +460,7 @@ public function versionChoices(): array
|
||||
$rows[] = [
|
||||
'id' => $version->id,
|
||||
'number' => $version->number,
|
||||
'text' => 'Fassung '.$version->number.($released ? ', zur Anzeige freigegeben' : ''),
|
||||
'text' => 'Fassung '.$version->number.($released ? ', in der Mitgliederbibliothek' : ', nicht in der Mitgliederbibliothek'),
|
||||
'current' => $latest !== null && $latest->id === $version->id,
|
||||
];
|
||||
}
|
||||
@@ -734,6 +741,8 @@ public function saveDisplay(): void
|
||||
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();
|
||||
@@ -778,6 +787,82 @@ public function savePreviewImage(string $storedPath): void
|
||||
$this->storePreview($storedPath);
|
||||
}
|
||||
|
||||
public function adoptPicture(int $elementId): void
|
||||
{
|
||||
$element = ContentElement::query()->find($elementId);
|
||||
$path = $element?->thumbnail_path;
|
||||
|
||||
if (! $element instanceof ContentElement || ! is_string($path) || ! str_starts_with($path, 'vorschau/') || str_contains($path, '..')) {
|
||||
$this->feedback = 'Für dieses Medium liegt noch kein Vorschaubild vor.';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var Composition $record */
|
||||
$record = $this->getRecord();
|
||||
$before = $record->versions()->count();
|
||||
DeriveThumbnail::dispatch('komposition', $record->id, null, $element->id);
|
||||
$record->refresh();
|
||||
$this->thumbnailPath = $record->thumbnail_path;
|
||||
$this->thumbnailError = $record->thumbnail_error;
|
||||
$this->feedback = $this->previewFeedback($record, $before);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{url: ?string, note: ?string, own: bool}
|
||||
*/
|
||||
public function coverPicture(): array
|
||||
{
|
||||
/** @var Composition $composition */
|
||||
$composition = $this->getRecord();
|
||||
|
||||
return app(EditorialCatalog::class)->cover($composition, $this->members);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array{id: int, title: string, image: string}>
|
||||
*/
|
||||
public function filmChoices(): array
|
||||
{
|
||||
$films = app(EditorialCatalog::class)->filmPictures($this->members);
|
||||
|
||||
return count($films) > 1 ? $films : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{id: int, title: string, image: string}|null
|
||||
*/
|
||||
public function suggestedFilm(): ?array
|
||||
{
|
||||
if (filled($this->thumbnailPath)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$films = app(EditorialCatalog::class)->filmPictures($this->members);
|
||||
|
||||
return count($films) === 1 ? $films[0] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array{id: int, title: string, image: string, kind: string}>
|
||||
*/
|
||||
public function mediaChoices(): array
|
||||
{
|
||||
return app(EditorialCatalog::class)->mediaPictures($this->imageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array{label: string, tone: string}>
|
||||
*/
|
||||
public function presentationChips(): array
|
||||
{
|
||||
/** @var Composition $composition */
|
||||
$composition = $this->getRecord();
|
||||
$offered = in_array($composition->id, app(EditorialCatalog::class)->offeredCompositionIds(), true);
|
||||
|
||||
return app(EditorialCatalog::class)->statusChips($composition, $offered);
|
||||
}
|
||||
|
||||
public function publishRevision(): bool
|
||||
{
|
||||
$this->commitRoleDraft();
|
||||
@@ -910,7 +995,9 @@ protected function loadEditor(): void
|
||||
$this->designation = $composition->designation;
|
||||
$this->displayTitle = (string) ($composition->display_title ?? '');
|
||||
$this->summary = (string) ($composition->summary ?? '');
|
||||
$this->description = (string) ($composition->description ?? '');
|
||||
$this->thumbnailPath = $composition->thumbnail_path;
|
||||
$this->thumbnailAlt = (string) ($composition->thumbnail_alt ?? '');
|
||||
$this->thumbnailError = $composition->thumbnail_error;
|
||||
$this->dimensionIds = IdentityDimensionValue::query()
|
||||
->where('subject_type', $composition->getMorphClass())
|
||||
@@ -1034,7 +1121,7 @@ protected function releaseCurrent(): void
|
||||
}
|
||||
|
||||
app(CompositionDisplayRelease::class)->release($version, $actor);
|
||||
$this->feedback = 'Fassung '.$version->number.' ist zur Anzeige freigegeben. Frühere Fassungen bleiben erhalten.';
|
||||
$this->feedback = 'Fassung '.$version->number.' ist in der Mitgliederbibliothek sichtbar. Frühere Fassungen bleiben erhalten.';
|
||||
}
|
||||
|
||||
protected function currentReadyVersion(): ?CompositionVersion
|
||||
@@ -1156,9 +1243,24 @@ protected function storePreview(string $path): void
|
||||
$record->refresh();
|
||||
$this->thumbnailPath = $record->thumbnail_path;
|
||||
$this->thumbnailError = $record->thumbnail_error;
|
||||
$this->feedback = $record->versions()->count() === $before && filled($record->thumbnail_path)
|
||||
? 'Das Vorschaubild ist gespeichert. Die Fassung bleibt unverändert.'
|
||||
: ($record->thumbnail_error ?: 'Das Vorschaubild wurde nicht übernommen.');
|
||||
$this->feedback = $this->previewFeedback($record, $before);
|
||||
}
|
||||
|
||||
protected function previewFeedback(Composition $record, int $versionsBefore): string
|
||||
{
|
||||
if ($record->versions()->count() !== $versionsBefore) {
|
||||
return 'Das Vorschaubild wurde nicht übernommen.';
|
||||
}
|
||||
|
||||
if (filled($record->thumbnail_path) && $record->thumbnail_error === null) {
|
||||
return 'Das Vorschaubild ist gespeichert. Die Fassung bleibt unverändert.';
|
||||
}
|
||||
|
||||
if (config('queue.default') !== 'sync') {
|
||||
return 'Das Titelbild wird vorbereitet. Die Fassung bleibt unverändert.';
|
||||
}
|
||||
|
||||
return $record->thumbnail_error ?: 'Das Vorschaubild wurde nicht übernommen.';
|
||||
}
|
||||
|
||||
protected function statusSentence(): string
|
||||
|
||||
@@ -14,11 +14,14 @@
|
||||
use App\Domain\Catalog\ContentVersionStatus;
|
||||
use App\Domain\Catalog\EditorialContentKind;
|
||||
use App\Domain\Catalog\IdentityDimensionValue;
|
||||
use App\Domain\Catalog\LicenseArticle;
|
||||
use App\Domain\Catalog\OfferStatus;
|
||||
use App\Filament\Resources\Combinations\CombinationResource;
|
||||
use App\Filament\Resources\Courses\CourseResource;
|
||||
use App\Filament\Resources\Exercises\ExerciseResource;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class EditorialCatalog
|
||||
{
|
||||
@@ -447,20 +450,202 @@ public function stand(Composition $composition): array
|
||||
];
|
||||
}
|
||||
|
||||
$text = 'Fassung '.$latest->number.($release->isReleased($latest) ? ', zur Anzeige freigegeben' : ', noch nicht zur Anzeige freigegeben');
|
||||
$visible = $released instanceof CompositionVersion;
|
||||
$text = 'Fassung '.$latest->number.($visible ? ', in der Mitgliederbibliothek' : ', nicht in der Mitgliederbibliothek');
|
||||
$text = ($draft ? 'Entwurf gespeichert. ' : '').$text;
|
||||
|
||||
if ($released instanceof CompositionVersion && $released->number !== $latest->number) {
|
||||
if ($visible && $released->number !== $latest->number) {
|
||||
$text .= '. Angezeigt wird Fassung '.$released->number;
|
||||
}
|
||||
|
||||
return [
|
||||
'text' => $text,
|
||||
'number' => $latest->number,
|
||||
'released_number' => $released instanceof CompositionVersion ? $released->number : null,
|
||||
'released_number' => $visible ? $released->number : null,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array{label: string, tone: string}>
|
||||
*/
|
||||
public function statusChips(Composition $composition, bool $offered): array
|
||||
{
|
||||
$stand = $this->stand($composition);
|
||||
$chips = [];
|
||||
|
||||
if ($stand['number'] === null) {
|
||||
$chips[] = [
|
||||
'label' => str_contains($stand['text'], 'Entwurf') ? 'Entwurf gespeichert' : 'Noch ohne Fassung',
|
||||
'tone' => 'yellow',
|
||||
];
|
||||
} else {
|
||||
$chips[] = ['label' => 'Fassung '.$stand['number'], 'tone' => 'ink'];
|
||||
|
||||
if (str_starts_with($stand['text'], 'Entwurf gespeichert')) {
|
||||
$chips[] = ['label' => 'Entwurf offen', 'tone' => 'yellow'];
|
||||
}
|
||||
|
||||
$chips[] = $stand['released_number'] !== null
|
||||
? ['label' => 'In der Mitgliederbibliothek', 'tone' => 'pine']
|
||||
: ['label' => 'Nicht in der Mitgliederbibliothek', 'tone' => 'quiet'];
|
||||
|
||||
if ($stand['released_number'] !== null && $stand['released_number'] !== $stand['number']) {
|
||||
$chips[] = ['label' => 'Bibliothek zeigt Fassung '.$stand['released_number'], 'tone' => 'pine'];
|
||||
}
|
||||
}
|
||||
|
||||
$chips[] = ['label' => 'Nicht auf der Website', 'tone' => 'quiet'];
|
||||
$chips[] = $offered
|
||||
? ['label' => 'Angebot aktiv', 'tone' => 'pine']
|
||||
: ['label' => 'Kein aktives Angebot', 'tone' => 'quiet'];
|
||||
|
||||
return $chips;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<int>
|
||||
*/
|
||||
public function offeredCompositionIds(): array
|
||||
{
|
||||
$articleIds = DB::table('resolved_scopes')
|
||||
->join('offer_versions', 'offer_versions.id', '=', 'resolved_scopes.offer_version_id')
|
||||
->where('offer_versions.status', OfferStatus::Aktiv->value)
|
||||
->pluck('resolved_scopes.license_article_id');
|
||||
|
||||
if ($articleIds->isEmpty()) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$releaseIds = LicenseArticle::query()
|
||||
->whereIn('id', $articleIds)
|
||||
->whereNotNull('current_release_id')
|
||||
->pluck('current_release_id');
|
||||
$versionIds = ArticleRelease::query()
|
||||
->whereIn('id', $releaseIds)
|
||||
->whereNotNull('root_composition_version_id')
|
||||
->pluck('root_composition_version_id');
|
||||
|
||||
return CompositionVersion::query()
|
||||
->whereIn('id', $versionIds)
|
||||
->pluck('composition_id')
|
||||
->map(fn (mixed $id): int => (int) $id)
|
||||
->unique()
|
||||
->values()
|
||||
->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<array<string, mixed>> $members
|
||||
* @return list<array{id: int, title: string, image: string}>
|
||||
*/
|
||||
public function filmPictures(array $members): array
|
||||
{
|
||||
$versionIds = [];
|
||||
|
||||
foreach ($members as $member) {
|
||||
$target = (string) ($member['target'] ?? '');
|
||||
|
||||
if (preg_match('/^element:(\d+)$/', $target, $match) === 1) {
|
||||
$versionIds[] = (int) $match[1];
|
||||
}
|
||||
}
|
||||
|
||||
if ($versionIds === []) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$pictures = [];
|
||||
|
||||
foreach (ContentElementVersion::query()->with('element')->whereIn('id', $versionIds)->get() as $version) {
|
||||
$element = $version->element;
|
||||
|
||||
if (! $element instanceof ContentElement || $element->output_class !== 'film') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$image = $this->cardUrl('element', $element->id, $element->thumbnail_path);
|
||||
|
||||
if ($image === null || isset($pictures[$element->id])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$pictures[$element->id] = [
|
||||
'id' => $element->id,
|
||||
'title' => filled($element->display_title) ? $element->display_title : $element->working_title,
|
||||
'image' => $image,
|
||||
];
|
||||
}
|
||||
|
||||
return array_values($pictures);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array{id: int, title: string, image: string, kind: string}>
|
||||
*/
|
||||
public function mediaPictures(string $query): array
|
||||
{
|
||||
$query = trim($query);
|
||||
|
||||
if (mb_strlen($query) < 2) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$like = '%'.str_replace(['%', '_'], ['', ''], $query).'%';
|
||||
|
||||
return ContentElement::query()
|
||||
->where('thumbnail_path', 'like', 'vorschau/%')
|
||||
->where(function ($builder) use ($like): void {
|
||||
$builder->where('working_title', 'like', $like)
|
||||
->orWhere('display_title', 'like', $like)
|
||||
->orWhere('summary', 'like', $like);
|
||||
})
|
||||
->orderBy('working_title')
|
||||
->limit(12)
|
||||
->get()
|
||||
->map(function (ContentElement $element): ?array {
|
||||
$image = $this->cardUrl('element', $element->id, $element->thumbnail_path);
|
||||
|
||||
if ($image === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return [
|
||||
'id' => $element->id,
|
||||
'title' => filled($element->display_title) ? $element->display_title : $element->working_title,
|
||||
'image' => $image,
|
||||
'kind' => $element->editorialContentKind?->label ?: $this->outputLabel((string) $element->output_class),
|
||||
];
|
||||
})
|
||||
->filter()
|
||||
->values()
|
||||
->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<array<string, mixed>> $members
|
||||
* @return array{url: ?string, note: ?string, own: bool}
|
||||
*/
|
||||
public function cover(Composition $composition, array $members): array
|
||||
{
|
||||
$own = $this->cardUrl('komposition', $composition->id, $composition->thumbnail_path);
|
||||
|
||||
if ($own !== null) {
|
||||
return ['url' => $own, 'note' => null, 'own' => true];
|
||||
}
|
||||
|
||||
$films = $this->filmPictures($members);
|
||||
|
||||
if (count($films) === 1) {
|
||||
return [
|
||||
'url' => $films[0]['image'],
|
||||
'note' => 'Vorschlag aus dem Film '.$films[0]['title'],
|
||||
'own' => false,
|
||||
];
|
||||
}
|
||||
|
||||
return ['url' => null, 'note' => null, 'own' => false];
|
||||
}
|
||||
|
||||
public function create(string $designation, CompositionKind $kind): Composition
|
||||
{
|
||||
$composition = app(ContentService::class)->createComposition($designation, $kind);
|
||||
|
||||
@@ -133,6 +133,7 @@ private function render(
|
||||
return view('filament.editorial.preview', [
|
||||
'title' => $catalog->compositionTitle($composition),
|
||||
'summary' => $composition->summary,
|
||||
'description' => $composition->description,
|
||||
'kind' => $composition->editorialContentKind?->label
|
||||
?? ($composition->kind?->deskLabel()),
|
||||
'learningGoal' => $learningGoal,
|
||||
|
||||
@@ -16,6 +16,7 @@ public function __construct(
|
||||
public readonly string $subject,
|
||||
public readonly int $subjectId,
|
||||
public readonly ?string $incoming = null,
|
||||
public readonly ?int $fromElement = null,
|
||||
) {}
|
||||
|
||||
public function handle(ThumbnailDeriver $deriver): void
|
||||
@@ -23,7 +24,21 @@ public function handle(ThumbnailDeriver $deriver): void
|
||||
if ($this->subject === 'komposition') {
|
||||
$composition = Composition::query()->find($this->subjectId);
|
||||
|
||||
if ($composition !== null && is_string($this->incoming)) {
|
||||
if ($composition === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->fromElement !== null) {
|
||||
$element = ContentElement::query()->find($this->fromElement);
|
||||
|
||||
if ($element !== null) {
|
||||
$deriver->forCompositionFromElement($composition, $element);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_string($this->incoming)) {
|
||||
$deriver->forCompositionUpload($composition, $this->incoming);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('compositions', function (Blueprint $table) {
|
||||
$table->text('description')->nullable()->after('summary');
|
||||
$table->string('thumbnail_source')->nullable()->after('thumbnail_alt');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('compositions', function (Blueprint $table) {
|
||||
$table->dropColumn(['description', 'thumbnail_source']);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
@php
|
||||
$summary = \Illuminate\Support\Str::limit(trim((string) ($card['summary'] ?? '')), 160);
|
||||
@endphp
|
||||
<a class="luf-catalog luf-tone-{{ $card['tone'] }}" href="{{ $card['url'] }}">
|
||||
<span class="luf-figure">
|
||||
@if (! empty($card['image']))
|
||||
<img src="{{ $card['image'] }}" alt="">
|
||||
@else
|
||||
<svg class="luf-mark" viewBox="0 0 160 90" aria-hidden="true">
|
||||
<rect x="8" y="12" width="144" height="66" fill="none" stroke="currentColor" stroke-width="3"/>
|
||||
<path d="M28 58 V32 H52 V58 M68 58 V24 H92 V58 M108 58 V38 H132 V58" fill="none" stroke="currentColor" stroke-width="3"/>
|
||||
</svg>
|
||||
<span class="luf-sr">Kein Titelbild</span>
|
||||
@endif
|
||||
@if (! empty($card['image_note']))
|
||||
<span class="luf-figure-note">{{ $card['image_note'] }}</span>
|
||||
@endif
|
||||
</span>
|
||||
<span class="luf-catalog-body">
|
||||
<span class="luf-kind">{{ $card['kind'] }}</span>
|
||||
<strong>{{ $card['title'] }}</strong>
|
||||
<span class="luf-summary">{{ $summary !== '' ? $summary : 'Noch keine Kurzbeschreibung' }}</span>
|
||||
<span class="luf-chips">
|
||||
@foreach ($card['chips'] as $chip)
|
||||
<span class="luf-chip luf-chip-{{ $chip['tone'] }}">{{ $chip['label'] }}</span>
|
||||
@endforeach
|
||||
</span>
|
||||
</span>
|
||||
</a>
|
||||
@@ -19,32 +19,48 @@
|
||||
<div class="luf-toolbar">
|
||||
<div class="luf-field">
|
||||
<label for="redaktion-suche">Suche</label>
|
||||
<input id="redaktion-suche" type="search" wire:model.live.debounce.300ms="query" placeholder="Name oder Kurzbeschreibung">
|
||||
<input id="redaktion-suche" type="search" wire:model.live.debounce.300ms="query" placeholder="Titel oder Kurzbeschreibung">
|
||||
</div>
|
||||
<div class="luf-scopes" role="group" aria-label="Art">
|
||||
<button type="button" class="luf-quiet" wire:click="$set('kindFilter', 'alle')" aria-pressed="{{ $this->kindFilter === 'alle' ? 'true' : 'false' }}">Alle</button>
|
||||
<button type="button" class="luf-quiet" wire:click="$set('kindFilter', 'programm')" aria-pressed="{{ $this->kindFilter === 'programm' ? 'true' : 'false' }}">Programme</button>
|
||||
<button type="button" class="luf-quiet" wire:click="$set('kindFilter', 'modul')" aria-pressed="{{ $this->kindFilter === 'modul' ? 'true' : 'false' }}">Module</button>
|
||||
</div>
|
||||
<div class="luf-scopes" role="group" aria-label="Sichtbarkeit">
|
||||
<button type="button" class="luf-quiet" wire:click="$set('visibility', 'alle')" aria-pressed="{{ $this->visibility === 'alle' ? 'true' : 'false' }}">Jeder Stand</button>
|
||||
<button type="button" class="luf-quiet" wire:click="$set('visibility', 'bibliothek')" aria-pressed="{{ $this->visibility === 'bibliothek' ? 'true' : 'false' }}">In der Bibliothek</button>
|
||||
<button type="button" class="luf-quiet" wire:click="$set('visibility', 'verborgen')" aria-pressed="{{ $this->visibility === 'verborgen' ? 'true' : 'false' }}">Nicht in der Bibliothek</button>
|
||||
<button type="button" class="luf-quiet" wire:click="$set('visibility', 'entwurf')" aria-pressed="{{ $this->visibility === 'entwurf' ? 'true' : 'false' }}">Nur Entwürfe</button>
|
||||
</div>
|
||||
@if ($this->dimensionFilters() !== [])
|
||||
<div class="luf-field">
|
||||
<label for="redaktion-saeule">Fachliche Einordnung</label>
|
||||
<select id="redaktion-saeule" wire:model.live="pillar">
|
||||
<option value="">Alle Einordnungen</option>
|
||||
@foreach ($this->dimensionFilters() as $group)
|
||||
<optgroup label="{{ $group['label'] }}">
|
||||
@foreach ($group['values'] as $value)
|
||||
<option value="{{ $value['id'] }}">{{ $value['label'] }}</option>
|
||||
@endforeach
|
||||
</optgroup>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@if ($this->entries() === [])
|
||||
<p class="luf-empty">{{ trim($this->query) === '' ? 'Noch keine Programme oder Module.' : 'Nichts gefunden. Prüfe die Schreibweise oder lege oben einen neuen Eintrag an.' }}</p>
|
||||
<div class="luf-empty">
|
||||
@if ($this->hasActiveFilters())
|
||||
<p>Nichts gefunden. Prüfe die Schreibweise oder setze die Filter zurück.</p>
|
||||
<button type="button" class="luf-quiet" wire:click="resetFilters">Filter zurücksetzen</button>
|
||||
@else
|
||||
<p>Noch keine Programme oder Module. Der Name oben genügt, um das erste anzulegen.</p>
|
||||
@endif
|
||||
</div>
|
||||
@else
|
||||
<ul class="luf-cards">
|
||||
<ul class="luf-catalogs">
|
||||
@foreach ($this->entries() as $entry)
|
||||
<li>
|
||||
<a class="luf-card luf-tone-{{ $entry['tone'] }}" href="{{ $entry['url'] }}">
|
||||
<span class="luf-thumb luf-fallback" aria-hidden="true">{{ mb_substr($entry['kind'], 0, 1) }}</span>
|
||||
<span>
|
||||
<span class="luf-kind">{{ $entry['kind'] }}</span>
|
||||
<strong>{{ $entry['title'] }}</strong>
|
||||
<span class="luf-meta">{{ $entry['stand'] }}</span>
|
||||
@if ($entry['summary'] !== '')
|
||||
<span class="luf-meta">{{ $entry['summary'] }}</span>
|
||||
@endif
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>@include('filament.editorial.catalog-card', ['card' => $entry])</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
@endif
|
||||
|
||||
@@ -150,18 +150,48 @@
|
||||
@else
|
||||
<p class="luf-kicker">{{ $this->hostLabel() }}</p>
|
||||
<h2>{{ trim($this->displayTitle) !== '' ? $this->displayTitle : $this->designation }}</h2>
|
||||
<p class="luf-note">Name, Anzeigetitel, Kurzbeschreibung, Einordnung und Vorschaubild gelten für die Karte. Sie legen keine Inhaltsfassung an.</p>
|
||||
<p class="luf-note">Titel, Texte, Einordnung und Titelbild beschreiben die Karte. Sie legen keine Inhaltsfassung an. Lernziel, Zeit und Material gehören zum fachlichen Stand darunter.</p>
|
||||
<div class="luf-chips" aria-label="Status">
|
||||
@foreach ($this->presentationChips() as $chip)
|
||||
<span class="luf-chip luf-chip-{{ $chip['tone'] }}">{{ $chip['label'] }}</span>
|
||||
@endforeach
|
||||
</div>
|
||||
@php($cover = $this->coverPicture())
|
||||
<p class="luf-kicker">Katalogvorschau</p>
|
||||
<div class="luf-frame">
|
||||
@if ($cover['url'])
|
||||
<img src="{{ $cover['url'] }}" alt="{{ $this->thumbnailAlt !== '' ? $this->thumbnailAlt : '' }}">
|
||||
@else
|
||||
<svg class="luf-mark" viewBox="0 0 160 90" aria-hidden="true">
|
||||
<rect x="8" y="12" width="144" height="66" fill="none" stroke="currentColor" stroke-width="3"/>
|
||||
<path d="M28 58 V32 H52 V58 M68 58 V24 H92 V58 M108 58 V38 H132 V58" fill="none" stroke="currentColor" stroke-width="3"/>
|
||||
</svg>
|
||||
@endif
|
||||
@if ($cover['note'])
|
||||
<span class="luf-frame-note">{{ $cover['note'] }}</span>
|
||||
@endif
|
||||
</div>
|
||||
<p class="luf-catalog-body" style="padding: 0;">
|
||||
<strong>{{ trim($this->displayTitle) !== '' ? $this->displayTitle : ($this->designation !== '' ? $this->designation : 'Ohne Titel') }}</strong>
|
||||
<span class="luf-summary">{{ trim($this->summary) !== '' ? \Illuminate\Support\Str::limit(trim($this->summary), 160) : 'Noch keine Kurzbeschreibung' }}</span>
|
||||
</p>
|
||||
<div class="luf-field">
|
||||
<label for="name">Name in der Verwaltung</label>
|
||||
<input id="name" type="text" wire:model="designation" required>
|
||||
</div>
|
||||
<div class="luf-field">
|
||||
<label for="anzeige">Anzeigetitel</label>
|
||||
<input id="anzeige" type="text" wire:model="displayTitle" placeholder="Leer lässt den Namen stehen">
|
||||
<label for="anzeige">Titel</label>
|
||||
<input id="anzeige" type="text" wire:model.live.debounce.300ms="displayTitle" placeholder="Leer lässt den Namen stehen">
|
||||
</div>
|
||||
<div class="luf-field">
|
||||
<label for="kurz">Kurzbeschreibung</label>
|
||||
<textarea id="kurz" rows="3" wire:model="summary"></textarea>
|
||||
<textarea id="kurz" rows="3" wire:model.live.debounce.300ms="summary"></textarea>
|
||||
<span class="luf-meta">Steht auf der Katalogkarte.</span>
|
||||
</div>
|
||||
<div class="luf-field">
|
||||
<label for="beschreibung">Fachliche Beschreibung</label>
|
||||
<textarea id="beschreibung" rows="6" wire:model="description"></textarea>
|
||||
<span class="luf-meta">Ausführlicher Text für die Mitgliederbibliothek und eine spätere öffentliche Produktseite. Preis und Nutzungsrechte bleiben beim Angebot.</span>
|
||||
</div>
|
||||
@foreach ($this->dimensionGroups() as $group)
|
||||
<fieldset class="luf-checks">
|
||||
@@ -174,22 +204,49 @@
|
||||
@endforeach
|
||||
</fieldset>
|
||||
@endforeach
|
||||
<p class="luf-meta">
|
||||
@if ($this->thumbnailError)
|
||||
{{ $this->thumbnailError }}
|
||||
@elseif (filled($this->thumbnailPath))
|
||||
Ein Vorschaubild ist hinterlegt.
|
||||
@else
|
||||
Noch kein Vorschaubild.
|
||||
@endif
|
||||
</p>
|
||||
<h3>Titelbild</h3>
|
||||
<p class="luf-note">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.</p>
|
||||
@if ($this->thumbnailError)
|
||||
<p class="luf-feedback" role="status">{{ $this->thumbnailError }}</p>
|
||||
@endif
|
||||
@php($films = $this->filmChoices())
|
||||
@php($suggestion = $this->suggestedFilm())
|
||||
@if ($suggestion)
|
||||
<p class="luf-note">Vorschlag aus dem Film {{ $suggestion['title'] }}.</p>
|
||||
<button type="button" class="luf-quiet" wire:click="adoptPicture({{ $suggestion['id'] }})">Vorschlag als Titelbild übernehmen</button>
|
||||
@endif
|
||||
@if ($films !== [])
|
||||
<p class="luf-note">Mehrere Filme sind enthalten. Wähle das Titelbild.</p>
|
||||
@foreach ($films as $film)
|
||||
<div class="luf-choice">
|
||||
<img src="{{ $film['image'] }}" alt="">
|
||||
<strong>{{ $film['title'] }}</strong>
|
||||
<button type="button" class="luf-quiet" wire:click="adoptPicture({{ $film['id'] }})">{{ $film['title'] }} als Titelbild</button>
|
||||
</div>
|
||||
@endforeach
|
||||
@endif
|
||||
<div class="luf-field">
|
||||
<label for="vorschau-bild">Vorschaubild</label>
|
||||
<label for="bild-alternativ">Alternativtext</label>
|
||||
<input id="bild-alternativ" type="text" wire:model="thumbnailAlt" placeholder="Was das Bild zeigt">
|
||||
</div>
|
||||
<div class="luf-field">
|
||||
<label for="vorschau-bild">Eigenes Titelbild</label>
|
||||
<input id="vorschau-bild" type="file" accept="image/png,image/jpeg,image/webp" wire:model="previewUpload">
|
||||
</div>
|
||||
<div class="luf-field">
|
||||
<label for="bild-suche">Bild aus vorhandenem Medium</label>
|
||||
<input id="bild-suche" type="search" wire:model.live.debounce.300ms="imageQuery" placeholder="Titel des Mediums">
|
||||
</div>
|
||||
@foreach ($this->mediaChoices() as $medium)
|
||||
<div class="luf-choice">
|
||||
<img src="{{ $medium['image'] }}" alt="">
|
||||
<span><span class="luf-kind">{{ $medium['kind'] }}</span><strong>{{ $medium['title'] }}</strong></span>
|
||||
<button type="button" class="luf-quiet" wire:click="adoptPicture({{ $medium['id'] }})">Dieses Bild übernehmen</button>
|
||||
</div>
|
||||
@endforeach
|
||||
<div class="luf-actions">
|
||||
<button type="button" class="luf-primary" wire:click="saveDisplay">Anzeige speichern</button>
|
||||
<button type="button" class="luf-quiet" wire:click="savePreview">Vorschaubild speichern</button>
|
||||
<button type="button" class="luf-quiet" wire:click="savePreview">Titelbild speichern</button>
|
||||
</div>
|
||||
|
||||
<h3>Zum fachlichen Stand</h3>
|
||||
@@ -224,10 +281,10 @@
|
||||
|
||||
<details class="luf-rules">
|
||||
<summary>Was Speichern und Freigeben bedeuten</summary>
|
||||
<p>Anzeigetitel, Kurzbeschreibung, Einordnung und Vorschaubild ändern die sichtbare Karte. Sie erzeugen keine Inhaltsfassung.</p>
|
||||
<p>Titel, Kurzbeschreibung, fachliche Beschreibung, Einordnung und Titelbild ändern die sichtbare Karte. Sie erzeugen keine Inhaltsfassung.</p>
|
||||
<p>Entwurf speichern hält Aufbau, Rollen, Lernziel, Zeit und Material fest. Das kann beliebig oft geschehen. Eine freigegebene Fassung bleibt dabei unverändert.</p>
|
||||
<p>Freigeben erzeugt eine neue unveränderliche Fassung. Die bisherige bleibt für ältere Verweise erhalten.</p>
|
||||
<p>Zur Anzeige freigeben, oben in der Leiste, entscheidet zusätzlich, welche freigegebene Fassung Trainer sehen. Das ist ein eigener Schritt.</p>
|
||||
<p>In Mitgliederbibliothek anzeigen entscheidet, welche freigegebene Fassung Trainer sehen. Das veröffentlicht weder die Website noch ein Angebot.</p>
|
||||
<p>Ein Medium oder Modul, das auch woanders steckt, bleibt dort bei seiner bisherigen Fassung. Hier wird nur darauf verwiesen.</p>
|
||||
</details>
|
||||
</section>
|
||||
|
||||
@@ -35,6 +35,10 @@
|
||||
@if (filled($summary))
|
||||
<p>{{ $summary }}</p>
|
||||
@endif
|
||||
@if (filled($description ?? null))
|
||||
<h2>Beschreibung</h2>
|
||||
<p>{{ $description }}</p>
|
||||
@endif
|
||||
@if (filled($learningGoal))
|
||||
<h2>Lernziel</h2>
|
||||
<p>{{ $learningGoal }}</p>
|
||||
|
||||
@@ -160,6 +160,62 @@
|
||||
.luf-block-main strong, .luf-card strong { display: block; font-size: 1.05rem; }
|
||||
.luf-thumb { width: 3.25rem; height: 3.25rem; object-fit: cover; flex: 0 0 auto; background: #e7eee9; }
|
||||
.luf-fallback { display: inline-flex; align-items: center; justify-content: center; font-family: Georgia, serif; font-size: 1.35rem; color: var(--luf-pine); }
|
||||
.luf-catalogs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(16.5rem, 1fr)); gap: 0.85rem; }
|
||||
.luf-catalog {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
background: #fff;
|
||||
border: 1px solid var(--luf-line);
|
||||
border-top: 4px solid var(--luf-pine);
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
min-width: 0;
|
||||
}
|
||||
.luf-catalog:hover { border-color: var(--luf-pine); }
|
||||
.luf-catalog.luf-tone-programm { border-top-color: var(--luf-pine); }
|
||||
.luf-catalog.luf-tone-modul { border-top-color: #1b2838; }
|
||||
.luf-figure { position: relative; display: block; aspect-ratio: 16 / 9; background: #e7eee9; overflow: hidden; }
|
||||
.luf-figure img, .luf-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
|
||||
.luf-mark { width: 100%; height: 100%; color: var(--luf-pine); background: #e7eee9; }
|
||||
.luf-figure-note, .luf-frame-note {
|
||||
position: absolute;
|
||||
left: 0.4rem;
|
||||
bottom: 0.4rem;
|
||||
max-width: calc(100% - 0.8rem);
|
||||
background: rgba(255, 255, 255, 0.92);
|
||||
padding: 0.15rem 0.4rem;
|
||||
font-size: 0.78rem;
|
||||
}
|
||||
.luf-catalog-body { display: grid; gap: 0.35rem; padding: 0.75rem 0.8rem 0.9rem; }
|
||||
.luf-catalog-body strong {
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
min-height: 2.6em;
|
||||
font-size: 1.08rem;
|
||||
line-height: 1.3;
|
||||
}
|
||||
.luf-summary {
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
min-height: 2.6em;
|
||||
color: var(--luf-quiet);
|
||||
font-size: 0.92rem;
|
||||
}
|
||||
.luf-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; }
|
||||
.luf-chip { border: 1px solid var(--luf-line); padding: 0.05rem 0.4rem; font-size: 0.78rem; line-height: 1.5; background: #fff; }
|
||||
.luf-chip-pine { color: var(--luf-pine); border-color: var(--luf-pine); }
|
||||
.luf-chip-yellow { border-color: var(--luf-yellow); background: #fff8e8; }
|
||||
.luf-chip-quiet { color: var(--luf-quiet); }
|
||||
.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-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; }
|
||||
@@ -171,6 +227,7 @@
|
||||
.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-cards { grid-template-columns: 1fr; }
|
||||
.luf-cards, .luf-catalogs { grid-template-columns: 1fr; }
|
||||
.luf-choice { grid-template-columns: 5.5rem 1fr; }
|
||||
}
|
||||
</style>
|
||||
@@ -12,6 +12,9 @@
|
||||
@if (filled($summary ?? null))
|
||||
<p class="lede">{{ $summary }}</p>
|
||||
@endif
|
||||
@if (filled($composition->description))
|
||||
<p>{{ $composition->description }}</p>
|
||||
@endif
|
||||
</header>
|
||||
<dl class="facts">
|
||||
<div>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
use App\Domain\Catalog\Composition;
|
||||
use App\Domain\Catalog\CompositionDisplayRelease;
|
||||
use App\Domain\Catalog\CompositionKind;
|
||||
use App\Domain\Catalog\ContentElementVersion;
|
||||
use App\Domain\Catalog\ContentService;
|
||||
use App\Filament\Pages\EditorialDesk;
|
||||
use App\Filament\Resources\Courses\CourseResource;
|
||||
@@ -14,6 +15,7 @@
|
||||
use App\Models\User;
|
||||
use Filament\Facades\Filament;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Livewire\Livewire;
|
||||
use Tests\TestCase;
|
||||
|
||||
@@ -299,6 +301,98 @@ public function test_guests_cannot_open_the_trainer_preview(): void
|
||||
->assertRedirect();
|
||||
}
|
||||
|
||||
public function test_catalog_cards_show_text_status_and_a_single_film_suggestion(): void
|
||||
{
|
||||
Storage::fake('media_derived');
|
||||
$content = app(ContentService::class);
|
||||
$film = $this->filmWithPicture($content, 'Lara im Park');
|
||||
$withFilm = $content->publishComposition(
|
||||
$content->createComposition('Modul mit Film', CompositionKind::Uebung),
|
||||
[['role' => 'Film', 'target' => $film]],
|
||||
);
|
||||
$withFilm->composition->summary = 'Kinder erkennen eine Grenze, bevor sie jemanden um Hilfe bitten.';
|
||||
$withFilm->composition->save();
|
||||
$plain = $content->createComposition('Modul ohne Bild', CompositionKind::Uebung);
|
||||
$plain->summary = str_repeat('Ausführliche Kartenbeschreibung. ', 12);
|
||||
$plain->save();
|
||||
$editor = $this->editor();
|
||||
app(CompositionDisplayRelease::class)->release($withFilm, $editor);
|
||||
|
||||
Livewire::actingAs($editor, 'staff')
|
||||
->test(EditorialDesk::class)
|
||||
->assertSee('Kinder erkennen eine Grenze')
|
||||
->assertSee('Vorschlag aus dem Film Lara im Park')
|
||||
->assertSee('In der Mitgliederbibliothek')
|
||||
->assertSee('Kein Titelbild')
|
||||
->assertSee('Ausführliche Kartenbeschreibung')
|
||||
->assertSee('Nicht auf der Website')
|
||||
->assertSee('Kein aktives Angebot')
|
||||
->assertDontSee('Zur Anzeige freigeben')
|
||||
->set('visibility', 'entwurf')
|
||||
->assertSee('Modul ohne Bild')
|
||||
->assertDontSee('Modul mit Film');
|
||||
|
||||
Livewire::actingAs($editor, 'staff')
|
||||
->test(EditExercise::class, ['record' => $withFilm->composition_id])
|
||||
->assertSee('In Mitgliederbibliothek anzeigen')
|
||||
->assertSee('Vorschlag aus dem Film Lara im Park')
|
||||
->assertSee('Katalogvorschau')
|
||||
->assertDontSee('Zur Anzeige freigeben');
|
||||
}
|
||||
|
||||
public function test_a_chosen_picture_and_description_do_not_create_a_version(): void
|
||||
{
|
||||
Storage::fake('media_derived');
|
||||
$content = app(ContentService::class);
|
||||
$first = $this->filmWithPicture($content, 'Lara im Park');
|
||||
$second = $this->filmWithPicture($content, 'Lara im Hof');
|
||||
$version = $content->publishComposition(
|
||||
$content->createComposition('Modul mit zwei Filmen', CompositionKind::Uebung),
|
||||
[
|
||||
['role' => 'Film', 'target' => $first],
|
||||
['role' => 'Weiterer Film', 'target' => $second],
|
||||
],
|
||||
);
|
||||
$editor = $this->editor();
|
||||
|
||||
Livewire::actingAs($editor, 'staff')
|
||||
->test(EditExercise::class, ['record' => $version->composition_id])
|
||||
->assertSee('Lara im Park als Titelbild')
|
||||
->assertSee('Lara im Hof als Titelbild')
|
||||
->assertDontSee('Vorschlag aus dem Film')
|
||||
->call('adoptPicture', $first->element->id)
|
||||
->assertSet('feedback', 'Das Vorschaubild ist gespeichert. Die Fassung bleibt unverändert.')
|
||||
->set('description', 'Eine fachliche Beschreibung für die Bibliothek.')
|
||||
->set('summary', 'Kurzer Kartentext')
|
||||
->call('saveDisplay')
|
||||
->assertSet('feedback', 'Die Anzeige ist gespeichert. Die Fassung bleibt unverändert.');
|
||||
|
||||
$composition = $version->composition->fresh();
|
||||
|
||||
$this->assertSame(1, $composition->versions()->count());
|
||||
$this->assertSame('vorschau/komposition-'.$composition->id.'.jpg', $composition->thumbnail_path);
|
||||
$this->assertSame('element:'.$first->element->id, $composition->thumbnail_source);
|
||||
$this->assertSame('Eine fachliche Beschreibung für die Bibliothek.', $composition->description);
|
||||
Storage::disk('media_derived')->assertExists($composition->thumbnail_path);
|
||||
$this->get('/medien/'.$composition->thumbnail_path)->assertNotFound();
|
||||
}
|
||||
|
||||
private function filmWithPicture(ContentService $content, string $title): ContentElementVersion
|
||||
{
|
||||
$element = $content->createElement('film', 'film', $title);
|
||||
$version = $content->publishElementVersion($element, 'Film');
|
||||
$element->thumbnail_path = 'vorschau/element-'.$element->id.'.jpg';
|
||||
$element->thumbnail_alt = $title;
|
||||
$element->save();
|
||||
$image = imagecreatetruecolor(8, 8);
|
||||
ob_start();
|
||||
imagepng($image);
|
||||
Storage::disk('media_derived')->put($element->thumbnail_path, ob_get_clean());
|
||||
imagedestroy($image);
|
||||
|
||||
return $version->fresh();
|
||||
}
|
||||
|
||||
private function editor(): User
|
||||
{
|
||||
$editor = User::factory()->redakteur()->create();
|
||||
|
||||
Reference in new issue
Block a user