Mache Auswahl, Aufbau und Entwurf im Redaktionseditor bedienbar.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
6955830579
commit
053a361801
14 files changed
+1040
-155
No files matched your search
@@ -19,6 +19,7 @@ class Composition extends Model
|
||||
'kind',
|
||||
'editorial_content_kind_id',
|
||||
'archived_at',
|
||||
'working_draft',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
@@ -26,6 +27,7 @@ protected function casts(): array
|
||||
return [
|
||||
'kind' => CompositionKind::class,
|
||||
'archived_at' => 'datetime',
|
||||
'working_draft' => 'array',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\Catalog;
|
||||
|
||||
class EditorialWorkingDraft
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>|null
|
||||
*/
|
||||
public function read(Composition $composition): ?array
|
||||
{
|
||||
$draft = $composition->working_draft;
|
||||
|
||||
return is_array($draft) && $draft !== [] ? $draft : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $payload
|
||||
*/
|
||||
public function write(Composition $composition, array $payload): void
|
||||
{
|
||||
$composition->working_draft = $payload;
|
||||
$composition->save();
|
||||
}
|
||||
|
||||
public function clear(Composition $composition): void
|
||||
{
|
||||
if ($composition->working_draft === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
$composition->working_draft = null;
|
||||
$composition->save();
|
||||
}
|
||||
}
|
||||
@@ -97,6 +97,7 @@ public function entries(): array
|
||||
$rows[] = [
|
||||
'title' => $title,
|
||||
'kind' => $label,
|
||||
'tone' => $kind === CompositionKind::Kurs ? 'programm' : 'modul',
|
||||
'stand' => $catalog->stand($composition)['text'],
|
||||
'url' => EditorialCatalog::editUrl($composition),
|
||||
'summary' => (string) ($composition->summary ?? ''),
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
use App\Domain\Catalog\DomainRuleException;
|
||||
use App\Domain\Catalog\EditorialDimension;
|
||||
use App\Domain\Catalog\EditorialDimensionValue;
|
||||
use App\Domain\Catalog\EditorialWorkingDraft;
|
||||
use App\Domain\Catalog\IdentityDimension;
|
||||
use App\Domain\Catalog\IdentityDimensionValue;
|
||||
use App\Domain\Catalog\IdentityProfile;
|
||||
@@ -61,6 +62,20 @@ abstract class EditComposition extends EditRecord
|
||||
|
||||
public string $panel = 'angaben';
|
||||
|
||||
public bool $pickerOpen = false;
|
||||
|
||||
public string $pickerQuery = '';
|
||||
|
||||
public string $pickerKind = 'alle';
|
||||
|
||||
public string $pickerDimension = '';
|
||||
|
||||
public string $pickerSelected = '';
|
||||
|
||||
public bool $textOpen = false;
|
||||
|
||||
public bool $releaseArmed = false;
|
||||
|
||||
public string $returnUrl = '';
|
||||
|
||||
public ?int $templateNumber = null;
|
||||
@@ -193,13 +208,20 @@ public function selfUrl(): string
|
||||
|
||||
public function previewUrl(): ?string
|
||||
{
|
||||
/** @var Composition $composition */
|
||||
$composition = $this->getRecord();
|
||||
|
||||
if (is_array($composition->working_draft) && $composition->working_draft !== []) {
|
||||
return route('editorial.draft-preview', ['composition' => $composition]);
|
||||
}
|
||||
|
||||
$version = $this->currentReadyVersion();
|
||||
|
||||
if ($version === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return route('editorial.preview', ['composition' => $this->getRecord(), 'version' => $version]);
|
||||
return route('editorial.preview', ['composition' => $composition, 'version' => $version]);
|
||||
}
|
||||
|
||||
public function previewUrlFor(int $versionId): ?string
|
||||
@@ -229,6 +251,188 @@ public function hits(): array
|
||||
);
|
||||
}
|
||||
|
||||
public function openPicker(): void
|
||||
{
|
||||
$this->pickerOpen = true;
|
||||
$this->textOpen = false;
|
||||
$this->pickerSelected = '';
|
||||
}
|
||||
|
||||
public function closePicker(): void
|
||||
{
|
||||
$this->pickerOpen = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{items: list<array<string, string|null>>, more: bool}
|
||||
*/
|
||||
public function pickerResult(): array
|
||||
{
|
||||
if (! $this->pickerOpen) {
|
||||
return ['items' => [], 'more' => false];
|
||||
}
|
||||
|
||||
return app(EditorialCatalog::class)->browse(
|
||||
$this->pickerQuery,
|
||||
$this->pickerKind,
|
||||
$this->pickerDimension,
|
||||
(int) $this->getRecord()->getKey(),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string|null>|null
|
||||
*/
|
||||
public function pickerDetail(): ?array
|
||||
{
|
||||
if ($this->pickerSelected === '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
return app(EditorialCatalog::class)->rowForTarget(
|
||||
$this->pickerSelected,
|
||||
(int) $this->getRecord()->getKey(),
|
||||
);
|
||||
}
|
||||
|
||||
public function openText(): void
|
||||
{
|
||||
$this->pickerOpen = false;
|
||||
$this->textOpen = true;
|
||||
}
|
||||
|
||||
public function cancelText(): void
|
||||
{
|
||||
$this->textOpen = false;
|
||||
$this->newTextTitle = '';
|
||||
$this->newTextBody = '';
|
||||
}
|
||||
|
||||
public function saveDraft(): void
|
||||
{
|
||||
$this->commitRoleDraft();
|
||||
$minutes = $this->minutes($this->durationMinutes);
|
||||
|
||||
if ($minutes === false) {
|
||||
$this->feedback = 'Der Zeitbedarf ist eine Zahl von Minuten oder bleibt leer.';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var Composition $record */
|
||||
$record = $this->getRecord();
|
||||
app(EditorialWorkingDraft::class)->write($record, $this->payload());
|
||||
$this->feedback = 'Der Entwurf ist gespeichert. Es entsteht keine neue Fassung.';
|
||||
}
|
||||
|
||||
public function armRelease(): void
|
||||
{
|
||||
$this->commitRoleDraft();
|
||||
|
||||
if ($this->members === []) {
|
||||
$this->releaseArmed = false;
|
||||
$this->feedback = 'Eine Fassung braucht mindestens einen Bestandteil. Anzeige und Entwurf kannst du schon speichern.';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (! $this->needsRevision()) {
|
||||
$this->releaseArmed = false;
|
||||
$this->feedback = 'Die freigegebene Fassung ist unverändert. Es entsteht keine neue Fassung.';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->releaseArmed = true;
|
||||
}
|
||||
|
||||
public function cancelRelease(): void
|
||||
{
|
||||
$this->releaseArmed = false;
|
||||
}
|
||||
|
||||
public function discardDraft(): void
|
||||
{
|
||||
/** @var Composition $record */
|
||||
$record = $this->getRecord();
|
||||
app(EditorialWorkingDraft::class)->clear($record);
|
||||
$this->releaseArmed = false;
|
||||
$this->loadEditor();
|
||||
$this->feedback = 'Der Entwurf ist verworfen. Eine freigegebene Fassung bleibt unverändert.';
|
||||
}
|
||||
|
||||
public function editorStatus(): string
|
||||
{
|
||||
$current = $this->fingerprint($this->payload());
|
||||
$stored = $this->storedPayload();
|
||||
$ready = $this->fingerprint($this->readyPayload());
|
||||
$version = $this->currentReadyVersion();
|
||||
$display = $version === null
|
||||
? ''
|
||||
: (app(CompositionDisplayRelease::class)->isReleased($version)
|
||||
? ' Sie ist zur Anzeige freigegeben.'
|
||||
: ' Sie ist noch nicht zur Anzeige freigegeben.');
|
||||
$unsaved = $stored === null
|
||||
? $current !== $ready
|
||||
: $current !== $this->fingerprint($stored);
|
||||
|
||||
if ($unsaved) {
|
||||
return 'Es gibt ungespeicherte Änderungen. Speichern hält den Entwurf fest und legt keine Fassung an.';
|
||||
}
|
||||
|
||||
if ($stored !== null && $this->fingerprint($stored) !== $ready) {
|
||||
return $version === null
|
||||
? 'Der Entwurf ist gespeichert. Noch keine freigegebene Fassung.'
|
||||
: 'Der Entwurf ist gespeichert. Fassung '.$version->number.' bleibt unverändert.'.$display;
|
||||
}
|
||||
|
||||
if ($version === null) {
|
||||
return 'Noch keine freigegebene Fassung. Speichern hält einen Entwurf fest.';
|
||||
}
|
||||
|
||||
return 'Fassung '.$version->number.' ist der letzte freigegebene Stand.'.$display.' Kein offener Entwurf.';
|
||||
}
|
||||
|
||||
public function includeNeedsRelease(): bool
|
||||
{
|
||||
return $this->needsRevision();
|
||||
}
|
||||
|
||||
public function moveTo(int $from, int $to): void
|
||||
{
|
||||
$this->commitRoleDraft();
|
||||
$count = count($this->members);
|
||||
|
||||
if (! isset($this->members[$from]) || $to < 0 || $to >= $count) {
|
||||
$this->feedback = 'An dieser Stelle kann der Bestandteil nicht abgelegt werden. Die Reihenfolge gilt nur innerhalb dieses Aufbaus.';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($from === $to) {
|
||||
$this->feedback = 'Der Bestandteil bleibt an seiner Stelle.';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$selectedTarget = $this->selected !== null ? ($this->members[$this->selected]['target'] ?? null) : null;
|
||||
$item = $this->members[$from];
|
||||
array_splice($this->members, $from, 1);
|
||||
array_splice($this->members, $to, 0, [$item]);
|
||||
$this->members = array_values($this->members);
|
||||
$this->selected = null;
|
||||
|
||||
foreach ($this->members as $index => $member) {
|
||||
if ($selectedTarget !== null && ($member['target'] ?? null) === $selectedTarget) {
|
||||
$this->selected = $index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$this->syncRoleDraft();
|
||||
$this->feedback = $item['title'].' steht jetzt an Stelle '.($to + 1).'. Gespeichert ist das erst mit „Entwurf speichern“.';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array{id: int, number: int, text: string, current: bool}>
|
||||
*/
|
||||
@@ -241,13 +445,15 @@ public function versionChoices(): array
|
||||
$rows = [];
|
||||
|
||||
foreach ($composition->versions()->orderByDesc('number')->get() as $version) {
|
||||
$released = $version->status === ContentVersionStatus::Bereit && $release->isReleased($version);
|
||||
if ($version->status !== ContentVersionStatus::Bereit) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$released = $release->isReleased($version);
|
||||
$rows[] = [
|
||||
'id' => $version->id,
|
||||
'number' => $version->number,
|
||||
'text' => 'Fassung '.$version->number
|
||||
.($version->status === ContentVersionStatus::Bereit ? '' : ', nicht bereit')
|
||||
.($released ? ', zur Anzeige freigegeben' : ''),
|
||||
'text' => 'Fassung '.$version->number.($released ? ', zur Anzeige freigegeben' : ''),
|
||||
'current' => $latest !== null && $latest->id === $version->id,
|
||||
];
|
||||
}
|
||||
@@ -348,7 +554,7 @@ public function publishHint(): string
|
||||
return 'Lernziel, Zeit, Material und Aufbau sind unverändert. Es entsteht keine neue Fassung.';
|
||||
}
|
||||
|
||||
return 'Übernehmen legt eine neue Fassung an. Die bisherige Fassung bleibt und wird nicht überschrieben.';
|
||||
return 'Freigeben legt eine neue unveränderliche Fassung an. Speichern schreibt nur den Entwurf und lässt freigegebene Fassungen unverändert.';
|
||||
}
|
||||
|
||||
public function selectPart(int $index): void
|
||||
@@ -396,7 +602,9 @@ public function addPart(string $target): void
|
||||
$this->panel = 'bestandteil';
|
||||
$this->syncRoleDraft();
|
||||
$this->search = '';
|
||||
$this->feedback = $row['title'].' ist in den Aufbau übernommen. Die neue Fassung entsteht erst mit „Neue Fassung übernehmen“.';
|
||||
$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“.';
|
||||
}
|
||||
|
||||
public function removePart(int $index): void
|
||||
@@ -489,7 +697,9 @@ public function addText(): void
|
||||
|
||||
$this->newTextTitle = '';
|
||||
$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“.';
|
||||
}
|
||||
|
||||
public function startModule(): void
|
||||
@@ -579,7 +789,11 @@ public function publishRevision(): bool
|
||||
}
|
||||
|
||||
if (! $this->needsRevision()) {
|
||||
$this->feedback = 'Die Fassung ist unverändert.';
|
||||
/** @var Composition $unchanged */
|
||||
$unchanged = $this->getRecord();
|
||||
app(EditorialWorkingDraft::class)->clear($unchanged);
|
||||
$this->releaseArmed = false;
|
||||
$this->feedback = 'Die freigegebene Fassung ist unverändert. Es entsteht keine neue Fassung.';
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -641,6 +855,8 @@ public function publishRevision(): bool
|
||||
|
||||
$this->revisionNote = '';
|
||||
$this->templateNumber = null;
|
||||
$this->releaseArmed = false;
|
||||
app(EditorialWorkingDraft::class)->clear($record);
|
||||
$this->loadEditor();
|
||||
$this->feedback = 'Die neue Fassung ist übernommen. Die bisherige Fassung bleibt erhalten.';
|
||||
|
||||
@@ -709,6 +925,14 @@ protected function loadEditor(): void
|
||||
default => 'alles',
|
||||
};
|
||||
|
||||
$draft = app(EditorialWorkingDraft::class)->read($composition);
|
||||
|
||||
if ($draft !== null) {
|
||||
$this->applyDraft($draft);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($version === null) {
|
||||
$this->members = [];
|
||||
$this->learningGoal = '';
|
||||
@@ -721,6 +945,45 @@ protected function loadEditor(): void
|
||||
$this->applyVersion($version);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $draft
|
||||
*/
|
||||
protected function applyDraft(array $draft): void
|
||||
{
|
||||
$catalog = app(EditorialCatalog::class);
|
||||
$rows = [];
|
||||
$requested = 0;
|
||||
|
||||
foreach ($draft['members'] ?? [] as $member) {
|
||||
if (! is_array($member)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$requested++;
|
||||
$row = $catalog->rowForTarget((string) ($member['target'] ?? ''), (int) $this->getRecord()->getKey(), allowSelf: true);
|
||||
|
||||
if ($row === null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$row['role'] = (string) ($member['role'] ?? $row['kind']);
|
||||
$rows[] = $row;
|
||||
}
|
||||
|
||||
$this->members = $rows;
|
||||
$this->learningGoal = (string) ($draft['learning_goal'] ?? '');
|
||||
$this->durationMinutes = ($draft['duration_minutes'] ?? null) === null ? '' : (string) $draft['duration_minutes'];
|
||||
$this->materialNote = (string) ($draft['material_note'] ?? '');
|
||||
$this->revisionNote = (string) ($draft['revision_note'] ?? '');
|
||||
$this->selected = null;
|
||||
$this->roleDraft = '';
|
||||
$this->panel = 'angaben';
|
||||
|
||||
if ($requested > count($rows) && $this->feedback === '') {
|
||||
$this->feedback = 'Ein Bestandteil des Entwurfs ist nicht mehr bereit und wurde nicht geladen.';
|
||||
}
|
||||
}
|
||||
|
||||
protected function applyVersion(CompositionVersion $version): void
|
||||
{
|
||||
$this->members = app(EditorialCatalog::class)->rows($version, (int) $this->getRecord()->getKey());
|
||||
@@ -899,17 +1162,122 @@ protected function storePreview(string $path): void
|
||||
}
|
||||
|
||||
protected function statusSentence(): string
|
||||
{
|
||||
return $this->editorStatus();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{learning_goal: ?string, duration_minutes: int|string|null, material_note: ?string, revision_note: ?string, members: list<array{role: string, target: string}>}
|
||||
*/
|
||||
protected function payload(): array
|
||||
{
|
||||
$members = $this->members;
|
||||
|
||||
if ($this->selected !== null && isset($members[$this->selected]) && trim($this->roleDraft) !== '') {
|
||||
$members[$this->selected]['role'] = trim($this->roleDraft);
|
||||
}
|
||||
|
||||
$minutes = $this->minutes($this->durationMinutes);
|
||||
|
||||
return [
|
||||
'learning_goal' => $this->blank($this->learningGoal),
|
||||
'duration_minutes' => $minutes === false ? $this->durationMinutes : $minutes,
|
||||
'material_note' => $this->blank($this->materialNote),
|
||||
'revision_note' => $this->blank($this->revisionNote),
|
||||
'members' => array_values(array_map(
|
||||
fn (array $member): array => [
|
||||
'role' => trim((string) ($member['role'] ?? '')),
|
||||
'target' => (string) ($member['target'] ?? ''),
|
||||
],
|
||||
$members,
|
||||
)),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{learning_goal: ?string, duration_minutes: int|null, material_note: ?string, revision_note: ?string, members: list<array{role: string, target: string}>}|null
|
||||
*/
|
||||
protected function storedPayload(): ?array
|
||||
{
|
||||
/** @var Composition $composition */
|
||||
$composition = $this->getRecord();
|
||||
$draft = $composition->working_draft;
|
||||
|
||||
if (! is_array($draft) || $draft === []) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->normalizePayload($draft);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{learning_goal: ?string, duration_minutes: int|null, material_note: ?string, revision_note: ?string, members: list<array{role: string, target: string}>}
|
||||
*/
|
||||
protected function readyPayload(): array
|
||||
{
|
||||
$version = $this->currentReadyVersion();
|
||||
|
||||
if ($version === null) {
|
||||
return 'Noch keine Fassung.';
|
||||
return [
|
||||
'learning_goal' => null,
|
||||
'duration_minutes' => null,
|
||||
'material_note' => null,
|
||||
'revision_note' => null,
|
||||
'members' => [],
|
||||
];
|
||||
}
|
||||
|
||||
$released = app(CompositionDisplayRelease::class)->isReleased($version);
|
||||
$rows = app(EditorialCatalog::class)->rows($version, (int) $this->getRecord()->getKey());
|
||||
|
||||
return 'Zuletzt übernommen: Fassung '.$version->number.'. '
|
||||
.($released ? 'Sie ist zur Anzeige freigegeben.' : 'Sie ist noch nicht zur Anzeige freigegeben.');
|
||||
return [
|
||||
'learning_goal' => $version->learning_goal,
|
||||
'duration_minutes' => $version->duration_minutes === null ? null : (int) $version->duration_minutes,
|
||||
'material_note' => $version->material_note,
|
||||
'revision_note' => null,
|
||||
'members' => array_values(array_map(
|
||||
fn (array $row): array => [
|
||||
'role' => trim((string) ($row['role'] ?? '')),
|
||||
'target' => (string) ($row['target'] ?? ''),
|
||||
],
|
||||
$rows,
|
||||
)),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $payload
|
||||
* @return array{learning_goal: ?string, duration_minutes: int|string|null, material_note: ?string, revision_note: ?string, members: list<array{role: string, target: string}>}
|
||||
*/
|
||||
protected function normalizePayload(array $payload): array
|
||||
{
|
||||
$members = [];
|
||||
|
||||
foreach ($payload['members'] ?? [] as $member) {
|
||||
if (! is_array($member)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$members[] = [
|
||||
'role' => trim((string) ($member['role'] ?? '')),
|
||||
'target' => (string) ($member['target'] ?? ''),
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'learning_goal' => $payload['learning_goal'] ?? null,
|
||||
'duration_minutes' => $payload['duration_minutes'] ?? null,
|
||||
'material_note' => $payload['material_note'] ?? null,
|
||||
'revision_note' => $payload['revision_note'] ?? null,
|
||||
'members' => $members,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $payload
|
||||
*/
|
||||
protected function fingerprint(array $payload): string
|
||||
{
|
||||
return json_encode($this->normalizePayload($payload), JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
protected function actor(): ?User
|
||||
|
||||
@@ -8,13 +8,17 @@
|
||||
use App\Domain\Catalog\CompositionKind;
|
||||
use App\Domain\Catalog\CompositionMember;
|
||||
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;
|
||||
use App\Domain\Catalog\EditorialContentKind;
|
||||
use App\Domain\Catalog\IdentityDimensionValue;
|
||||
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;
|
||||
|
||||
class EditorialCatalog
|
||||
{
|
||||
@@ -72,6 +76,9 @@ public function rowForTarget(string $target, int $exceptCompositionId, bool $all
|
||||
'target' => 'element:'.$version->id,
|
||||
'title' => $title,
|
||||
'kind' => $kind,
|
||||
'summary' => (string) ($element->summary ?: $element->description ?: ''),
|
||||
'tone' => $this->tone((string) $element->output_class, $kind),
|
||||
'image' => $this->cardUrl('element', $element->id, $element->thumbnail_path),
|
||||
'version_label' => 'Fassung '.$version->number,
|
||||
'identity' => 'medium:'.$element->id,
|
||||
'open_url' => route('content.preview', $version),
|
||||
@@ -100,6 +107,9 @@ public function rowForTarget(string $target, int $exceptCompositionId, bool $all
|
||||
'target' => 'composition:'.$version->id,
|
||||
'title' => $this->compositionTitle($composition),
|
||||
'kind' => $kind,
|
||||
'summary' => (string) ($composition->summary ?? ''),
|
||||
'tone' => $this->tone('', $kind),
|
||||
'image' => $this->cardUrl('komposition', $composition->id, $composition->thumbnail_path),
|
||||
'version_label' => 'Fassung '.$version->number,
|
||||
'identity' => 'zusammenstellung:'.$composition->id,
|
||||
'open_url' => null,
|
||||
@@ -180,6 +190,149 @@ public function search(string $query, string $scope, int $exceptCompositionId):
|
||||
return array_slice($rows, 0, 40);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{items: list<array<string, string|null>>, more: bool}
|
||||
*/
|
||||
public function browse(string $query, string $kind, string $dimension, int $exceptCompositionId): array
|
||||
{
|
||||
$query = trim($query);
|
||||
$like = '%'.str_replace(['%', '_'], ['', ''], $query).'%';
|
||||
$limit = 48;
|
||||
$rows = [];
|
||||
$dimensionId = ctype_digit($dimension) ? (int) $dimension : 0;
|
||||
|
||||
if ($kind !== 'modul') {
|
||||
$elements = ContentElementVersion::query()
|
||||
->where('status', ContentVersionStatus::Bereit)
|
||||
->with('element.editorialContentKind')
|
||||
->whereHas('element', function ($builder) use ($query, $like, $kind, $dimensionId): void {
|
||||
$this->constrainElement($builder, $query, $like, $kind, $dimensionId);
|
||||
})
|
||||
->orderByDesc('id')
|
||||
->limit($limit + 1)
|
||||
->get();
|
||||
|
||||
foreach ($elements as $version) {
|
||||
$row = $this->rowForTarget('element:'.$version->id, $exceptCompositionId);
|
||||
|
||||
if ($row !== null) {
|
||||
$rows[] = $row;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (in_array($kind, ['alle', 'modul'], true)) {
|
||||
$versions = CompositionVersion::query()
|
||||
->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);
|
||||
}
|
||||
|
||||
if ($dimensionId > 0) {
|
||||
$builder->whereIn('id', $this->dimensionSubjectIds(Composition::class, $dimensionId));
|
||||
}
|
||||
|
||||
if ($query === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
$builder->where(function ($inner) use ($like): void {
|
||||
$inner->where('designation', 'like', $like)
|
||||
->orWhere('display_title', 'like', $like)
|
||||
->orWhere('summary', 'like', $like);
|
||||
});
|
||||
})
|
||||
->orderByDesc('id')
|
||||
->limit($limit + 1)
|
||||
->get();
|
||||
|
||||
foreach ($versions as $version) {
|
||||
$row = $this->rowForTarget('composition:'.$version->id, $exceptCompositionId);
|
||||
|
||||
if ($row !== null) {
|
||||
$rows[] = $row;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
'items' => array_slice($rows, 0, $limit),
|
||||
'more' => count($rows) > $limit,
|
||||
];
|
||||
}
|
||||
|
||||
public function tone(string $outputClass, string $kindLabel): string
|
||||
{
|
||||
$value = mb_strtolower($outputClass.' '.$kindLabel);
|
||||
|
||||
return match (true) {
|
||||
str_contains($value, 'film') => 'film',
|
||||
str_contains($value, 'hör'), str_contains($value, 'audio') => 'audio',
|
||||
str_contains($value, 'dokument'), str_contains($value, 'pdf') => 'dokument',
|
||||
str_contains($value, 'modul'), str_contains($value, 'programm') => 'modul',
|
||||
default => 'text',
|
||||
};
|
||||
}
|
||||
|
||||
public function cardUrl(string $kind, int $id, ?string $path): ?string
|
||||
{
|
||||
if (! is_string($path) || ! str_starts_with($path, 'vorschau/') || str_contains($path, '..')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return route('editorial.card', ['kind' => $kind, 'subject' => $id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Builder<ContentElement> $builder
|
||||
*/
|
||||
private function constrainElement($builder, string $query, string $like, string $kind, int $dimensionId): void
|
||||
{
|
||||
$outputs = match ($kind) {
|
||||
'film' => ['film'],
|
||||
'text' => ['text'],
|
||||
'dokument' => ['pdf', 'document'],
|
||||
default => null,
|
||||
};
|
||||
|
||||
if ($outputs !== null) {
|
||||
$builder->whereIn('output_class', $outputs);
|
||||
}
|
||||
|
||||
if ($dimensionId > 0) {
|
||||
$builder->whereIn('id', $this->dimensionSubjectIds(ContentElement::class, $dimensionId));
|
||||
}
|
||||
|
||||
if ($query === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
$builder->where(function ($inner) use ($like): void {
|
||||
$inner->where('working_title', 'like', $like)
|
||||
->orWhere('display_title', 'like', $like)
|
||||
->orWhere('summary', 'like', $like)
|
||||
->orWhere('description', 'like', $like);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param class-string<Model> $class
|
||||
* @return list<int>
|
||||
*/
|
||||
private function dimensionSubjectIds(string $class, int $dimensionId): array
|
||||
{
|
||||
return IdentityDimensionValue::query()
|
||||
->where('subject_type', (new $class)->getMorphClass())
|
||||
->where('editorial_dimension_value_id', $dimensionId)
|
||||
->where('origin', 'direkt')
|
||||
->pluck('subject_id')
|
||||
->map(fn (mixed $id): int => (int) $id)
|
||||
->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array{target: string, label: string}>
|
||||
*/
|
||||
@@ -284,15 +437,18 @@ public function stand(Composition $composition): array
|
||||
$release = app(CompositionDisplayRelease::class);
|
||||
$released = $ready->first(fn (CompositionVersion $version): bool => $release->isReleased($version));
|
||||
|
||||
$draft = is_array($composition->working_draft) && $composition->working_draft !== [];
|
||||
|
||||
if (! $latest instanceof CompositionVersion) {
|
||||
return [
|
||||
'text' => 'Noch ohne Fassung',
|
||||
'text' => $draft ? 'Entwurf gespeichert' : 'Noch ohne Fassung',
|
||||
'number' => null,
|
||||
'released_number' => $released instanceof CompositionVersion ? $released->number : null,
|
||||
];
|
||||
}
|
||||
|
||||
$text = 'Fassung '.$latest->number.($release->isReleased($latest) ? ', zur Anzeige freigegeben' : ', noch nicht freigegeben');
|
||||
$text = 'Fassung '.$latest->number.($release->isReleased($latest) ? ', zur Anzeige freigegeben' : ', noch nicht zur Anzeige freigegeben');
|
||||
$text = ($draft ? 'Entwurf gespeichert. ' : '').$text;
|
||||
|
||||
if ($released instanceof CompositionVersion && $released->number !== $latest->number) {
|
||||
$text .= '. Angezeigt wird Fassung '.$released->number;
|
||||
|
||||
@@ -5,13 +5,16 @@
|
||||
use App\Domain\Catalog\Composition;
|
||||
use App\Domain\Catalog\CompositionStructureReader;
|
||||
use App\Domain\Catalog\CompositionVersion;
|
||||
use App\Domain\Catalog\ContentElement;
|
||||
use App\Domain\Catalog\ContentElementVersion;
|
||||
use App\Domain\Catalog\ContentVersionStatus;
|
||||
use App\Domain\Catalog\StructureNode;
|
||||
use App\Domain\Identity\StaffRole;
|
||||
use App\Filament\Support\EditorialCatalog;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\View\View;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
|
||||
class EditorialPreviewController extends Controller
|
||||
{
|
||||
@@ -30,6 +33,101 @@ public function show(Composition $composition, ?CompositionVersion $version = nu
|
||||
abort_unless((int) $version->composition_id === (int) $composition->id, 404);
|
||||
abort_unless($version->status === ContentVersionStatus::Bereit, 404);
|
||||
|
||||
return $this->render(
|
||||
$composition,
|
||||
$version->learning_goal,
|
||||
$version->duration_minutes,
|
||||
$version->material_note,
|
||||
$version->number,
|
||||
false,
|
||||
array_map(
|
||||
fn (StructureNode $node): array => $this->present($node, app(EditorialCatalog::class)),
|
||||
app(CompositionStructureReader::class)->tree($version),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
public function draft(Composition $composition): View
|
||||
{
|
||||
$this->authorizeStaff();
|
||||
$draft = $composition->working_draft;
|
||||
abort_unless(is_array($draft) && ($draft['members'] ?? null) !== null, 404);
|
||||
|
||||
$catalog = app(EditorialCatalog::class);
|
||||
$nodes = [];
|
||||
|
||||
foreach ($draft['members'] as $member) {
|
||||
if (! is_array($member)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$row = $catalog->rowForTarget((string) ($member['target'] ?? ''), (int) $composition->id, allowSelf: true);
|
||||
|
||||
if ($row === null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$children = [];
|
||||
|
||||
if (preg_match('/^composition:(\d+)$/', (string) $row['target'], $match) === 1) {
|
||||
$nested = CompositionVersion::query()->find($match[1]);
|
||||
|
||||
if ($nested instanceof CompositionVersion) {
|
||||
$children = array_map(
|
||||
fn (StructureNode $node): array => $this->present($node, $catalog),
|
||||
app(CompositionStructureReader::class)->tree($nested),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$nodes[] = [
|
||||
'role' => (string) ($member['role'] ?? $row['kind']),
|
||||
'title' => $row['title'],
|
||||
'kind' => $row['kind'],
|
||||
'version' => $row['version_label'],
|
||||
'open_url' => $row['open_url'],
|
||||
'children' => $children,
|
||||
];
|
||||
}
|
||||
|
||||
return $this->render(
|
||||
$composition,
|
||||
$draft['learning_goal'] ?? null,
|
||||
$draft['duration_minutes'] ?? null,
|
||||
$draft['material_note'] ?? null,
|
||||
null,
|
||||
true,
|
||||
$nodes,
|
||||
);
|
||||
}
|
||||
|
||||
public function card(string $kind, int $subject): StreamedResponse
|
||||
{
|
||||
$this->authorizeStaff();
|
||||
abort_unless(in_array($kind, ['element', 'komposition'], true), 404);
|
||||
$model = $kind === 'komposition'
|
||||
? Composition::query()->findOrFail($subject)
|
||||
: ContentElement::query()->findOrFail($subject);
|
||||
$path = $model->thumbnail_path;
|
||||
abort_unless(is_string($path) && str_starts_with($path, 'vorschau/') && ! str_contains($path, '..'), 404);
|
||||
$disk = Storage::disk('media_derived');
|
||||
abort_unless($disk->exists($path), 404);
|
||||
|
||||
return $disk->response($path);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<array<string, mixed>> $nodes
|
||||
*/
|
||||
private function render(
|
||||
Composition $composition,
|
||||
mixed $learningGoal,
|
||||
mixed $durationMinutes,
|
||||
mixed $materialNote,
|
||||
mixed $number,
|
||||
bool $draft,
|
||||
array $nodes,
|
||||
): View {
|
||||
$catalog = app(EditorialCatalog::class);
|
||||
|
||||
return view('filament.editorial.preview', [
|
||||
@@ -37,15 +135,13 @@ public function show(Composition $composition, ?CompositionVersion $version = nu
|
||||
'summary' => $composition->summary,
|
||||
'kind' => $composition->editorialContentKind?->label
|
||||
?? ($composition->kind?->deskLabel()),
|
||||
'learningGoal' => $version->learning_goal,
|
||||
'durationMinutes' => $version->duration_minutes,
|
||||
'materialNote' => $version->material_note,
|
||||
'number' => $version->number,
|
||||
'learningGoal' => $learningGoal,
|
||||
'durationMinutes' => $durationMinutes,
|
||||
'materialNote' => $materialNote,
|
||||
'number' => $number,
|
||||
'draft' => $draft,
|
||||
'backUrl' => $catalog->editUrl($composition),
|
||||
'nodes' => array_map(
|
||||
fn (StructureNode $node): array => $this->present($node, $catalog),
|
||||
app(CompositionStructureReader::class)->tree($version),
|
||||
),
|
||||
'nodes' => $nodes,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<?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->json('working_draft')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('compositions', function (Blueprint $table) {
|
||||
$table->dropColumn('working_draft');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -4,28 +4,43 @@
|
||||
@if ($this->feedback !== '')
|
||||
<p class="luf-feedback" role="status">{{ $this->feedback }}</p>
|
||||
@endif
|
||||
<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">
|
||||
<div class="luf-desk-create">
|
||||
<form wire:submit="createModule" class="luf-inline">
|
||||
<label for="neues-modul">Neues Modul</label>
|
||||
<input id="neues-modul" type="text" wire:model="moduleName" placeholder="Name" required>
|
||||
<button class="luf-primary" type="submit">Modul anlegen</button>
|
||||
</form>
|
||||
<form wire:submit="createProgram" class="luf-inline">
|
||||
<label for="neues-programm">Neues Programm</label>
|
||||
<input id="neues-programm" type="text" wire:model="programName" placeholder="Name" required>
|
||||
<button class="luf-primary" type="submit">Programm anlegen</button>
|
||||
</form>
|
||||
</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 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">
|
||||
</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>
|
||||
@if ($this->entries() === [])
|
||||
<p class="luf-empty">{{ trim($this->query) === '' ? 'Noch keine Programme oder Module.' : 'Nichts gefunden. Prüfe die Schreibweise oder lege einen neuen Eintrag an.' }}</p>
|
||||
<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>
|
||||
@else
|
||||
<ul class="luf-list">
|
||||
<ul class="luf-cards">
|
||||
@foreach ($this->entries() as $entry)
|
||||
<li class="luf-row">
|
||||
<a class="luf-entry" href="{{ $entry['url'] }}">
|
||||
<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 style="display:block">{{ $entry['title'] }}</strong>
|
||||
<strong>{{ $entry['title'] }}</strong>
|
||||
<span class="luf-meta">{{ $entry['stand'] }}</span>
|
||||
@if ($entry['summary'] !== '')
|
||||
<span class="luf-meta" style="display:block">{{ $entry['summary'] }}</span>
|
||||
<span class="luf-meta">{{ $entry['summary'] }}</span>
|
||||
@endif
|
||||
</span>
|
||||
</a>
|
||||
@@ -33,23 +48,5 @@
|
||||
@endforeach
|
||||
</ul>
|
||||
@endif
|
||||
<div class="luf-desk-create">
|
||||
<form wire:submit="createProgram">
|
||||
<h2>Neues Programm</h2>
|
||||
<div class="luf-field">
|
||||
<label for="neues-programm">Name</label>
|
||||
<input id="neues-programm" type="text" wire:model="programName" required>
|
||||
</div>
|
||||
<button class="luf-primary" type="submit">Programm anlegen</button>
|
||||
</form>
|
||||
<form wire:submit="createModule">
|
||||
<h2>Neues Modul</h2>
|
||||
<div class="luf-field">
|
||||
<label for="neues-modul">Name</label>
|
||||
<input id="neues-modul" type="text" wire:model="moduleName" required>
|
||||
</div>
|
||||
<button class="luf-primary" type="submit">Modul anlegen</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</x-filament-panels::page>
|
||||
@@ -1,41 +1,79 @@
|
||||
<div class="luf-work">
|
||||
<p class="luf-note"><a href="{{ \App\Filament\Pages\EditorialDesk::getUrl() }}">Zum Arbeitsplatz</a></p>
|
||||
<div class="luf-toolbar">
|
||||
<a class="luf-link" href="{{ \App\Filament\Pages\EditorialDesk::getUrl() }}">Zum Arbeitsplatz</a>
|
||||
<p class="luf-status" role="status">{{ $this->editorStatus() }}</p>
|
||||
<div class="luf-actions">
|
||||
<button type="button" class="luf-primary" wire:click="saveDraft">Entwurf speichern</button>
|
||||
@if ($url = $this->previewUrl())
|
||||
<a class="luf-link" href="{{ $url }}" target="_blank" rel="noopener">Vorschau für Trainer</a>
|
||||
@endif
|
||||
<button type="button" class="luf-quiet" wire:click="armRelease">Freigeben</button>
|
||||
<button type="button" class="luf-quiet" wire:click="discardDraft">Entwurf verwerfen</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if ($this->returnUrl !== '')
|
||||
<p class="luf-return">
|
||||
Dieser Eintrag wurde aus einem anderen Aufbau geöffnet.
|
||||
<button type="button" class="luf-primary" wire:click="returnAndInclude">Zurück und einbinden</button>
|
||||
<button type="button" class="luf-primary" wire:click="returnAndInclude">
|
||||
{{ $this->includeNeedsRelease() ? 'Freigeben und einbinden' : 'Zurück und einbinden' }}
|
||||
</button>
|
||||
</p>
|
||||
@endif
|
||||
@if ($this->feedback !== '')
|
||||
<p class="luf-feedback" role="status">{{ $this->feedback }}</p>
|
||||
@endif
|
||||
@if ($this->templateNumber)
|
||||
<p class="luf-note">Arbeitsstand nach Fassung {{ $this->templateNumber }}. Die gespeicherte Fassung bleibt, bis du eine neue übernimmst.</p>
|
||||
@if ($this->releaseArmed)
|
||||
<div class="luf-confirm" role="alertdialog" aria-labelledby="freigabe-titel">
|
||||
<h2 id="freigabe-titel">Diesen Aufbau freigeben</h2>
|
||||
<p>Freigeben übernimmt den aktuellen Aufbau als neue unveränderliche Fassung. Eine frühere Fassung bleibt erhalten und wird nicht überschrieben. Der Entwurf wird danach geschlossen.</p>
|
||||
<div class="luf-actions">
|
||||
<button type="button" class="luf-primary" wire:click="publishRevision">Jetzt freigeben</button>
|
||||
<button type="button" class="luf-quiet" wire:click="cancelRelease">Abbrechen</button>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="luf-split">
|
||||
<section class="luf-pane" aria-label="Aufbau">
|
||||
<h2>Aufbau</h2>
|
||||
<div class="luf-pane-head">
|
||||
<h2>Aufbau</h2>
|
||||
<button type="button" class="luf-primary" wire:click="openPicker">Bestandteil hinzufügen</button>
|
||||
</div>
|
||||
<p class="luf-note">Die Bausteine bleiben sichtbar, auch wenn rechts ein Bestandteil bearbeitet wird. Ziehen sortiert sie. Nach oben und Nach unten tun dasselbe ohne Ziehen.</p>
|
||||
@if ($this->members === [])
|
||||
<p class="luf-empty">
|
||||
@if ($this->isProgram())
|
||||
Dieses Programm hat noch keinen Bestandteil. Suche ein Modul oder ein Medium und übernimm es. Die Datei wird nicht kopiert.
|
||||
Dieses Programm hat noch keinen Bestandteil. Füge ein Modul oder ein Medium hinzu. Die Datei wird nicht kopiert.
|
||||
@else
|
||||
Dieses Modul hat noch keinen Bestandteil. Suche ein vorhandenes Medium oder lege einen Text an. Ein Film ist nicht nötig.
|
||||
Dieses Modul hat noch keinen Bestandteil. Füge ein vorhandenes Medium hinzu oder erstelle einen Text. Ein Film ist nicht nötig.
|
||||
@endif
|
||||
</p>
|
||||
@else
|
||||
<ol class="luf-list">
|
||||
<ol class="luf-blocks"
|
||||
x-data="{ from: null, over: null }"
|
||||
@dragover.prevent
|
||||
@drop.prevent="if (from !== null && over !== null) { $wire.moveTo(from, over); from = null; over = null }">
|
||||
@foreach ($this->members as $index => $member)
|
||||
<li class="luf-part-row" wire:key="teil-{{ $member['target'] }}-{{ $index }}">
|
||||
<button type="button" class="luf-part" wire:click="selectPart({{ $index }})" @if ($this->selected === $index) aria-current="true" @endif>
|
||||
<span class="luf-pos">{{ $index + 1 }}</span>
|
||||
<li class="luf-block luf-tone-{{ $member['tone'] ?? 'text' }} {{ $this->selected === $index ? 'is-selected' : '' }}"
|
||||
wire:key="baustein-{{ $member['target'] }}-{{ $index }}"
|
||||
data-index="{{ $index }}"
|
||||
draggable="true"
|
||||
@dragstart="from = {{ $index }}; $event.dataTransfer.effectAllowed = 'move'"
|
||||
@dragenter.prevent="over = {{ $index }}"
|
||||
:class="{ 'is-drop': over === {{ $index }} && from !== {{ $index }} }">
|
||||
<button type="button" class="luf-block-main" wire:click="selectPart({{ $index }})" @if ($this->selected === $index) aria-current="true" @endif>
|
||||
@if (! empty($member['image']))
|
||||
<img class="luf-thumb" src="{{ $member['image'] }}" alt="">
|
||||
@else
|
||||
<span class="luf-thumb luf-fallback" aria-hidden="true">{{ mb_substr((string) $member['kind'], 0, 1) }}</span>
|
||||
@endif
|
||||
<span>
|
||||
<span class="luf-kind">{{ $member['role'] }}</span>
|
||||
<strong style="display:block">{{ $member['title'] }}</strong>
|
||||
<strong>{{ $member['title'] }}</strong>
|
||||
<span class="luf-meta">{{ $member['kind'] }} · {{ $member['version_label'] }}</span>
|
||||
@if ($children = $this->childrenOf((string) $member['target']))
|
||||
<span class="luf-meta" style="display:block">{{ $children }}</span>
|
||||
<span class="luf-meta">Enthält {{ $children }}</span>
|
||||
@endif
|
||||
</span>
|
||||
</button>
|
||||
@@ -47,71 +85,18 @@
|
||||
@endforeach
|
||||
</ol>
|
||||
@endif
|
||||
|
||||
<h3>Bestandteil suchen</h3>
|
||||
<div class="luf-field">
|
||||
<label for="bestandteil-suche">Name</label>
|
||||
<input id="bestandteil-suche" type="search" wire:model.live.debounce.300ms="search" placeholder="Vorhandenes Medium oder Modul">
|
||||
</div>
|
||||
<div class="luf-scopes" role="group" aria-label="Wonach suchen">
|
||||
<button type="button" class="luf-quiet" wire:click="$set('catalogScope', 'module')" aria-pressed="{{ $this->catalogScope === 'module' ? 'true' : 'false' }}">Module</button>
|
||||
<button type="button" class="luf-quiet" wire:click="$set('catalogScope', 'medien')" aria-pressed="{{ $this->catalogScope === 'medien' ? 'true' : 'false' }}">Medien</button>
|
||||
<button type="button" class="luf-quiet" wire:click="$set('catalogScope', 'alles')" aria-pressed="{{ $this->catalogScope === 'alles' ? 'true' : 'false' }}">Alles</button>
|
||||
<button type="button" class="luf-quiet" wire:click="$set('listCatalog', true)">Vorhandene anzeigen</button>
|
||||
</div>
|
||||
@if ($this->hits() === [] && (trim($this->search) !== '' || $this->listCatalog))
|
||||
<p class="luf-empty">Nichts gefunden.</p>
|
||||
@endif
|
||||
<ul class="luf-results">
|
||||
@foreach ($this->hits() as $hit)
|
||||
<li class="luf-row" wire:key="treffer-{{ $hit['target'] }}">
|
||||
<div class="luf-part">
|
||||
<span>
|
||||
<strong>{{ $hit['title'] }}</strong>
|
||||
<span class="luf-meta" style="display:block">{{ $hit['kind'] }} · {{ $hit['version_label'] }}</span>
|
||||
</span>
|
||||
</div>
|
||||
<button type="button" class="luf-primary" wire:click="addPart('{{ $hit['target'] }}')">Übernehmen</button>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
|
||||
<form wire:submit="addText">
|
||||
<h3>Text anlegen und übernehmen</h3>
|
||||
<p class="luf-note">Der Text wird einmal angelegt und hier verwendet. Dieselbe Fassung kann später woanders wiederverwendet werden.</p>
|
||||
<div class="luf-field">
|
||||
<label for="text-titel">Titel</label>
|
||||
<input id="text-titel" type="text" wire:model="newTextTitle">
|
||||
</div>
|
||||
<div class="luf-field">
|
||||
<label for="text-inhalt">Inhalt</label>
|
||||
<textarea id="text-inhalt" rows="4" wire:model="newTextBody"></textarea>
|
||||
</div>
|
||||
<button class="luf-quiet" type="submit">Text übernehmen</button>
|
||||
</form>
|
||||
|
||||
@if ($this->isProgram())
|
||||
<form wire:submit="startModule">
|
||||
<h3>Neues Modul</h3>
|
||||
<p class="luf-note">Du wechselst in das Modul und kehrst danach in dieses Programm zurück.</p>
|
||||
<div class="luf-field">
|
||||
<label for="modul-name">Name</label>
|
||||
<input id="modul-name" type="text" wire:model="newModuleName">
|
||||
</div>
|
||||
<button class="luf-quiet" type="submit">Modul anlegen und bearbeiten</button>
|
||||
</form>
|
||||
@endif
|
||||
</section>
|
||||
|
||||
<section class="luf-pane" aria-label="Bearbeitung">
|
||||
<div class="luf-tabs" role="tablist">
|
||||
<button type="button" class="luf-quiet" role="tab" wire:click="$set('panel', 'angaben')" aria-selected="{{ $this->panel === 'angaben' ? 'true' : 'false' }}">Angaben</button>
|
||||
<button type="button" class="luf-quiet" role="tab" wire:click="$set('panel', 'bestandteil')" aria-selected="{{ $this->panel === 'bestandteil' ? 'true' : 'false' }}" @disabled($this->selected === null)>Bestandteil</button>
|
||||
<button type="button" class="luf-quiet" role="tab" wire:click="$set('panel', 'fassungen')" aria-selected="{{ $this->panel === 'fassungen' ? 'true' : 'false' }}">Fassungen</button>
|
||||
<div class="luf-tabs" role="tablist" aria-label="Was gerade bearbeitet wird">
|
||||
<button type="button" role="tab" class="luf-quiet" wire:click="$set('panel', 'angaben')" aria-selected="{{ $this->panel === 'angaben' ? 'true' : 'false' }}">Eigenschaften des {{ $this->hostLabel() }}s</button>
|
||||
<button type="button" role="tab" class="luf-quiet" wire:click="$set('panel', 'bestandteil')" aria-selected="{{ $this->panel === 'bestandteil' ? 'true' : 'false' }}" @disabled($this->selected === null)>Ausgewählter Bestandteil</button>
|
||||
<button type="button" role="tab" class="luf-quiet" wire:click="$set('panel', 'fassungen')" aria-selected="{{ $this->panel === 'fassungen' ? 'true' : 'false' }}">Freigegebene Fassungen</button>
|
||||
</div>
|
||||
|
||||
@if ($this->panel === 'bestandteil' && $this->selectedMember())
|
||||
@php($member = $this->selectedMember())
|
||||
<p class="luf-kicker">Bestandteil an dieser Stelle</p>
|
||||
<h2>{{ $member['title'] }}</h2>
|
||||
<p class="luf-meta">{{ $member['kind'] }} · {{ $member['version_label'] }}</p>
|
||||
<div class="luf-field">
|
||||
@@ -120,7 +105,7 @@
|
||||
</div>
|
||||
<p class="luf-note">Die Rolle gilt nur hier. Dasselbe Medium kann woanders eine andere Rolle haben.</p>
|
||||
@if (count($this->selectedAlternatives()) > 1)
|
||||
<h3>Fassung</h3>
|
||||
<h3>Vorhandene Fassung</h3>
|
||||
<div class="luf-scopes">
|
||||
@foreach ($this->selectedAlternatives() as $alternative)
|
||||
<button type="button" class="luf-quiet" wire:click="useVersion({{ $this->selected }}, '{{ $alternative['target'] }}')" aria-pressed="{{ $member['target'] === $alternative['target'] ? 'true' : 'false' }}">{{ $alternative['label'] }}</button>
|
||||
@@ -137,20 +122,19 @@
|
||||
<button type="button" class="luf-quiet" wire:click="removePart({{ $this->selected }})">Aus dem Aufbau nehmen</button>
|
||||
</div>
|
||||
@elseif ($this->panel === 'fassungen')
|
||||
<h2>Fassungen</h2>
|
||||
<p class="luf-kicker">Nur freigegebene Stände</p>
|
||||
<h2>Freigegebene Fassungen</h2>
|
||||
@if ($this->versionChoices() === [])
|
||||
<p class="luf-empty">Noch keine Fassung. Sie entsteht, sobald der Aufbau übernommen wird.</p>
|
||||
<p class="luf-empty">Noch keine freigegebene Fassung. Sie entsteht mit „Freigeben“, nicht beim Speichern des Entwurfs.</p>
|
||||
@else
|
||||
<ul class="luf-list">
|
||||
@foreach ($this->versionChoices() as $version)
|
||||
<li class="luf-row">
|
||||
<div class="luf-part">
|
||||
<span>
|
||||
<strong>{{ $version['text'] }}</strong>
|
||||
@if ($version['current'])
|
||||
<span class="luf-meta" style="display:block">Zuletzt übernommen</span>
|
||||
@endif
|
||||
</span>
|
||||
<div>
|
||||
<strong>{{ $version['text'] }}</strong>
|
||||
@if ($version['current'])
|
||||
<span class="luf-meta">Letzter freigegebener Stand</span>
|
||||
@endif
|
||||
</div>
|
||||
<div class="luf-move">
|
||||
<button type="button" class="luf-quiet" wire:click="loadTemplate({{ $version['id'] }})">Als Vorlage laden</button>
|
||||
@@ -162,10 +146,11 @@
|
||||
@endforeach
|
||||
</ul>
|
||||
@endif
|
||||
<p class="luf-note">Eine übernommene Fassung wird nicht überschrieben. Als Vorlage laden ändert nur den Arbeitsstand.</p>
|
||||
<p class="luf-note">Eine freigegebene Fassung wird nicht überschrieben. Als Vorlage laden ändert nur den Arbeitsstand.</p>
|
||||
@else
|
||||
<h2>Angaben</h2>
|
||||
<p class="luf-note">Name, Anzeigetitel, Kurzbeschreibung, Einordnung und Vorschaubild gelten sofort und legen keine neue Fassung an.</p>
|
||||
<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>
|
||||
<div class="luf-field">
|
||||
<label for="name">Name in der Verwaltung</label>
|
||||
<input id="name" type="text" wire:model="designation" required>
|
||||
@@ -193,7 +178,7 @@
|
||||
@if ($this->thumbnailError)
|
||||
{{ $this->thumbnailError }}
|
||||
@elseif (filled($this->thumbnailPath))
|
||||
Ein Vorschaubild ist hinterlegt. Es gehört zur Anzeige, nicht zur Fassung.
|
||||
Ein Vorschaubild ist hinterlegt.
|
||||
@else
|
||||
Noch kein Vorschaubild.
|
||||
@endif
|
||||
@@ -207,8 +192,8 @@
|
||||
<button type="button" class="luf-quiet" wire:click="savePreview">Vorschaubild speichern</button>
|
||||
</div>
|
||||
|
||||
<h3>Zur Fassung</h3>
|
||||
<p class="luf-note">Lernziel, Zeit und Material gehören zur Fassung. Eine Änderung legt eine neue Fassung an.</p>
|
||||
<h3>Zum fachlichen Stand</h3>
|
||||
<p class="luf-note">Lernziel, Zeit und Material gehören zum Aufbau. Speichern schreibt sie in den Entwurf. Erst Freigeben erzeugt eine neue Fassung.</p>
|
||||
<div class="luf-field">
|
||||
<label for="lernziel">Lernziel</label>
|
||||
<textarea id="lernziel" rows="3" wire:model="learningGoal"></textarea>
|
||||
@@ -222,15 +207,14 @@
|
||||
<textarea id="material" rows="3" wire:model="materialNote"></textarea>
|
||||
</div>
|
||||
<div class="luf-field">
|
||||
<label for="notiz">Notiz zur neuen Fassung</label>
|
||||
<label for="notiz">Notiz zur nächsten Freigabe</label>
|
||||
<input id="notiz" type="text" wire:model="revisionNote">
|
||||
</div>
|
||||
<p class="luf-note">{{ $this->publishHint() }}</p>
|
||||
<button type="button" class="luf-primary" wire:click="publishRevision">Neue Fassung übernehmen</button>
|
||||
@endif
|
||||
|
||||
@if ($this->usageLines() !== [])
|
||||
<h3>Verwendung der letzten Fassung</h3>
|
||||
<h3>Verwendung der letzten freigegebenen Fassung</h3>
|
||||
<ul>
|
||||
@foreach ($this->usageLines() as $line)
|
||||
<li>{{ $line }}</li>
|
||||
@@ -239,13 +223,130 @@
|
||||
@endif
|
||||
|
||||
<details class="luf-rules">
|
||||
<summary>Was beim Speichern passiert</summary>
|
||||
<p>Anzeigetitel, Kurzbeschreibung, Einordnung und Vorschaubild ändern die sichtbare Karte sofort. Sie erzeugen keine neue Inhaltsfassung.</p>
|
||||
<p>Lernziel, Zeit, Material, Rollen und die Reihenfolge erzeugen eine neue Fassung. Die bisherige bleibt für ältere Verweise erhalten.</p>
|
||||
<p>Eine freigegebene Fassung wird nicht überschrieben. Die Freigabe gilt nur für die Fassung, die du ausdrücklich freigibst.</p>
|
||||
<p>Ein Medium oder Modul, das auch woanders steckt, bleibt dort bei seiner bisherigen Fassung. Hier wird nur auf eine vorhandene Fassung verwiesen, nichts wird kopiert.</p>
|
||||
<p>Die Vorschau zeigt den Aufbau der gespeicherten Fassung, wie ein Trainer ihn sieht. Die Datei selbst bleibt an die Lizenz gebunden.</p>
|
||||
<summary>Was Speichern und Freigeben bedeuten</summary>
|
||||
<p>Anzeigetitel, Kurzbeschreibung, Einordnung und Vorschaubild ä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>Ein Medium oder Modul, das auch woanders steckt, bleibt dort bei seiner bisherigen Fassung. Hier wird nur darauf verwiesen.</p>
|
||||
</details>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
@if ($this->pickerOpen)
|
||||
<div class="luf-modal" role="dialog" aria-modal="true" aria-labelledby="picker-titel">
|
||||
<div class="luf-modal-card">
|
||||
<div class="luf-pane-head">
|
||||
<h2 id="picker-titel">Bestandteil hinzufügen</h2>
|
||||
<button type="button" class="luf-quiet" wire:click="closePicker">Schließen</button>
|
||||
</div>
|
||||
<div class="luf-field">
|
||||
<label for="picker-suche">Suche</label>
|
||||
<input id="picker-suche" type="search" wire:model.live.debounce.250ms="pickerQuery" placeholder="Titel oder Beschreibung">
|
||||
</div>
|
||||
<div class="luf-scopes" role="group" aria-label="Inhaltsart">
|
||||
@foreach (['alle' => 'Alle', 'film' => 'Filme', 'dokument' => 'Dokumente', 'text' => 'Texte', 'modul' => 'Module'] as $value => $label)
|
||||
<button type="button" class="luf-quiet" wire:click="$set('pickerKind', '{{ $value }}')" aria-pressed="{{ $this->pickerKind === $value ? 'true' : 'false' }}">{{ $label }}</button>
|
||||
@endforeach
|
||||
</div>
|
||||
<div class="luf-field">
|
||||
<label for="picker-dimension">Fachliche Einordnung</label>
|
||||
<select id="picker-dimension" wire:model.live="pickerDimension">
|
||||
<option value="">Alle Einordnungen</option>
|
||||
@foreach ($this->dimensionGroups() as $group)
|
||||
<optgroup label="{{ $group['label'] }}">
|
||||
@foreach ($group['values'] as $value)
|
||||
<option value="{{ $value['id'] }}">{{ $value['label'] }}</option>
|
||||
@endforeach
|
||||
</optgroup>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
@php($result = $this->pickerResult())
|
||||
<div class="luf-picker">
|
||||
@if ($result['items'] === [])
|
||||
<p class="luf-empty">Nichts gefunden. Ändere die Suche oder erstelle einen neuen Text.</p>
|
||||
@else
|
||||
<ul class="luf-cards">
|
||||
@foreach ($result['items'] as $hit)
|
||||
<li wire:key="treffer-{{ $hit['target'] }}">
|
||||
<button type="button" class="luf-card luf-tone-{{ $hit['tone'] ?? 'text' }}" wire:click="$set('pickerSelected', '{{ $hit['target'] }}')" aria-pressed="{{ $this->pickerSelected === $hit['target'] ? 'true' : 'false' }}">
|
||||
@if (! empty($hit['image']))
|
||||
<img class="luf-thumb" src="{{ $hit['image'] }}" alt="">
|
||||
@else
|
||||
<span class="luf-thumb luf-fallback" aria-hidden="true">{{ mb_substr((string) $hit['kind'], 0, 1) }}</span>
|
||||
@endif
|
||||
<span>
|
||||
<span class="luf-kind">{{ $hit['kind'] }}</span>
|
||||
<strong>{{ $hit['title'] }}</strong>
|
||||
<span class="luf-meta">{{ $hit['version_label'] }}</span>
|
||||
</span>
|
||||
</button>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
@endif
|
||||
<aside class="luf-detail" aria-label="Ausgewählter Inhalt">
|
||||
@if ($detail = $this->pickerDetail())
|
||||
<p class="luf-kicker">{{ $detail['kind'] }}</p>
|
||||
<h3>{{ $detail['title'] }}</h3>
|
||||
<p class="luf-meta">{{ $detail['version_label'] }}</p>
|
||||
@if (filled($detail['summary'] ?? null))
|
||||
<p>{{ $detail['summary'] }}</p>
|
||||
@endif
|
||||
<p class="luf-note">Übernehmen verweist auf diese vorhandene Fassung. Es wird nichts kopiert.</p>
|
||||
<div class="luf-actions">
|
||||
@if ($detail['open_url'])
|
||||
<a class="luf-link" href="{{ $detail['open_url'] }}" target="_blank" rel="noopener">Ansehen</a>
|
||||
@endif
|
||||
<button type="button" class="luf-primary" wire:click="addPart('{{ $detail['target'] }}')">Übernehmen</button>
|
||||
</div>
|
||||
@else
|
||||
<p class="luf-empty">Wähle einen Eintrag, um ihn anzusehen und zu übernehmen.</p>
|
||||
@endif
|
||||
</aside>
|
||||
</div>
|
||||
@if ($result['more'])
|
||||
<p class="luf-note">Es gibt weitere Treffer. Grenze die Suche oder die Inhaltsart ein.</p>
|
||||
@endif
|
||||
<div class="luf-actions">
|
||||
<button type="button" class="luf-quiet" wire:click="openText">Neuen Text erstellen</button>
|
||||
@if ($this->isProgram())
|
||||
<p class="luf-note">Ein neues Modul legst du im Aufbau an. Du kehrst danach hierher zurück.</p>
|
||||
@endif
|
||||
</div>
|
||||
@if ($this->isProgram())
|
||||
<form wire:submit="startModule" class="luf-inline">
|
||||
<label for="modul-name">Name des neuen Moduls</label>
|
||||
<input id="modul-name" type="text" wire:model="newModuleName">
|
||||
<button class="luf-quiet" type="submit">Modul anlegen und bearbeiten</button>
|
||||
</form>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if ($this->textOpen)
|
||||
<div class="luf-modal" role="dialog" aria-modal="true" aria-labelledby="text-titel-ueberschrift">
|
||||
<form class="luf-modal-card luf-modal-narrow" wire:submit="addText">
|
||||
<div class="luf-pane-head">
|
||||
<h2 id="text-titel-ueberschrift">Neuen Text erstellen</h2>
|
||||
<button type="button" class="luf-quiet" wire:click="cancelText">Abbrechen</button>
|
||||
</div>
|
||||
<p class="luf-note">Es entsteht ein eigener, wiederverwendbarer Text. Dieselbe Fassung kann später in einem anderen Modul stehen. Hier wird sie zusätzlich in den aktuellen Aufbau übernommen. Eine Datei wird dabei nicht kopiert.</p>
|
||||
<div class="luf-field">
|
||||
<label for="text-titel">Titel</label>
|
||||
<input id="text-titel" type="text" wire:model="newTextTitle" required>
|
||||
</div>
|
||||
<div class="luf-field">
|
||||
<label for="text-inhalt">Inhalt</label>
|
||||
<textarea id="text-inhalt" rows="8" wire:model="newTextBody" required></textarea>
|
||||
</div>
|
||||
<div class="luf-actions">
|
||||
<button class="luf-primary" type="submit">Text erstellen und übernehmen</button>
|
||||
<button type="button" class="luf-quiet" wire:click="cancelText">Abbrechen</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@@ -20,7 +20,13 @@
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<p class="banner" role="status">Vorschau für die Redaktion, Fassung {{ $number }}. So ist der Aufbau für Trainer gegliedert. Die Dateien selbst werden hier nicht abgespielt.</p>
|
||||
<p class="banner" role="status">
|
||||
@if ($draft ?? false)
|
||||
Vorschau des gespeicherten Entwurfs. So wäre der Aufbau für Trainer gegliedert. Die Dateien selbst werden hier nicht abgespielt.
|
||||
@else
|
||||
Vorschau für die Redaktion, Fassung {{ $number }}. So ist der Aufbau für Trainer gegliedert. Die Dateien selbst werden hier nicht abgespielt.
|
||||
@endif
|
||||
</p>
|
||||
<p><a href="{{ $backUrl }}">Zurück zur Bearbeitung</a></p>
|
||||
@if ($kind)
|
||||
<p class="flag">{{ $kind }}</p>
|
||||
|
||||
@@ -128,10 +128,49 @@
|
||||
.luf-rules summary { cursor: pointer; min-height: 2.75rem; display: flex; align-items: center; color: var(--luf-ink); }
|
||||
.luf-checks { display: grid; gap: 0.35rem; margin: 0 0 0.8rem; }
|
||||
.luf-checks label { display: flex; gap: 0.5rem; align-items: center; min-height: 2.4rem; }
|
||||
.luf-desk-create { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1.25rem; }
|
||||
.luf-desk-create { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin: 0 0 1rem; }
|
||||
.luf-toolbar { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: end; justify-content: space-between; margin: 0 0 1rem; }
|
||||
.luf-toolbar .luf-field { margin: 0; min-width: min(100%, 18rem); flex: 1; }
|
||||
.luf-status { margin: 0; padding: 0.65rem 0.8rem; background: #fff; border-left: 4px solid var(--luf-yellow); max-width: 42rem; }
|
||||
.luf-pane-head, .luf-inline { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; justify-content: space-between; }
|
||||
.luf-inline { margin-top: 0.8rem; }
|
||||
.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 {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr auto;
|
||||
gap: 0.45rem;
|
||||
align-items: center;
|
||||
background: #fff;
|
||||
border: 1px solid var(--luf-line);
|
||||
border-left-width: 6px;
|
||||
padding: 0.35rem;
|
||||
}
|
||||
.luf-card { grid-template-columns: auto 1fr; width: 100%; text-align: left; color: inherit; text-decoration: none; }
|
||||
.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-tone-film { border-left-color: #1b2838; }
|
||||
.luf-tone-dokument { border-left-color: #1769aa; }
|
||||
.luf-tone-text { border-left-color: var(--luf-yellow); }
|
||||
.luf-tone-audio { border-left-color: #7a4e8a; }
|
||||
.luf-tone-modul, .luf-tone-programm { border-left-color: var(--luf-pine); }
|
||||
.luf-block-main { display: flex; gap: 0.7rem; align-items: center; width: 100%; text-align: left; background: transparent; border: 0; color: inherit; padding: 0.25rem; }
|
||||
.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-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-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; }
|
||||
@media (max-width: 860px) {
|
||||
.luf-split, .luf-desk-create { grid-template-columns: 1fr; }
|
||||
.luf-split, .luf-desk-create, .luf-picker { grid-template-columns: 1fr; }
|
||||
.luf-move { grid-auto-flow: column; }
|
||||
.luf-part-row { grid-template-columns: 1fr; }
|
||||
.luf-part-row, .luf-block { grid-template-columns: 1fr; }
|
||||
.luf-cards { grid-template-columns: 1fr; }
|
||||
}
|
||||
</style>
|
||||
@@ -36,9 +36,17 @@
|
||||
|
||||
Route::post('/abmelden', [SessionController::class, 'destroy'])->middleware('auth')->name('logout');
|
||||
|
||||
Route::get('/redaktion/aufbau/{composition}/entwurf', [EditorialPreviewController::class, 'draft'])
|
||||
->middleware('auth:staff')
|
||||
->name('editorial.draft-preview');
|
||||
Route::get('/redaktion/aufbau/{composition}/{version?}', [EditorialPreviewController::class, 'show'])
|
||||
->middleware('auth:staff')
|
||||
->name('editorial.preview');
|
||||
Route::get('/redaktion/karte/{kind}/{subject}', [EditorialPreviewController::class, 'card'])
|
||||
->middleware('auth:staff')
|
||||
->whereIn('kind', ['element', 'komposition'])
|
||||
->whereNumber('subject')
|
||||
->name('editorial.card');
|
||||
Route::get('/redaktion/inhalt/{version}', [ContentPreviewController::class, 'show'])
|
||||
->middleware('auth:staff')
|
||||
->name('content.preview');
|
||||
|
||||
@@ -232,6 +232,60 @@ public function test_a_role_change_stays_on_the_selected_part_when_the_order_cha
|
||||
$this->assertSame($sheet->id, $versions[1]->members[1]->content_element_version_id);
|
||||
}
|
||||
|
||||
public function test_saving_a_draft_ten_times_creates_one_version_only_when_released(): void
|
||||
{
|
||||
$editor = $this->editor();
|
||||
$module = app(ContentService::class)->createComposition('Entwurf Modul', CompositionKind::Uebung);
|
||||
$component = Livewire::actingAs($editor, 'staff')
|
||||
->test(EditExercise::class, ['record' => $module->id])
|
||||
->set('newTextTitle', 'Hinweis')
|
||||
->set('newTextBody', 'Erst der Entwurf.')
|
||||
->call('addText');
|
||||
|
||||
for ($i = 1; $i <= 10; $i++) {
|
||||
$component->set('learningGoal', 'Durchgang '.$i)->call('saveDraft');
|
||||
}
|
||||
|
||||
$module->refresh();
|
||||
$this->assertSame(0, $module->versions()->count());
|
||||
$this->assertSame('Durchgang 10', $module->working_draft['learning_goal']);
|
||||
|
||||
Livewire::actingAs($editor, 'staff')
|
||||
->test(EditExercise::class, ['record' => $module->id])
|
||||
->assertSet('learningGoal', 'Durchgang 10')
|
||||
->call('publishRevision')
|
||||
->assertSet('feedback', 'Die neue Fassung ist übernommen. Die bisherige Fassung bleibt erhalten.');
|
||||
|
||||
$module->refresh();
|
||||
$this->assertSame(1, $module->versions()->count());
|
||||
$this->assertSame('Durchgang 10', $module->versions()->first()->learning_goal);
|
||||
$this->assertNull($module->working_draft);
|
||||
|
||||
Livewire::actingAs($editor, 'staff')
|
||||
->test(EditExercise::class, ['record' => $module->id])
|
||||
->set('learningGoal', 'Nur Entwurf')
|
||||
->call('saveDraft');
|
||||
|
||||
$module->refresh();
|
||||
$this->assertSame(1, $module->versions()->count());
|
||||
$this->assertSame('Durchgang 10', $module->versions()->first()->fresh()->learning_goal);
|
||||
$this->assertSame('Nur Entwurf', $module->working_draft['learning_goal']);
|
||||
}
|
||||
|
||||
public function test_the_picker_finds_a_film_by_title(): void
|
||||
{
|
||||
$content = app(ContentService::class);
|
||||
$content->publishElementVersion($content->createElement('film', 'film', 'Lara im Park'), 'Film');
|
||||
$module = $content->createComposition('Picker Modul', CompositionKind::Uebung);
|
||||
|
||||
Livewire::actingAs($this->editor(), 'staff')
|
||||
->test(EditExercise::class, ['record' => $module->id])
|
||||
->call('openPicker')
|
||||
->set('pickerQuery', 'Lara')
|
||||
->assertSee('Lara im Park')
|
||||
->assertSee('Neuen Text erstellen');
|
||||
}
|
||||
|
||||
public function test_guests_cannot_open_the_trainer_preview(): void
|
||||
{
|
||||
$content = app(ContentService::class);
|
||||
|
||||
@@ -113,8 +113,8 @@ public function test_an_exercise_can_gain_and_drop_a_medium_without_losing_the_o
|
||||
$this->get(ExerciseResource::getUrl('edit', ['record' => $exercise->composition]))
|
||||
->assertOk()
|
||||
->assertSee('Merkblatt')
|
||||
->assertSee('Bestandteil suchen')
|
||||
->assertSee('Neue Fassung übernehmen');
|
||||
->assertSee('Bestandteil hinzufügen')
|
||||
->assertSee('Freigeben');
|
||||
|
||||
$this->get(CourseResource::getUrl('index'))->assertOk()->assertSee('Ein Programm aus Modulen');
|
||||
$this->assertStringContainsString('Ein Kurs ist keine Übung', CompositionKind::Kurs->explanation());
|
||||
|
||||
Reference in new issue
Block a user