Mache den Aufbau von Modulen und Programmen im Arbeitsplatz bedienbar.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
30833f62a1
commit
a7feef2cd2
15 files changed
+2068
-328
No files matched your search
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Domain\Catalog\Composition;
|
||||
use App\Domain\Catalog\CompositionKind;
|
||||
use App\Filament\Resources\ContentElements\ContentElementResource;
|
||||
use App\Filament\Support\EditorialCatalog;
|
||||
use Filament\Pages\Page;
|
||||
use Filament\Support\Enums\Width;
|
||||
use Illuminate\Contracts\Support\Htmlable;
|
||||
use Livewire\Attributes\Url;
|
||||
|
||||
class EditorialDesk extends Page
|
||||
{
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Inhalte';
|
||||
|
||||
protected static ?string $navigationLabel = 'Arbeitsplatz';
|
||||
|
||||
protected static ?int $navigationSort = 0;
|
||||
|
||||
protected static ?string $slug = 'arbeitsplatz';
|
||||
|
||||
protected static ?string $title = 'Arbeitsplatz';
|
||||
|
||||
protected string $view = 'filament.editorial.desk-page';
|
||||
|
||||
#[Url]
|
||||
public string $query = '';
|
||||
|
||||
#[Url]
|
||||
public string $kindFilter = 'alle';
|
||||
|
||||
public string $programName = '';
|
||||
|
||||
public string $moduleName = '';
|
||||
|
||||
public string $feedback = '';
|
||||
|
||||
public function getHeading(): string|Htmlable|null
|
||||
{
|
||||
return 'Programme und Module';
|
||||
}
|
||||
|
||||
public function getSubheading(): string|Htmlable|null
|
||||
{
|
||||
return 'Vorhandene Einträge öffnen oder einen neuen anlegen. Technische Kennungen sind dafür nicht nötig.';
|
||||
}
|
||||
|
||||
public function getMaxContentWidth(): Width|string|null
|
||||
{
|
||||
return Width::Full;
|
||||
}
|
||||
|
||||
public static function canAccess(): bool
|
||||
{
|
||||
return ContentElementResource::editor();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array{title: string, kind: string, stand: string, url: string, summary: string}>
|
||||
*/
|
||||
public function entries(): array
|
||||
{
|
||||
$query = trim($this->query);
|
||||
$needle = mb_strtolower($query);
|
||||
$catalog = app(EditorialCatalog::class);
|
||||
$rows = [];
|
||||
|
||||
$compositions = Composition::query()
|
||||
->whereIn('kind', [CompositionKind::Kurs, CompositionKind::Uebung])
|
||||
->with(['editorialContentKind', 'versions'])
|
||||
->orderBy('designation')
|
||||
->get();
|
||||
|
||||
foreach ($compositions as $composition) {
|
||||
$kind = $composition->kind instanceof CompositionKind
|
||||
? $composition->kind
|
||||
: CompositionKind::from((string) $composition->kind);
|
||||
$label = $kind->deskLabel();
|
||||
|
||||
if ($this->kindFilter === 'programm' && $kind !== CompositionKind::Kurs) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($this->kindFilter === 'modul' && $kind !== CompositionKind::Uebung) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$title = $catalog->compositionTitle($composition);
|
||||
$haystack = mb_strtolower($title.' '.$composition->designation.' '.(string) $composition->summary);
|
||||
|
||||
if ($needle !== '' && ! str_contains($haystack, $needle)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$rows[] = [
|
||||
'title' => $title,
|
||||
'kind' => $label,
|
||||
'stand' => $catalog->stand($composition)['text'],
|
||||
'url' => EditorialCatalog::editUrl($composition),
|
||||
'summary' => (string) ($composition->summary ?? ''),
|
||||
];
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
public function createProgram(): void
|
||||
{
|
||||
$this->create(CompositionKind::Kurs, $this->programName);
|
||||
}
|
||||
|
||||
public function createModule(): void
|
||||
{
|
||||
$this->create(CompositionKind::Uebung, $this->moduleName);
|
||||
}
|
||||
|
||||
private function create(CompositionKind $kind, string $name): void
|
||||
{
|
||||
$name = trim($name);
|
||||
|
||||
if ($name === '') {
|
||||
$this->feedback = 'Der Name fehlt.';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$composition = app(EditorialCatalog::class)->create($name, $kind);
|
||||
$this->redirect(EditorialCatalog::editUrl($composition), navigate: false);
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
use App\Domain\Catalog\Composition;
|
||||
use App\Domain\Catalog\CompositionKind;
|
||||
use App\Filament\Resources\ContentElements\ContentElementResource;
|
||||
use App\Filament\Support\EditorialCatalog;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
@@ -41,13 +42,20 @@ public static function form(Schema $schema): Schema
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table->columns([
|
||||
TextColumn::make('designation')->label('Bezeichnung')->searchable(),
|
||||
TextColumn::make('designation')
|
||||
->label('Name')
|
||||
->formatStateUsing(fn (Composition $record): string => app(EditorialCatalog::class)->compositionTitle($record))
|
||||
->description(fn (Composition $record): ?string => filled($record->display_title) && $record->display_title !== $record->designation ? $record->designation : null)
|
||||
->searchable(['designation', 'display_title', 'summary']),
|
||||
TextColumn::make('stand')
|
||||
->label('Stand')
|
||||
->state(fn (Composition $record): string => app(EditorialCatalog::class)->stand($record)['text']),
|
||||
TextColumn::make('versions_count')->counts('versions')->label('Fassungen'),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getEloquentQuery()->where('kind', static::kind());
|
||||
return parent::getEloquentQuery()->where('kind', static::kind())->with('versions');
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -20,7 +20,11 @@ abstract protected function kind(): CompositionKind;
|
||||
|
||||
public function getSubheading(): string|Htmlable|null
|
||||
{
|
||||
return $this->kind()->deskExplanation();
|
||||
$desk = in_array($this->kind(), [CompositionKind::Kurs, CompositionKind::Uebung], true)
|
||||
? ' Programme und Module liegen gemeinsam auf dem Arbeitsplatz.'
|
||||
: '';
|
||||
|
||||
return $this->kind()->deskExplanation().$desk;
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
|
||||
@@ -0,0 +1,355 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Support;
|
||||
|
||||
use App\Domain\Catalog\ArticleRelease;
|
||||
use App\Domain\Catalog\Composition;
|
||||
use App\Domain\Catalog\CompositionDisplayRelease;
|
||||
use App\Domain\Catalog\CompositionKind;
|
||||
use App\Domain\Catalog\CompositionMember;
|
||||
use App\Domain\Catalog\CompositionVersion;
|
||||
use App\Domain\Catalog\ContentElementVersion;
|
||||
use App\Domain\Catalog\ContentService;
|
||||
use App\Domain\Catalog\ContentVersionStatus;
|
||||
use App\Domain\Catalog\EditorialContentKind;
|
||||
use App\Filament\Resources\Combinations\CombinationResource;
|
||||
use App\Filament\Resources\Courses\CourseResource;
|
||||
use App\Filament\Resources\Exercises\ExerciseResource;
|
||||
|
||||
class EditorialCatalog
|
||||
{
|
||||
/**
|
||||
* @return list<array<string, string|null>>
|
||||
*/
|
||||
public function rows(CompositionVersion $version, int $exceptCompositionId): array
|
||||
{
|
||||
$version->loadMissing([
|
||||
'members.contentElementVersion.element.editorialContentKind',
|
||||
'members.nestedCompositionVersion.composition.editorialContentKind',
|
||||
]);
|
||||
$rows = [];
|
||||
|
||||
foreach ($version->members as $member) {
|
||||
$target = $member->content_element_version_id
|
||||
? 'element:'.$member->content_element_version_id
|
||||
: 'composition:'.$member->nested_composition_version_id;
|
||||
$row = $this->rowForTarget($target, $exceptCompositionId, allowSelf: true);
|
||||
|
||||
if ($row === null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$row['role'] = $member->role;
|
||||
$rows[] = $row;
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string|null>|null
|
||||
*/
|
||||
public function rowForTarget(string $target, int $exceptCompositionId, bool $allowSelf = false): ?array
|
||||
{
|
||||
if (preg_match('/^(element|composition):(\d+)$/', $target, $match) !== 1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($match[1] === 'element') {
|
||||
$version = ContentElementVersion::query()
|
||||
->with('element.editorialContentKind')
|
||||
->find($match[2]);
|
||||
|
||||
if (! $version instanceof ContentElementVersion || $version->status !== ContentVersionStatus::Bereit) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$element = $version->element;
|
||||
$kind = $element->editorialContentKind?->label ?: $this->outputLabel((string) $element->output_class);
|
||||
$title = filled($element->display_title) ? $element->display_title : $element->working_title;
|
||||
|
||||
return [
|
||||
'target' => 'element:'.$version->id,
|
||||
'title' => $title,
|
||||
'kind' => $kind,
|
||||
'version_label' => 'Fassung '.$version->number,
|
||||
'identity' => 'medium:'.$element->id,
|
||||
'open_url' => route('content.preview', $version),
|
||||
'open_label' => 'Medium ansehen',
|
||||
'edit_url' => null,
|
||||
];
|
||||
}
|
||||
|
||||
$version = CompositionVersion::query()
|
||||
->with('composition.editorialContentKind')
|
||||
->find($match[2]);
|
||||
|
||||
if (! $version instanceof CompositionVersion || $version->status !== ContentVersionStatus::Bereit) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $allowSelf && (int) $version->composition_id === $exceptCompositionId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$composition = $version->composition;
|
||||
$kind = $composition->editorialContentKind?->label
|
||||
?: ($composition->kind instanceof CompositionKind ? $composition->kind->deskLabel() : 'Zusammenstellung');
|
||||
|
||||
return [
|
||||
'target' => 'composition:'.$version->id,
|
||||
'title' => $this->compositionTitle($composition),
|
||||
'kind' => $kind,
|
||||
'version_label' => 'Fassung '.$version->number,
|
||||
'identity' => 'zusammenstellung:'.$composition->id,
|
||||
'open_url' => null,
|
||||
'open_label' => null,
|
||||
'edit_url' => self::editUrl($composition),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array<string, string|null>>
|
||||
*/
|
||||
public function search(string $query, string $scope, int $exceptCompositionId): array
|
||||
{
|
||||
$query = trim($query);
|
||||
$like = '%'.str_replace(['%', '_'], ['', ''], $query).'%';
|
||||
$limit = $scope === 'alles' ? 20 : 40;
|
||||
$rows = [];
|
||||
|
||||
if ($scope !== 'module') {
|
||||
$elements = ContentElementVersion::query()
|
||||
->where('status', ContentVersionStatus::Bereit)
|
||||
->with('element.editorialContentKind')
|
||||
->whereHas('element', function ($builder) use ($query, $like): void {
|
||||
if ($query === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
$builder->where('working_title', 'like', $like)
|
||||
->orWhere('display_title', 'like', $like)
|
||||
->orWhere('summary', 'like', $like);
|
||||
})
|
||||
->orderByDesc('id')
|
||||
->limit($limit)
|
||||
->get();
|
||||
|
||||
foreach ($elements as $version) {
|
||||
$row = $this->rowForTarget('element:'.$version->id, $exceptCompositionId);
|
||||
|
||||
if ($row !== null) {
|
||||
$rows[] = $row;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($scope !== 'medien') {
|
||||
$versions = CompositionVersion::query()
|
||||
->where('status', ContentVersionStatus::Bereit)
|
||||
->where('composition_id', '!=', $exceptCompositionId)
|
||||
->with('composition.editorialContentKind')
|
||||
->whereHas('composition', function ($builder) use ($scope, $query, $like): void {
|
||||
if ($scope === 'module') {
|
||||
$builder->where('kind', CompositionKind::Uebung);
|
||||
}
|
||||
|
||||
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)
|
||||
->get();
|
||||
|
||||
foreach ($versions as $version) {
|
||||
$row = $this->rowForTarget('composition:'.$version->id, $exceptCompositionId);
|
||||
|
||||
if ($row !== null) {
|
||||
$rows[] = $row;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return array_slice($rows, 0, 40);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array{target: string, label: string}>
|
||||
*/
|
||||
public function alternatives(string $identity, int $exceptCompositionId): array
|
||||
{
|
||||
if (preg_match('/^(medium|zusammenstellung):(\d+)$/', $identity, $match) !== 1) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$options = [];
|
||||
|
||||
if ($match[1] === 'medium') {
|
||||
$versions = ContentElementVersion::query()
|
||||
->where('content_element_id', $match[2])
|
||||
->where('status', ContentVersionStatus::Bereit)
|
||||
->orderBy('number')
|
||||
->get();
|
||||
|
||||
foreach ($versions as $version) {
|
||||
$options[] = [
|
||||
'target' => 'element:'.$version->id,
|
||||
'label' => 'Fassung '.$version->number,
|
||||
];
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
if ((int) $match[2] === $exceptCompositionId) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$versions = CompositionVersion::query()
|
||||
->where('composition_id', $match[2])
|
||||
->where('status', ContentVersionStatus::Bereit)
|
||||
->orderBy('number')
|
||||
->get();
|
||||
|
||||
foreach ($versions as $version) {
|
||||
$options[] = [
|
||||
'target' => 'composition:'.$version->id,
|
||||
'label' => 'Fassung '.$version->number,
|
||||
];
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
public function defaultRole(string $kind): string
|
||||
{
|
||||
$kind = mb_strtolower($kind);
|
||||
|
||||
return match (true) {
|
||||
str_contains($kind, 'film') => 'Film',
|
||||
str_contains($kind, 'hör') || str_contains($kind, 'audio') => 'Hörstück',
|
||||
str_contains($kind, 'modul') => 'Modul',
|
||||
str_contains($kind, 'programm') => 'Programm',
|
||||
str_contains($kind, 'text'), str_contains($kind, 'dokument'), str_contains($kind, 'merkblatt'), str_contains($kind, 'unterlage') => 'Unterlage',
|
||||
default => 'Bestandteil',
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<string>
|
||||
*/
|
||||
public function usage(CompositionVersion $version): array
|
||||
{
|
||||
$lines = [];
|
||||
$parents = CompositionMember::query()
|
||||
->where('nested_composition_version_id', $version->id)
|
||||
->with('compositionVersion.composition')
|
||||
->get();
|
||||
|
||||
foreach ($parents as $member) {
|
||||
$parent = $member->compositionVersion?->composition;
|
||||
$name = $parent instanceof Composition ? $this->compositionTitle($parent) : 'Zusammenstellung';
|
||||
$lines[] = $name.', Rolle '.$member->role;
|
||||
}
|
||||
|
||||
$articles = ArticleRelease::query()
|
||||
->where('root_composition_version_id', $version->id)
|
||||
->with('article')
|
||||
->get();
|
||||
|
||||
foreach ($articles as $release) {
|
||||
$lines[] = 'Lizenzartikel '.$release->article->code.', Stand '.$release->number;
|
||||
}
|
||||
|
||||
return $lines;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{text: string, number: int|null, released_number: int|null}
|
||||
*/
|
||||
public function stand(Composition $composition): array
|
||||
{
|
||||
$ready = $composition->versions
|
||||
->filter(fn (CompositionVersion $version): bool => $version->status === ContentVersionStatus::Bereit)
|
||||
->sortByDesc('number')
|
||||
->values();
|
||||
$latest = $ready->first();
|
||||
$release = app(CompositionDisplayRelease::class);
|
||||
$released = $ready->first(fn (CompositionVersion $version): bool => $release->isReleased($version));
|
||||
|
||||
if (! $latest instanceof CompositionVersion) {
|
||||
return [
|
||||
'text' => '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');
|
||||
|
||||
if ($released instanceof CompositionVersion && $released->number !== $latest->number) {
|
||||
$text .= '. Angezeigt wird Fassung '.$released->number;
|
||||
}
|
||||
|
||||
return [
|
||||
'text' => $text,
|
||||
'number' => $latest->number,
|
||||
'released_number' => $released instanceof CompositionVersion ? $released->number : null,
|
||||
];
|
||||
}
|
||||
|
||||
public function create(string $designation, CompositionKind $kind): Composition
|
||||
{
|
||||
$composition = app(ContentService::class)->createComposition($designation, $kind);
|
||||
$slug = match ($kind) {
|
||||
CompositionKind::Kurs => 'programm',
|
||||
CompositionKind::Uebung => 'modul',
|
||||
default => null,
|
||||
};
|
||||
$editorial = $slug === null ? null : EditorialContentKind::query()->where('slug', $slug)->first();
|
||||
|
||||
if ($editorial !== null) {
|
||||
$composition->editorial_content_kind_id = $editorial->id;
|
||||
$composition->save();
|
||||
}
|
||||
|
||||
return $composition;
|
||||
}
|
||||
|
||||
public static function editUrl(Composition $composition): string
|
||||
{
|
||||
$kind = $composition->kind instanceof CompositionKind
|
||||
? $composition->kind
|
||||
: CompositionKind::from((string) $composition->kind);
|
||||
$resource = match ($kind) {
|
||||
CompositionKind::Kurs => CourseResource::class,
|
||||
CompositionKind::Kombination => CombinationResource::class,
|
||||
CompositionKind::Uebung => ExerciseResource::class,
|
||||
};
|
||||
|
||||
return $resource::getUrl('edit', ['record' => $composition]);
|
||||
}
|
||||
|
||||
public function compositionTitle(Composition $composition): string
|
||||
{
|
||||
return filled($composition->display_title) ? $composition->display_title : $composition->designation;
|
||||
}
|
||||
|
||||
public function outputLabel(string $outputClass): string
|
||||
{
|
||||
return match ($outputClass) {
|
||||
'film' => 'Film',
|
||||
'audio' => 'Hörstück',
|
||||
'bild' => 'Bild',
|
||||
'document', 'pdf' => 'Dokument',
|
||||
default => 'Text',
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Domain\Catalog\Composition;
|
||||
use App\Domain\Catalog\CompositionStructureReader;
|
||||
use App\Domain\Catalog\CompositionVersion;
|
||||
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\View\View;
|
||||
|
||||
class EditorialPreviewController extends Controller
|
||||
{
|
||||
public function show(Composition $composition, ?CompositionVersion $version = null): View
|
||||
{
|
||||
$this->authorizeStaff();
|
||||
|
||||
if ($version === null) {
|
||||
$version = $composition->versions()
|
||||
->where('status', ContentVersionStatus::Bereit)
|
||||
->orderByDesc('number')
|
||||
->first();
|
||||
}
|
||||
|
||||
abort_unless($version instanceof CompositionVersion, 404);
|
||||
abort_unless((int) $version->composition_id === (int) $composition->id, 404);
|
||||
abort_unless($version->status === ContentVersionStatus::Bereit, 404);
|
||||
|
||||
$catalog = app(EditorialCatalog::class);
|
||||
|
||||
return view('filament.editorial.preview', [
|
||||
'title' => $catalog->compositionTitle($composition),
|
||||
'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,
|
||||
'backUrl' => $catalog->editUrl($composition),
|
||||
'nodes' => array_map(
|
||||
fn (StructureNode $node): array => $this->present($node, $catalog),
|
||||
app(CompositionStructureReader::class)->tree($version),
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
private function present(StructureNode $node, EditorialCatalog $catalog): array
|
||||
{
|
||||
$versionLabel = null;
|
||||
$openUrl = null;
|
||||
|
||||
if ($node->contentElementVersionId !== null) {
|
||||
$version = ContentElementVersion::query()->find($node->contentElementVersionId);
|
||||
$versionLabel = $version instanceof ContentElementVersion ? 'Fassung '.$version->number : null;
|
||||
$openUrl = $version instanceof ContentElementVersion ? route('content.preview', $version) : null;
|
||||
}
|
||||
|
||||
if ($node->compositionVersionId !== null) {
|
||||
$version = CompositionVersion::query()->find($node->compositionVersionId);
|
||||
$versionLabel = $version instanceof CompositionVersion ? 'Fassung '.$version->number : $versionLabel;
|
||||
}
|
||||
|
||||
return [
|
||||
'role' => $node->role,
|
||||
'title' => $node->title,
|
||||
'kind' => $node->editorialKindLabel ?: ($node->outputClass !== null ? $catalog->outputLabel($node->outputClass) : $node->technicalKindLabel),
|
||||
'version' => $versionLabel,
|
||||
'open_url' => $openUrl,
|
||||
'children' => array_map(
|
||||
fn (StructureNode $child): array => $this->present($child, $catalog),
|
||||
$node->children,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
private function authorizeStaff(): void
|
||||
{
|
||||
$user = auth('staff')->user();
|
||||
abort_unless(
|
||||
$user instanceof User && ($user->hasStaffRole(StaffRole::Redakteur) || $user->hasStaffRole(StaffRole::Katalogverwalter)),
|
||||
403,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<x-filament-panels::page>
|
||||
@include('filament.editorial.styles')
|
||||
<div class="luf-work">
|
||||
@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>
|
||||
<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>
|
||||
@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>
|
||||
@else
|
||||
<ul class="luf-list">
|
||||
@foreach ($this->entries() as $entry)
|
||||
<li class="luf-row">
|
||||
<a class="luf-entry" href="{{ $entry['url'] }}">
|
||||
<span>
|
||||
<span class="luf-kind">{{ $entry['kind'] }}</span>
|
||||
<strong style="display:block">{{ $entry['title'] }}</strong>
|
||||
<span class="luf-meta">{{ $entry['stand'] }}</span>
|
||||
@if ($entry['summary'] !== '')
|
||||
<span class="luf-meta" style="display:block">{{ $entry['summary'] }}</span>
|
||||
@endif
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
@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>
|
||||
@@ -0,0 +1,4 @@
|
||||
<x-filament-panels::page>
|
||||
@include('filament.editorial.styles')
|
||||
@include('filament.editorial.editor')
|
||||
</x-filament-panels::page>
|
||||
@@ -0,0 +1,251 @@
|
||||
<div class="luf-work">
|
||||
<p class="luf-note"><a href="{{ \App\Filament\Pages\EditorialDesk::getUrl() }}">Zum Arbeitsplatz</a></p>
|
||||
@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>
|
||||
</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>
|
||||
@endif
|
||||
|
||||
<div class="luf-split">
|
||||
<section class="luf-pane" aria-label="Aufbau">
|
||||
<h2>Aufbau</h2>
|
||||
@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.
|
||||
@else
|
||||
Dieses Modul hat noch keinen Bestandteil. Suche ein vorhandenes Medium oder lege einen Text an. Ein Film ist nicht nötig.
|
||||
@endif
|
||||
</p>
|
||||
@else
|
||||
<ol class="luf-list">
|
||||
@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 }})" aria-current="{{ $this->selected === $index ? 'true' : 'false' }}">
|
||||
<span class="luf-pos">{{ $index + 1 }}</span>
|
||||
<span>
|
||||
<span class="luf-kind">{{ $member['role'] }}</span>
|
||||
<strong style="display:block">{{ $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>
|
||||
@endif
|
||||
</span>
|
||||
</button>
|
||||
<div class="luf-move">
|
||||
<button type="button" class="luf-quiet" wire:click="movePart({{ $index }}, -1)" @disabled($index === 0) aria-label="{{ $member['title'] }} nach oben">Nach oben</button>
|
||||
<button type="button" class="luf-quiet" wire:click="movePart({{ $index }}, 1)" @disabled($index === count($this->members) - 1) aria-label="{{ $member['title'] }} nach unten">Nach unten</button>
|
||||
</div>
|
||||
</li>
|
||||
@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>
|
||||
|
||||
@if ($this->panel === 'bestandteil' && $this->selectedMember())
|
||||
@php($member = $this->selectedMember())
|
||||
<h2>{{ $member['title'] }}</h2>
|
||||
<p class="luf-meta">{{ $member['kind'] }} · {{ $member['version_label'] }}</p>
|
||||
<div class="luf-field">
|
||||
<label for="rolle">Rolle an dieser Stelle</label>
|
||||
<input id="rolle" type="text" wire:model="members.{{ $this->selected }}.role">
|
||||
</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>
|
||||
<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>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
<div class="luf-actions">
|
||||
@if ($member['open_url'])
|
||||
<a class="luf-link" href="{{ $member['open_url'] }}" target="_blank" rel="noopener">Medium ansehen</a>
|
||||
@endif
|
||||
@if ($member['edit_url'])
|
||||
<a class="luf-link" href="{{ $member['edit_url'] }}?zurueck={{ urlencode($this->selfUrl()) }}">Bestandteil bearbeiten</a>
|
||||
@endif
|
||||
<button type="button" class="luf-quiet" wire:click="removePart({{ $this->selected }})">Aus dem Aufbau nehmen</button>
|
||||
</div>
|
||||
@elseif ($this->panel === 'fassungen')
|
||||
<h2>Fassungen</h2>
|
||||
@if ($this->versionChoices() === [])
|
||||
<p class="luf-empty">Noch keine Fassung. Sie entsteht, sobald der Aufbau übernommen wird.</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>
|
||||
<div class="luf-move">
|
||||
<button type="button" class="luf-quiet" wire:click="loadTemplate({{ $version['id'] }})">Als Vorlage laden</button>
|
||||
@if ($url = $this->previewUrlFor($version['id']))
|
||||
<a class="luf-link" href="{{ $url }}" target="_blank" rel="noopener">Vorschau</a>
|
||||
@endif
|
||||
</div>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
@endif
|
||||
<p class="luf-note">Eine übernommene 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>
|
||||
<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">
|
||||
</div>
|
||||
<div class="luf-field">
|
||||
<label for="kurz">Kurzbeschreibung</label>
|
||||
<textarea id="kurz" rows="3" wire:model="summary"></textarea>
|
||||
</div>
|
||||
@foreach ($this->dimensionGroups() as $group)
|
||||
<fieldset class="luf-checks">
|
||||
<legend>{{ $group['label'] }}</legend>
|
||||
@foreach ($group['values'] as $value)
|
||||
<label>
|
||||
<input type="checkbox" value="{{ $value['id'] }}" wire:model="dimensionIds">
|
||||
{{ $value['label'] }}
|
||||
</label>
|
||||
@endforeach
|
||||
</fieldset>
|
||||
@endforeach
|
||||
<p class="luf-meta">
|
||||
@if ($this->thumbnailError)
|
||||
{{ $this->thumbnailError }}
|
||||
@elseif (filled($this->thumbnailPath))
|
||||
Ein Vorschaubild ist hinterlegt. Es gehört zur Anzeige, nicht zur Fassung.
|
||||
@else
|
||||
Noch kein Vorschaubild.
|
||||
@endif
|
||||
</p>
|
||||
<div class="luf-field">
|
||||
<label for="vorschau-bild">Vorschaubild</label>
|
||||
<input id="vorschau-bild" type="file" accept="image/png,image/jpeg,image/webp" wire:model="previewUpload">
|
||||
</div>
|
||||
<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>
|
||||
</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>
|
||||
<div class="luf-field">
|
||||
<label for="lernziel">Lernziel</label>
|
||||
<textarea id="lernziel" rows="3" wire:model="learningGoal"></textarea>
|
||||
</div>
|
||||
<div class="luf-field">
|
||||
<label for="zeit">Zeitbedarf in Minuten</label>
|
||||
<input id="zeit" type="text" inputmode="numeric" wire:model="durationMinutes">
|
||||
</div>
|
||||
<div class="luf-field">
|
||||
<label for="material">Material</label>
|
||||
<textarea id="material" rows="3" wire:model="materialNote"></textarea>
|
||||
</div>
|
||||
<div class="luf-field">
|
||||
<label for="notiz">Notiz zur neuen Fassung</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>
|
||||
<ul>
|
||||
@foreach ($this->usageLines() as $line)
|
||||
<li>{{ $line }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
@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>
|
||||
</details>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,15 @@
|
||||
<ol @class(['nested' => $nested ?? false])>
|
||||
@foreach ($nodes as $node)
|
||||
<li>
|
||||
<p class="flag">{{ $node['role'] }}</p>
|
||||
<h2>{{ $node['title'] }}</h2>
|
||||
<p>{{ $node['kind'] }}@if ($node['version']) · {{ $node['version'] }}@endif</p>
|
||||
@if ($node['open_url'])
|
||||
<p><a href="{{ $node['open_url'] }}">Medium ansehen</a></p>
|
||||
@endif
|
||||
@if ($node['children'] !== [])
|
||||
@include('filament.editorial.preview-nodes', ['nodes' => $node['children'], 'nested' => true])
|
||||
@endif
|
||||
</li>
|
||||
@endforeach
|
||||
</ol>
|
||||
@@ -0,0 +1,47 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Vorschau: {{ $title }}</title>
|
||||
<style>
|
||||
:root { color: #1b2838; font-family: "Source Sans 3", "Segoe UI", sans-serif; font-size: 1.0625rem; line-height: 1.55; }
|
||||
body { margin: 0; background: #e7eee9; }
|
||||
main { width: min(46rem, calc(100% - 2rem)); margin: 1.5rem auto 3rem; }
|
||||
h1, h2 { font-family: Georgia, "Source Serif 4", serif; letter-spacing: -0.02em; }
|
||||
.banner { background: #fff; border-left: 4px solid #0f6e56; padding: 0.8rem 1rem; }
|
||||
.flag { display: inline-block; background-image: linear-gradient(#e2b43a, #e2b43a); background-size: 100% 0.4rem; background-repeat: no-repeat; background-position: 0 100%; font-weight: 650; }
|
||||
a { color: #0f6e56; }
|
||||
ol { list-style: none; padding: 0; display: grid; gap: 0.8rem; }
|
||||
li { background: #f7faf8; border: 1px solid #c5d2cb; padding: 0.8rem 1rem; }
|
||||
.nested { margin-top: 0.8rem; }
|
||||
:focus-visible { outline: 3px solid #1769aa; outline-offset: 3px; }
|
||||
</style>
|
||||
</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><a href="{{ $backUrl }}">Zurück zur Bearbeitung</a></p>
|
||||
@if ($kind)
|
||||
<p class="flag">{{ $kind }}</p>
|
||||
@endif
|
||||
<h1>{{ $title }}</h1>
|
||||
@if (filled($summary))
|
||||
<p>{{ $summary }}</p>
|
||||
@endif
|
||||
@if (filled($learningGoal))
|
||||
<h2>Lernziel</h2>
|
||||
<p>{{ $learningGoal }}</p>
|
||||
@endif
|
||||
@if ($durationMinutes)
|
||||
<p>Zeit: {{ $durationMinutes }} Minuten</p>
|
||||
@endif
|
||||
@if (filled($materialNote))
|
||||
<h2>Material</h2>
|
||||
<p>{{ $materialNote }}</p>
|
||||
@endif
|
||||
<h2>Aufbau</h2>
|
||||
@include('filament.editorial.preview-nodes', ['nodes' => $nodes])
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,137 @@
|
||||
<style>
|
||||
.luf-work {
|
||||
--luf-ink: #1b2838;
|
||||
--luf-pine: #0f6e56;
|
||||
--luf-paper: #f7faf8;
|
||||
--luf-line: #c5d2cb;
|
||||
--luf-yellow: #e2b43a;
|
||||
--luf-quiet: #3e4c5c;
|
||||
color: var(--luf-ink);
|
||||
font-size: 1.02rem;
|
||||
line-height: 1.5;
|
||||
}
|
||||
.luf-work * { box-sizing: border-box; }
|
||||
.luf-work h2, .luf-work h3 {
|
||||
font-family: Georgia, "Source Serif 4", serif;
|
||||
font-weight: 650;
|
||||
letter-spacing: -0.02em;
|
||||
margin: 0 0 0.75rem;
|
||||
}
|
||||
.luf-work h2 { font-size: 1.45rem; }
|
||||
.luf-work h3 { font-size: 1.15rem; }
|
||||
.luf-feedback, .luf-return {
|
||||
margin: 0 0 1rem;
|
||||
padding: 0.75rem 1rem;
|
||||
background: #fff;
|
||||
border-left: 4px solid var(--luf-pine);
|
||||
}
|
||||
.luf-feedback { background: #e7f3ee; }
|
||||
.luf-split {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(16rem, 1.1fr) minmax(18rem, 0.9fr);
|
||||
gap: 1.25rem;
|
||||
align-items: start;
|
||||
}
|
||||
.luf-pane {
|
||||
background: var(--luf-paper);
|
||||
border: 1px solid var(--luf-line);
|
||||
padding: 1rem 1.1rem 1.25rem;
|
||||
min-width: 0;
|
||||
}
|
||||
.luf-work button, .luf-work .luf-link {
|
||||
font: inherit;
|
||||
min-height: 2.75rem;
|
||||
border-radius: 0;
|
||||
}
|
||||
.luf-work button { cursor: pointer; }
|
||||
.luf-work button:focus-visible, .luf-work a:focus-visible, .luf-work input:focus-visible, .luf-work textarea:focus-visible, .luf-work select:focus-visible {
|
||||
outline: 3px solid #1769aa;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
.luf-primary, .luf-work .luf-link {
|
||||
background: var(--luf-pine);
|
||||
color: #fff;
|
||||
border: 0;
|
||||
padding: 0.4rem 0.9rem;
|
||||
text-decoration: none;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
}
|
||||
.luf-quiet {
|
||||
background: #fff;
|
||||
color: var(--luf-ink);
|
||||
border: 1px solid var(--luf-line);
|
||||
padding: 0.35rem 0.7rem;
|
||||
}
|
||||
.luf-quiet[aria-pressed="true"], .luf-part[aria-current="true"] {
|
||||
border-color: var(--luf-pine);
|
||||
box-shadow: inset 0 -3px 0 var(--luf-yellow);
|
||||
}
|
||||
.luf-work button:disabled { opacity: 0.45; cursor: not-allowed; }
|
||||
.luf-list, .luf-results { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
|
||||
.luf-row, .luf-part-row {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr auto;
|
||||
gap: 0.5rem;
|
||||
align-items: center;
|
||||
background: #fff;
|
||||
border: 1px solid var(--luf-line);
|
||||
padding: 0.35rem;
|
||||
}
|
||||
.luf-part, .luf-entry {
|
||||
display: flex;
|
||||
gap: 0.75rem;
|
||||
align-items: baseline;
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
background: transparent;
|
||||
border: 0;
|
||||
color: inherit;
|
||||
padding: 0.35rem 0.4rem;
|
||||
text-decoration: none;
|
||||
}
|
||||
.luf-pos {
|
||||
font-family: Georgia, serif;
|
||||
font-size: 1.35rem;
|
||||
min-width: 1.5rem;
|
||||
color: var(--luf-pine);
|
||||
}
|
||||
.luf-meta, .luf-work .luf-note { color: var(--luf-quiet); font-size: 0.92rem; }
|
||||
.luf-kind {
|
||||
display: inline-block;
|
||||
background-image: linear-gradient(var(--luf-yellow), var(--luf-yellow));
|
||||
background-size: 100% 0.35rem;
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 100%;
|
||||
font-weight: 650;
|
||||
}
|
||||
.luf-move { display: grid; gap: 0.25rem; }
|
||||
.luf-move button { min-height: 2.25rem; padding: 0.2rem 0.45rem; }
|
||||
.luf-field { display: grid; gap: 0.3rem; margin: 0 0 0.85rem; }
|
||||
.luf-field input, .luf-field textarea, .luf-search input {
|
||||
width: 100%;
|
||||
font: inherit;
|
||||
color: inherit;
|
||||
background: #fff;
|
||||
border: 1px solid var(--luf-line);
|
||||
padding: 0.55rem 0.7rem;
|
||||
min-height: 2.75rem;
|
||||
}
|
||||
.luf-scopes, .luf-actions, .luf-tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.6rem 0; }
|
||||
.luf-empty {
|
||||
margin: 0 0 1rem;
|
||||
padding: 0.8rem 0.9rem;
|
||||
background: #fff;
|
||||
border: 1px dashed var(--luf-line);
|
||||
}
|
||||
.luf-rules { margin-top: 1.25rem; color: var(--luf-quiet); }
|
||||
.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; }
|
||||
@media (max-width: 860px) {
|
||||
.luf-split, .luf-desk-create { grid-template-columns: 1fr; }
|
||||
.luf-move { grid-auto-flow: column; }
|
||||
.luf-part-row { grid-template-columns: 1fr; }
|
||||
}
|
||||
</style>
|
||||
@@ -5,6 +5,7 @@
|
||||
use App\Http\Controllers\Auth\RegistrationController;
|
||||
use App\Http\Controllers\Auth\SessionController;
|
||||
use App\Http\Controllers\ContentPreviewController;
|
||||
use App\Http\Controllers\EditorialPreviewController;
|
||||
use App\Http\Controllers\Member\CheckoutController;
|
||||
use App\Http\Controllers\Member\LibraryController;
|
||||
use App\Http\Controllers\Member\MemberController;
|
||||
@@ -35,6 +36,9 @@
|
||||
|
||||
Route::post('/abmelden', [SessionController::class, 'destroy'])->middleware('auth')->name('logout');
|
||||
|
||||
Route::get('/redaktion/aufbau/{composition}/{version?}', [EditorialPreviewController::class, 'show'])
|
||||
->middleware('auth:staff')
|
||||
->name('editorial.preview');
|
||||
Route::get('/redaktion/inhalt/{version}', [ContentPreviewController::class, 'show'])
|
||||
->middleware('auth:staff')
|
||||
->name('content.preview');
|
||||
|
||||
@@ -0,0 +1,215 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Domain\Catalog\Composition;
|
||||
use App\Domain\Catalog\CompositionDisplayRelease;
|
||||
use App\Domain\Catalog\CompositionKind;
|
||||
use App\Domain\Catalog\ContentService;
|
||||
use App\Filament\Pages\EditorialDesk;
|
||||
use App\Filament\Resources\Courses\CourseResource;
|
||||
use App\Filament\Resources\Courses\Pages\EditCourse;
|
||||
use App\Filament\Resources\Exercises\Pages\EditExercise;
|
||||
use App\Models\User;
|
||||
use Filament\Facades\Filament;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Livewire\Livewire;
|
||||
use Tests\TestCase;
|
||||
|
||||
class EditorialEditorTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
Filament::setCurrentPanel(Filament::getPanel('verwaltung'));
|
||||
}
|
||||
|
||||
public function test_the_desk_finds_a_program_and_a_module_by_name(): void
|
||||
{
|
||||
$content = app(ContentService::class);
|
||||
$sheet = $content->publishElementVersion($content->createElement('text', 'text', 'Blatt'), 'Hinweis');
|
||||
$module = $content->publishComposition(
|
||||
$content->createComposition('Modul Abstand', CompositionKind::Uebung),
|
||||
[['role' => 'Unterlage', 'target' => $sheet]],
|
||||
);
|
||||
$content->publishComposition(
|
||||
$content->createComposition('Programm Abstand', CompositionKind::Kurs),
|
||||
[['role' => 'Modul', 'target' => $module]],
|
||||
);
|
||||
$editor = $this->editor();
|
||||
|
||||
Livewire::actingAs($editor, 'staff')
|
||||
->test(EditorialDesk::class)
|
||||
->assertSee('Programm Abstand')
|
||||
->assertSee('Modul Abstand')
|
||||
->set('query', 'Programm')
|
||||
->assertSee('Programm Abstand')
|
||||
->assertDontSee('Modul Abstand')
|
||||
->set('query', 'kein-treffer')
|
||||
->assertSee('Nichts gefunden');
|
||||
}
|
||||
|
||||
public function test_display_data_does_not_create_a_version_and_a_module_works_without_a_film(): void
|
||||
{
|
||||
$editor = $this->editor();
|
||||
$module = app(ContentService::class)->createComposition('Ohne Film', CompositionKind::Uebung);
|
||||
|
||||
Livewire::actingAs($editor, 'staff')
|
||||
->test(EditExercise::class, ['record' => $module->id])
|
||||
->assertSee('Ein Film ist nicht nötig')
|
||||
->set('displayTitle', 'Sichtbar ohne Film')
|
||||
->set('summary', 'Nur eine Beschreibung')
|
||||
->call('saveDisplay')
|
||||
->assertSet('feedback', 'Die Anzeige ist gespeichert. Die Fassung bleibt unverändert.')
|
||||
->set('learningGoal', 'Den Abstand erklären')
|
||||
->call('publishRevision')
|
||||
->assertSet('feedback', 'Eine Fassung braucht mindestens einen Bestandteil. Anzeige und Kurzbeschreibung kannst du schon speichern.')
|
||||
->set('newTextTitle', 'Hinweis ohne Film')
|
||||
->set('newTextBody', 'Zuerst den Abstand ansprechen.')
|
||||
->call('addText')
|
||||
->call('publishRevision');
|
||||
|
||||
$module->refresh();
|
||||
|
||||
$this->assertSame('Sichtbar ohne Film', $module->display_title);
|
||||
$this->assertSame(1, $module->versions()->count());
|
||||
$this->assertSame('Den Abstand erklären', $module->versions()->first()->learning_goal);
|
||||
$this->assertSame(1, $module->versions()->first()->members()->count());
|
||||
}
|
||||
|
||||
public function test_reordering_reuses_a_medium_and_keeps_the_released_version(): void
|
||||
{
|
||||
$content = app(ContentService::class);
|
||||
$sheet = $content->publishElementVersion(
|
||||
$content->createElement('text', 'text', 'Trainerunterlage Abstand'),
|
||||
'Im Kurs zuerst den Abstand ansprechen.',
|
||||
);
|
||||
$film = $content->publishElementVersion(
|
||||
$content->createElement('film', 'film', 'Lara im Park'),
|
||||
'Film',
|
||||
);
|
||||
$firstModule = $content->publishComposition(
|
||||
$content->createComposition('Modul Abstand', CompositionKind::Uebung),
|
||||
[
|
||||
['role' => 'Unterlage', 'target' => $sheet],
|
||||
['role' => 'Film', 'target' => $film],
|
||||
],
|
||||
null,
|
||||
null,
|
||||
['learning_goal' => 'Abstand halten', 'duration_minutes' => 15],
|
||||
);
|
||||
$secondModule = $content->publishComposition(
|
||||
$content->createComposition('Modul Hilfe', CompositionKind::Uebung),
|
||||
[['role' => 'Unterlage', 'target' => $sheet]],
|
||||
);
|
||||
$programVersion = $content->publishComposition(
|
||||
$content->createComposition('Programm Abstand', CompositionKind::Kurs),
|
||||
[
|
||||
['role' => 'Modul', 'target' => $firstModule],
|
||||
['role' => 'Modul', 'target' => $secondModule],
|
||||
],
|
||||
);
|
||||
$editor = $this->editor();
|
||||
app(CompositionDisplayRelease::class)->release($programVersion, $editor);
|
||||
app(CompositionDisplayRelease::class)->release($firstModule, $editor);
|
||||
|
||||
$component = Livewire::actingAs($editor, 'staff')
|
||||
->test(EditCourse::class, ['record' => $programVersion->composition_id])
|
||||
->assertSee('Modul Abstand')
|
||||
->assertSee('Modul Hilfe');
|
||||
$members = $component->get('members');
|
||||
$component->set('members', array_reverse($members))
|
||||
->call('publishRevision')
|
||||
->assertSet('feedback', 'Die neue Fassung ist übernommen. Die bisherige Fassung bleibt erhalten.');
|
||||
|
||||
$versions = $programVersion->composition->versions()->with('members')->orderBy('number')->get();
|
||||
|
||||
$this->assertCount(2, $versions);
|
||||
$this->assertSame($firstModule->id, $versions[0]->members[0]->nested_composition_version_id);
|
||||
$this->assertSame($secondModule->id, $versions[1]->members[0]->nested_composition_version_id);
|
||||
$this->assertTrue(app(CompositionDisplayRelease::class)->isReleased($versions[0]));
|
||||
$this->assertFalse(app(CompositionDisplayRelease::class)->isReleased($versions[1]));
|
||||
$this->assertSame($sheet->id, $firstModule->members()->first()->content_element_version_id);
|
||||
$this->assertSame('Im Kurs zuerst den Abstand ansprechen.', $sheet->fresh()->body);
|
||||
|
||||
Livewire::actingAs($editor, 'staff')
|
||||
->test(EditCourse::class, ['record' => $programVersion->composition_id])
|
||||
->call('releaseDisplay');
|
||||
|
||||
$this->assertTrue(app(CompositionDisplayRelease::class)->isReleased($versions[0]->fresh()));
|
||||
$this->assertTrue(app(CompositionDisplayRelease::class)->isReleased($versions[1]->fresh()));
|
||||
$this->assertSame(1, $film->element->versions()->count());
|
||||
|
||||
$this->actingAs($editor, 'staff')
|
||||
->get(route('editorial.preview', ['composition' => $programVersion->composition, 'version' => $versions[1]]))
|
||||
->assertOk()
|
||||
->assertSee('Vorschau für die Redaktion')
|
||||
->assertSee('Modul Hilfe')
|
||||
->assertSee('Lara im Park')
|
||||
->assertSee('Trainerunterlage Abstand');
|
||||
}
|
||||
|
||||
public function test_a_new_module_returns_into_the_program(): void
|
||||
{
|
||||
$content = app(ContentService::class);
|
||||
$sheet = $content->publishElementVersion($content->createElement('text', 'text', 'Blatt'), 'Hinweis');
|
||||
$program = $content->publishComposition(
|
||||
$content->createComposition('Programm Abstand', CompositionKind::Kurs),
|
||||
[['role' => 'Unterlage', 'target' => $sheet]],
|
||||
);
|
||||
$editor = $this->editor();
|
||||
$programUrl = CourseResource::getUrl('edit', ['record' => $program->composition]);
|
||||
|
||||
$created = Livewire::actingAs($editor, 'staff')
|
||||
->test(EditCourse::class, ['record' => $program->composition_id])
|
||||
->set('newModuleName', 'UX-Prüfung Modul')
|
||||
->call('startModule');
|
||||
$module = Composition::query()->where('designation', 'UX-Prüfung Modul')->firstOrFail();
|
||||
|
||||
$this->assertSame(CompositionKind::Uebung, $module->kind);
|
||||
|
||||
Livewire::actingAs($editor, 'staff')
|
||||
->test(EditExercise::class, ['record' => $module->id])
|
||||
->set('returnUrl', $programUrl)
|
||||
->set('newTextTitle', 'UX-Prüfung Text')
|
||||
->set('newTextBody', 'Nur für die Bedienprüfung.')
|
||||
->call('addText')
|
||||
->call('returnAndInclude')
|
||||
->assertRedirect();
|
||||
|
||||
$version = $module->versions()->firstOrFail();
|
||||
|
||||
$this->actingAs($editor, 'staff')
|
||||
->get($programUrl.'?uebernehmen=composition:'.$version->id)
|
||||
->assertOk()
|
||||
->assertSee('UX-Prüfung Modul')
|
||||
->assertSee('ist in den Aufbau übernommen');
|
||||
|
||||
$this->assertSame(1, $program->composition->versions()->count());
|
||||
$this->assertSame($sheet->id, $program->fresh()->members()->first()->content_element_version_id);
|
||||
}
|
||||
|
||||
public function test_guests_cannot_open_the_trainer_preview(): void
|
||||
{
|
||||
$content = app(ContentService::class);
|
||||
$sheet = $content->publishElementVersion($content->createElement('text', 'text', 'Blatt'), 'Hinweis');
|
||||
$version = $content->publishComposition(
|
||||
$content->createComposition('Programm Abstand', CompositionKind::Kurs),
|
||||
[['role' => 'Unterlage', 'target' => $sheet]],
|
||||
);
|
||||
|
||||
$this->get(route('editorial.preview', ['composition' => $version->composition, 'version' => $version]))
|
||||
->assertRedirect();
|
||||
}
|
||||
|
||||
private function editor(): User
|
||||
{
|
||||
$editor = User::factory()->redakteur()->create();
|
||||
$editor->saveAppAuthenticationSecret('JBSWY3DPEHPK3PXP');
|
||||
|
||||
return $editor;
|
||||
}
|
||||
}
|
||||
@@ -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('Baustein hinzufügen')
|
||||
->assertSee('Neue Fassung veröffentlichen');
|
||||
->assertSee('Bestandteil suchen')
|
||||
->assertSee('Neue Fassung übernehmen');
|
||||
|
||||
$this->get(CourseResource::getUrl('index'))->assertOk()->assertSee('Ein Programm aus Modulen');
|
||||
$this->assertStringContainsString('Ein Kurs ist keine Übung', CompositionKind::Kurs->explanation());
|
||||
@@ -122,16 +122,17 @@ public function test_an_exercise_can_gain_and_drop_a_medium_without_losing_the_o
|
||||
$this->get(ContentElementResource::getUrl('index'))->assertOk()->assertSee('Übungsfilm');
|
||||
|
||||
Livewire::test(EditExercise::class, ['record' => $exercise->composition_id])
|
||||
->fillForm([
|
||||
'designation' => 'Alltag üben',
|
||||
'kind' => 'uebung',
|
||||
'members' => [
|
||||
['role' => 'Film', 'target' => 'element:'.$film->id],
|
||||
],
|
||||
'note' => 'Film statt Merkblatt',
|
||||
])
|
||||
->call('save')
|
||||
->assertHasNoFormErrors();
|
||||
->set('members', [[
|
||||
'role' => 'Film',
|
||||
'target' => 'element:'.$film->id,
|
||||
'title' => 'Übungsfilm',
|
||||
'kind' => 'Film',
|
||||
'version_label' => 'Fassung 1',
|
||||
'identity' => 'medium:'.$film->content_element_id,
|
||||
]])
|
||||
->set('revisionNote', 'Film statt Merkblatt')
|
||||
->call('publishRevision')
|
||||
->assertSet('feedback', 'Die neue Fassung ist übernommen. Die bisherige Fassung bleibt erhalten.');
|
||||
|
||||
$versions = $exercise->composition->versions()->with('members')->orderBy('number')->get();
|
||||
|
||||
@@ -141,16 +142,9 @@ public function test_an_exercise_can_gain_and_drop_a_medium_without_losing_the_o
|
||||
$this->assertSame('Film', $versions[1]->members->first()->role);
|
||||
|
||||
Livewire::test(EditExercise::class, ['record' => $exercise->composition_id])
|
||||
->fillForm([
|
||||
'designation' => 'Alltag üben',
|
||||
'kind' => 'uebung',
|
||||
'learning_goal' => 'Den Abstand üben',
|
||||
'members' => [
|
||||
['role' => 'Film', 'target' => 'element:'.$film->id],
|
||||
],
|
||||
])
|
||||
->call('save')
|
||||
->assertHasNoFormErrors();
|
||||
->set('learningGoal', 'Den Abstand üben')
|
||||
->call('publishRevision')
|
||||
->assertSet('feedback', 'Die neue Fassung ist übernommen. Die bisherige Fassung bleibt erhalten.');
|
||||
|
||||
$this->assertSame('Den Abstand üben', $exercise->composition->versions()->orderByDesc('number')->first()->learning_goal);
|
||||
$this->assertSame(3, $exercise->composition->versions()->count());
|
||||
@@ -181,16 +175,8 @@ public function test_a_composition_preview_is_derived_without_a_new_version(): v
|
||||
$this->actingAs($editor, 'staff');
|
||||
|
||||
Livewire::test(EditExercise::class, ['record' => $exercise->composition_id])
|
||||
->fillForm([
|
||||
'designation' => 'Alltag üben',
|
||||
'kind' => 'uebung',
|
||||
'members' => [
|
||||
['role' => 'Blatt', 'target' => 'element:'.$sheet->id],
|
||||
],
|
||||
'thumbnail_upload' => ['vorschau/karte.png'],
|
||||
])
|
||||
->call('save')
|
||||
->assertHasNoFormErrors();
|
||||
->call('savePreviewImage', 'vorschau/karte.png')
|
||||
->assertSet('feedback', 'Das Vorschaubild ist gespeichert. Die Fassung bleibt unverändert.');
|
||||
|
||||
$composition = $exercise->composition->fresh();
|
||||
|
||||
|
||||
Reference in new issue
Block a user