Veröffentliche fachliche Säulen als Themenbereiche der Website.
Dieselbe Liste trägt die öffentliche Seite. Medien bleiben privat, Seiten können mehreren Säulen zugeordnet sein. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
af85a94cd5
commit
8cd382c357
21 files changed
+379
-13
No files matched your search
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Domain\Catalog;
|
||||
|
||||
use App\Domain\Cms\Page;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
|
||||
@@ -9,10 +11,40 @@ class Pillar extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'slug',
|
||||
'public_summary',
|
||||
'sort_order',
|
||||
'published_at',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'published_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
public function elements(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(ContentElement::class);
|
||||
}
|
||||
|
||||
public function pages(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Page::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Builder<Pillar> $query
|
||||
* @return Builder<Pillar>
|
||||
*/
|
||||
public function scopePublished(Builder $query): Builder
|
||||
{
|
||||
return $query->whereNotNull('published_at')->orderBy('sort_order')->orderBy('name');
|
||||
}
|
||||
|
||||
public function publicUrl(): string
|
||||
{
|
||||
return route('theme', ['slug' => $this->slug]);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
namespace App\Domain\Catalog;
|
||||
|
||||
use App\Domain\Cms\Page;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class PillarService
|
||||
{
|
||||
public function create(string $name): Pillar
|
||||
@@ -12,10 +15,13 @@ public function create(string $name): Pillar
|
||||
throw new DomainRuleException('Diese fachliche Säule gibt es schon.');
|
||||
}
|
||||
|
||||
return Pillar::query()->create(['name' => $name]);
|
||||
return Pillar::query()->create([
|
||||
'name' => $name,
|
||||
'slug' => $this->uniqueSlug(Str::slug($name, '-', 'de')),
|
||||
]);
|
||||
}
|
||||
|
||||
public function rename(Pillar $pillar, string $name): void
|
||||
public function present(Pillar $pillar, string $name, string $slug, ?string $summary, bool $published, int $sortOrder): void
|
||||
{
|
||||
$name = $this->name($name);
|
||||
|
||||
@@ -23,14 +29,19 @@ public function rename(Pillar $pillar, string $name): void
|
||||
throw new DomainRuleException('Diese fachliche Säule gibt es schon.');
|
||||
}
|
||||
|
||||
$summary = trim((string) $summary);
|
||||
$pillar->name = $name;
|
||||
$pillar->slug = $this->slug($slug, $pillar->id);
|
||||
$pillar->public_summary = $summary === '' ? null : $summary;
|
||||
$pillar->sort_order = max(0, $sortOrder);
|
||||
$pillar->published_at = $published ? ($pillar->published_at ?? now()) : null;
|
||||
$pillar->save();
|
||||
}
|
||||
|
||||
public function delete(Pillar $pillar): void
|
||||
{
|
||||
if ($pillar->elements()->exists()) {
|
||||
throw new DomainRuleException('Eine Säule mit zugeordneten Medien wird nicht gelöscht.');
|
||||
if ($pillar->elements()->exists() || $pillar->pages()->exists()) {
|
||||
throw new DomainRuleException('Eine Säule mit zugeordneten Medien oder Seiten wird nicht gelöscht.');
|
||||
}
|
||||
|
||||
$pillar->delete();
|
||||
@@ -40,6 +51,23 @@ public function delete(Pillar $pillar): void
|
||||
* @param list<int> $pillarIds
|
||||
*/
|
||||
public function assign(ContentElement $element, array $pillarIds): void
|
||||
{
|
||||
$element->pillars()->sync($this->ids($pillarIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<int> $pillarIds
|
||||
*/
|
||||
public function assignPages(Page $page, array $pillarIds): void
|
||||
{
|
||||
$page->pillars()->sync($this->ids($pillarIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<int> $pillarIds
|
||||
* @return list<int>
|
||||
*/
|
||||
private function ids(array $pillarIds): array
|
||||
{
|
||||
$ids = array_values(array_unique(array_map(intval(...), $pillarIds)));
|
||||
|
||||
@@ -47,7 +75,42 @@ public function assign(ContentElement $element, array $pillarIds): void
|
||||
throw new DomainRuleException('Eine fachliche Säule fehlt.');
|
||||
}
|
||||
|
||||
$element->pillars()->sync($ids);
|
||||
return $ids;
|
||||
}
|
||||
|
||||
private function slug(string $slug, ?int $ignoreId = null): string
|
||||
{
|
||||
$slug = Str::slug($slug, '-', 'de');
|
||||
|
||||
if ($slug === '') {
|
||||
throw new DomainRuleException('Die öffentliche Adresse der Säule fehlt.');
|
||||
}
|
||||
|
||||
$existing = Pillar::query()->where('slug', $slug);
|
||||
|
||||
if ($ignoreId !== null) {
|
||||
$existing->whereKeyNot($ignoreId);
|
||||
}
|
||||
|
||||
if ($existing->exists()) {
|
||||
throw new DomainRuleException('Diese öffentliche Adresse ist schon vergeben.');
|
||||
}
|
||||
|
||||
return $slug;
|
||||
}
|
||||
|
||||
private function uniqueSlug(string $base): string
|
||||
{
|
||||
$base = $base !== '' ? $base : 'saeule';
|
||||
$slug = $base;
|
||||
$suffix = 2;
|
||||
|
||||
while (Pillar::query()->where('slug', $slug)->exists()) {
|
||||
$slug = $base.'-'.$suffix;
|
||||
$suffix++;
|
||||
}
|
||||
|
||||
return $slug;
|
||||
}
|
||||
|
||||
private function name(string $name): string
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
|
||||
namespace App\Domain\Cms;
|
||||
|
||||
use App\Domain\Catalog\Pillar;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
|
||||
@@ -42,4 +44,25 @@ public function publicUrl(): string
|
||||
{
|
||||
return $this->path === '/' ? url('/') : url($this->path);
|
||||
}
|
||||
|
||||
public function publicTitle(): string
|
||||
{
|
||||
$revision = $this->publishedRevision;
|
||||
$heading = collect($revision?->blocks ?? [])->firstWhere('type', 'heading');
|
||||
|
||||
if (is_string($revision?->seo_title) && $revision->seo_title !== '') {
|
||||
return $revision->seo_title;
|
||||
}
|
||||
|
||||
if (is_array($heading) && is_string($heading['heading'] ?? null) && $heading['heading'] !== '') {
|
||||
return $heading['heading'];
|
||||
}
|
||||
|
||||
return $this->path;
|
||||
}
|
||||
|
||||
public function pillars(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Pillar::class)->orderBy('pillars.name');
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,14 @@
|
||||
|
||||
namespace App\Filament\Resources\Pages;
|
||||
|
||||
use App\Domain\Catalog\Pillar;
|
||||
use App\Domain\Cms\Blocks\BlockRegistry;
|
||||
use App\Domain\Cms\Page;
|
||||
use App\Filament\Resources\Pages\Pages\CreatePage;
|
||||
use App\Filament\Resources\Pages\Pages\EditPage;
|
||||
use App\Filament\Resources\Pages\Pages\ListPages;
|
||||
use App\Filament\Resources\Pages\RelationManagers\RevisionsRelationManager;
|
||||
use Filament\Forms\Components\CheckboxList;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\Repeater;
|
||||
use Filament\Forms\Components\Select;
|
||||
@@ -48,6 +50,11 @@ public static function form(Schema $schema): Schema
|
||||
->label('SEO-Beschreibung')
|
||||
->maxLength(500)
|
||||
->columnSpanFull(),
|
||||
CheckboxList::make('pillars')
|
||||
->label('Fachliche Säulen')
|
||||
->options(fn (): array => Pillar::query()->orderBy('name')->pluck('name', 'id')->all())
|
||||
->helperText('Eine veröffentlichte Seite erscheint auf den gewählten Themenbereichen der Website. Eine Seite kann mehreren Säulen zugeordnet sein.')
|
||||
->columns(1),
|
||||
Repeater::make('blocks')
|
||||
->label('Bausteine')
|
||||
->schema([
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Resources\Pages\Pages;
|
||||
|
||||
use App\Domain\Catalog\PillarService;
|
||||
use App\Domain\Cms\Page;
|
||||
use App\Domain\Cms\PageService;
|
||||
use App\Filament\Resources\Pages\PageResource;
|
||||
@@ -49,6 +50,7 @@ protected function mutateFormDataBeforeFill(array $data): array
|
||||
$data['blocks'] = $revision?->blocks ?? [];
|
||||
$data['seo_title'] = $revision?->seo_title;
|
||||
$data['seo_description'] = $revision?->seo_description;
|
||||
$data['pillars'] = $this->record->pillars()->pluck('pillars.id')->all();
|
||||
|
||||
return $data;
|
||||
}
|
||||
@@ -63,6 +65,7 @@ protected function handleRecordUpdate(Model $record, array $data): Model
|
||||
$record->update([
|
||||
'path' => $service->normalizePath($data['path']),
|
||||
]);
|
||||
app(PillarService::class)->assignPages($record, array_map(intval(...), $data['pillars'] ?? []));
|
||||
|
||||
$service->saveRevision(
|
||||
$record,
|
||||
|
||||
@@ -42,11 +42,25 @@ protected function getHeaderActions(): array
|
||||
];
|
||||
}
|
||||
|
||||
protected function mutateFormDataBeforeFill(array $data): array
|
||||
{
|
||||
$data['published'] = $this->getRecord()->published_at !== null;
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function handleRecordUpdate(Model $record, array $data): Model
|
||||
{
|
||||
/** @var Pillar $record */
|
||||
try {
|
||||
app(PillarService::class)->rename($record, $data['name']);
|
||||
app(PillarService::class)->present(
|
||||
$record,
|
||||
(string) $data['name'],
|
||||
(string) ($data['slug'] ?? ''),
|
||||
$data['public_summary'] ?? null,
|
||||
(bool) ($data['published'] ?? false),
|
||||
(int) ($data['sort_order'] ?? 0),
|
||||
);
|
||||
} catch (DomainRuleException $exception) {
|
||||
Notification::make()->title($exception->getMessage())->danger()->send();
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ class ListPillars extends ListRecords
|
||||
|
||||
public function getSubheading(): string|Htmlable|null
|
||||
{
|
||||
return 'Die fachlichen Säulen des Materials. Es können weitere hinzukommen. Ein Medium kann mehreren Säulen zugeordnet sein.';
|
||||
return 'Die fachlichen Säulen des Materials. Eine veröffentlichte Säule ist ein Themenbereich der Website. Ein Medium und eine Seite können mehreren Säulen zugeordnet sein.';
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
use App\Filament\Resources\ContentElements\ContentElementResource;
|
||||
use App\Filament\Resources\Pillars\Pages\EditPillar;
|
||||
use App\Filament\Resources\Pillars\Pages\ListPillars;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
@@ -46,6 +48,12 @@ public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema->components([
|
||||
TextInput::make('name')->label('Name')->required(),
|
||||
TextInput::make('slug')->label('Öffentliche Adresse')->required()
|
||||
->helperText('Ergibt die Seite /themen/adresse. Eine Änderung verschiebt die öffentliche Adresse.'),
|
||||
Textarea::make('public_summary')->label('Text für die Website')->rows(5)
|
||||
->helperText('Dieser Text erscheint auf der Website. Die zugeordneten Medien bleiben privat.'),
|
||||
TextInput::make('sort_order')->label('Reihenfolge')->numeric()->minValue(0)->required()->default(0),
|
||||
Toggle::make('published')->label('Auf der Website veröffentlichen'),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -53,6 +61,9 @@ public static function table(Table $table): Table
|
||||
{
|
||||
return $table->columns([
|
||||
TextColumn::make('name')->label('Name')->searchable(),
|
||||
TextColumn::make('public_state')->label('Website')->state(
|
||||
fn (Pillar $record): string => $record->published_at === null ? 'intern' : 'veröffentlicht'
|
||||
),
|
||||
TextColumn::make('elements_count')->counts('elements')->label('Medien'),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Domain\Catalog\Pillar;
|
||||
use App\Domain\Cms\Page;
|
||||
use App\Domain\Cms\PageRevision;
|
||||
use Illuminate\Contracts\View\View;
|
||||
@@ -31,9 +32,10 @@ public function preview(PageRevision $revision): View
|
||||
public function sitemap(): Response
|
||||
{
|
||||
$pages = Page::query()->whereNotNull('published_revision_id')->orderBy('path')->get();
|
||||
$themes = Pillar::query()->published()->get();
|
||||
|
||||
return response()
|
||||
->view('public.sitemap', ['pages' => $pages])
|
||||
->view('public.sitemap', ['pages' => $pages, 'themes' => $themes])
|
||||
->header('Content-Type', 'application/xml');
|
||||
}
|
||||
|
||||
@@ -50,6 +52,7 @@ private function render(Page $page, bool $preview, ?PageRevision $revision = nul
|
||||
'preview' => $preview,
|
||||
'documentTitle' => $revision->seo_title ?: ($heading['heading'] ?? config('app.name')),
|
||||
'documentDescription' => $revision->seo_description,
|
||||
'themes' => $page->path === '/' ? Pillar::query()->published()->get() : collect(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Domain\Catalog\Pillar;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class ThemeController extends Controller
|
||||
{
|
||||
public function index(): View
|
||||
{
|
||||
return view('public.themes.index', [
|
||||
'themes' => Pillar::query()->published()->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function show(string $slug): View
|
||||
{
|
||||
$theme = Pillar::query()->published()->where('slug', $slug)->firstOrFail();
|
||||
$pages = $theme->pages()
|
||||
->whereNotNull('published_revision_id')
|
||||
->with('publishedRevision')
|
||||
->orderBy('path')
|
||||
->get();
|
||||
|
||||
return view('public.themes.show', [
|
||||
'theme' => $theme,
|
||||
'pages' => $pages,
|
||||
'documentDescription' => $this->description($theme),
|
||||
]);
|
||||
}
|
||||
|
||||
private function description(Pillar $theme): string
|
||||
{
|
||||
$summary = trim((string) $theme->public_summary);
|
||||
$summary = preg_replace('/\s+/', ' ', $summary) ?? '';
|
||||
|
||||
if (mb_strlen($summary) <= 160) {
|
||||
return $summary;
|
||||
}
|
||||
|
||||
return rtrim(mb_substr($summary, 0, 157)).'…';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?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('pillars', function (Blueprint $table) {
|
||||
$table->string('slug')->nullable()->unique();
|
||||
$table->text('public_summary')->nullable();
|
||||
$table->unsignedInteger('sort_order')->default(0);
|
||||
$table->timestamp('published_at')->nullable();
|
||||
});
|
||||
|
||||
Schema::create('page_pillar', function (Blueprint $table) {
|
||||
$table->foreignId('page_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('pillar_id')->constrained()->restrictOnDelete();
|
||||
$table->primary(['page_id', 'pillar_id']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('page_pillar');
|
||||
|
||||
Schema::table('pillars', function (Blueprint $table) {
|
||||
$table->dropColumn(['slug', 'public_summary', 'sort_order', 'published_at']);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -10,6 +10,7 @@ ## Bedienbar
|
||||
- Manuelle Vergabe als Kundenbetreuung, am Benutzer in der Verwaltung.
|
||||
- Registrierung, Anmeldung, kostenloser Abruf, Testkauf, Ablehnung und Widerruf im Mitgliederbereich. Die Verwaltung fragt den Authenticator-Code auf demselben Browser 30 Tage lang nicht erneut ab. In der Authenticator-App heißt der Eintrag „Lara&Felix“, außerhalb der Produktion „Lara&Felix (dev)“. Ein bestehender Eintrag übernimmt den Namen erst bei erneuter Einrichtung.
|
||||
- Medien werden in der Verwaltung angelegt und geöffnet: die Datei oder der Text der gewählten Fassung ist dort sichtbar. Jede Fassung hat eine eigene Nummer. Beschreibung, Arbeitstitel und Säulen gehören zum Medium und ändern keine Fassung. Eine deaktivierte Fassung bleibt einsehbar, wird nicht mehr ausgeliefert und lässt sich nicht neu einbauen. Eine Datei darf bis 2 GB groß sein. Ein Medium kann mehreren fachlichen Säulen zugeordnet sein; weitere Säulen lassen sich anlegen. Übungen, Kurse und fachliche Kombinationen sind getrennte Zusammenstellungen; ihre Bausteine lassen sich hinzufügen, tauschen und aus der neuen Fassung nehmen.
|
||||
- Eine veröffentlichte fachliche Säule ist ein Themenbereich der Website unter `/themen` und auf der Startseite. Seiten können mehreren Säulen zugeordnet sein. Die Medien selbst bleiben privat.
|
||||
- Kurse im Mitgliederbereich zeigen den Namen der Übung, die Bausteine in Reihenfolge und einen Player. Ein Film mit Entscheidungsmarke lässt sich an dieser Stelle pausieren und von vorn starten. Die Verwaltung zeigt den Text einer Fassung und, sobald die Datei übernommen ist, die Datei selbst.
|
||||
- Bibliothek entscheidet je Abruf erneut. Filme mit Datei werden im Player geladen, Texte und PDF über einen kurz signierten Abruf.
|
||||
|
||||
|
||||
+20
-4
@@ -152,10 +152,26 @@ .faq dd {
|
||||
max-width: 62ch;
|
||||
}
|
||||
|
||||
.lede {
|
||||
font-size: 1.25rem;
|
||||
line-height: 1.45;
|
||||
margin: 0;
|
||||
.themes {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 1.5rem 0 0;
|
||||
}
|
||||
|
||||
.themes li {
|
||||
border-top: 1px solid var(--color-line);
|
||||
padding: 1rem 0;
|
||||
}
|
||||
|
||||
.themes a {
|
||||
font-family: var(--font-serif);
|
||||
font-size: 1.5rem;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.themes p {
|
||||
max-width: 62ch;
|
||||
margin: 0.35rem 0 0;
|
||||
}
|
||||
|
||||
.prose p {
|
||||
|
||||
@@ -13,4 +13,10 @@
|
||||
@include('public.blocks.'.$block['type'], ['block' => $block, 'first' => $loop->first])
|
||||
</section>
|
||||
@endforeach
|
||||
@if ($page->path === '/' && ($themes ?? collect())->isNotEmpty())
|
||||
<section class="block">
|
||||
<h2>Themenbereiche</h2>
|
||||
@include('public.themes.list', ['themes' => $themes])
|
||||
</section>
|
||||
@endif
|
||||
@endsection
|
||||
@@ -3,4 +3,7 @@
|
||||
@foreach ($pages as $page)
|
||||
<url><loc>{{ $page->publicUrl() }}</loc></url>
|
||||
@endforeach
|
||||
@foreach ($themes as $theme)
|
||||
<url><loc>{{ $theme->publicUrl() }}</loc></url>
|
||||
@endforeach
|
||||
</urlset>
|
||||
@@ -0,0 +1,16 @@
|
||||
@extends('layouts.site')
|
||||
|
||||
@section('title', 'Themenbereiche')
|
||||
@section('canonical', route('themes'))
|
||||
|
||||
@section('content')
|
||||
<section class="block">
|
||||
<h1>Themenbereiche</h1>
|
||||
<p class="lede">Die fachlichen Säulen des Trainings, jeweils mit den Seiten, die dazu veröffentlicht sind.</p>
|
||||
@if ($themes->isEmpty())
|
||||
<p>Noch kein Themenbereich ist veröffentlicht.</p>
|
||||
@else
|
||||
@include('public.themes.list', ['themes' => $themes])
|
||||
@endif
|
||||
</section>
|
||||
@endsection
|
||||
@@ -0,0 +1,10 @@
|
||||
<ul class="themes">
|
||||
@foreach ($themes as $theme)
|
||||
<li>
|
||||
<a href="{{ $theme->publicUrl() }}">{{ $theme->name }}</a>
|
||||
@if (filled($theme->public_summary))
|
||||
<p>{{ $theme->public_summary }}</p>
|
||||
@endif
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
@@ -0,0 +1,22 @@
|
||||
@extends('layouts.site')
|
||||
|
||||
@section('title', $theme->name)
|
||||
@section('description', $documentDescription)
|
||||
@section('canonical', $theme->publicUrl())
|
||||
|
||||
@section('content')
|
||||
<section class="block">
|
||||
<p><a href="{{ route('themes') }}">Themenbereiche</a></p>
|
||||
<h1>{{ $theme->name }}</h1>
|
||||
@if (filled($theme->public_summary))
|
||||
<p class="lede">{{ $theme->public_summary }}</p>
|
||||
@endif
|
||||
@if ($pages->isNotEmpty())
|
||||
<ul class="themes">
|
||||
@foreach ($pages as $page)
|
||||
<li><a href="{{ $page->publicUrl() }}">{{ $page->publicTitle() }}</a></li>
|
||||
@endforeach
|
||||
</ul>
|
||||
@endif
|
||||
</section>
|
||||
@endsection
|
||||
@@ -10,10 +10,13 @@
|
||||
use App\Http\Controllers\Member\MemberController;
|
||||
use App\Http\Controllers\PageController;
|
||||
use App\Http\Controllers\PublicMediaController;
|
||||
use App\Http\Controllers\ThemeController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::get('/', [PageController::class, 'home'])->name('home');
|
||||
Route::get('/sitemap.xml', [PageController::class, 'sitemap'])->name('sitemap');
|
||||
Route::get('/themen', [ThemeController::class, 'index'])->name('themes');
|
||||
Route::get('/themen/{slug}', [ThemeController::class, 'show'])->name('theme')->where('slug', '[a-z0-9]+(?:-[a-z0-9]+)*');
|
||||
Route::get('/medien/{path}', [PublicMediaController::class, 'show'])->where('path', '.*')->name('media.public');
|
||||
|
||||
Route::middleware('guest')->group(function () {
|
||||
|
||||
@@ -57,7 +57,7 @@ public function test_a_medium_can_belong_to_several_pillars_and_a_course_keeps_t
|
||||
->assertOk()
|
||||
->assertSee('Grenzen')
|
||||
->assertSee('Alltag')
|
||||
->assertSee('weitere hinzukommen');
|
||||
->assertSee('Themenbereich der Website');
|
||||
}
|
||||
|
||||
public function test_a_pillar_with_media_cannot_be_deleted(): void
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Domain\Catalog\ContentService;
|
||||
use App\Domain\Catalog\PillarService;
|
||||
use App\Domain\Cms\Page;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class PublicThemeTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_published_pillars_are_the_public_topics_and_media_stay_private(): void
|
||||
{
|
||||
$pillars = app(PillarService::class);
|
||||
$grenzen = $pillars->create('Grenzen');
|
||||
$hilfe = $pillars->create('Hilfe holen');
|
||||
$film = app(ContentService::class)->createElement('film', 'film', 'Geheimer Film');
|
||||
$pillars->assign($film, [$grenzen->id, $hilfe->id]);
|
||||
$page = Page::query()->where('path', '/praevention')->firstOrFail();
|
||||
$draft = Page::query()->create(['path' => '/entwurf-thema']);
|
||||
$pillars->assignPages($page, [$grenzen->id, $hilfe->id]);
|
||||
$pillars->assignPages($draft, [$grenzen->id]);
|
||||
|
||||
$this->get('/themen')->assertOk()->assertSee('Noch kein Themenbereich ist veröffentlicht.');
|
||||
$this->get('/themen/grenzen')->assertNotFound();
|
||||
|
||||
$pillars->present($grenzen, 'Grenzen', 'grenzen', 'Nein sagen und dabei bleiben.', true, 1);
|
||||
$pillars->present($hilfe, 'Hilfe holen', 'hilfe-holen', 'Eine Vertrauensperson finden.', true, 2);
|
||||
|
||||
$this->get('/')
|
||||
->assertOk()
|
||||
->assertSee('Themenbereiche')
|
||||
->assertSee('Grenzen')
|
||||
->assertSee('Hilfe holen')
|
||||
->assertSee('Nein sagen und dabei bleiben.')
|
||||
->assertDontSee('Geheimer Film');
|
||||
|
||||
$this->get('/themen/grenzen')
|
||||
->assertOk()
|
||||
->assertSee('Präventionskonzept')
|
||||
->assertDontSee('/entwurf-thema')
|
||||
->assertDontSee('Geheimer Film');
|
||||
|
||||
$this->get('/themen/hilfe-holen')
|
||||
->assertOk()
|
||||
->assertSee('Präventionskonzept');
|
||||
|
||||
$this->get('/sitemap.xml')
|
||||
->assertOk()
|
||||
->assertSee(url('/themen/grenzen'), false)
|
||||
->assertSee(url('/themen/hilfe-holen'), false);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user