Phase 4: Seiten mit Pagebuilder, Redaktion und Freigaben
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m56s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 1m56s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 2m2s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 2m9s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 2m40s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 2m35s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 2m29s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 2m38s
CI / Build-Artefakte aktuell (pull_request) Successful in 55s

- Seiten-Plugin: Seitenbaum mit Adressen, Seitennavigation, Brotkrumen und
  optional Hauptnavigation; Sichtbarkeit vererbt sich auf Unterseiten
- Pagebuilder (Block-Registry im Kern, Plugins tragen Blöcke bei): Abschnitt,
  Spalten, Tabs, Akkordeon, Box, Überschrift, Text (TipTap), Zitat,
  Schaltflächen, Symbolliste, Tabelle, Trennlinie, Abstand, Bild, Galerie,
  Video (erst nach Klick), Titelbild, Ansprechpartner, Downloads, Unterseiten,
  Neuigkeiten, Termine; Sichtbarkeit je Block; Bereinigung beim Speichern
- Editor im Portal: Ziehen und Ablegen, Autospeichern als Entwurf,
  Rückgängig, Gerätevorschau, Versionen, Zeitsteuerung, Bearbeitungssperre,
  Freigabe anfordern
- Rechte „inkl. Unterseiten“ werden im Rechte-Cache aufgelöst
- Neuigkeiten: Schreiben im Portal, Freigabe-Workflow mit Benachrichtigungen
- Bereich „Redaktion“, Benachrichtigungen im Portal
- storage/.migrations-fingerprint nicht mehr ausliefern

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Friederich Loheide 2026-09-26 08:52:19 +00:00
parent 6269d3302c
commit f3987e8386
328 changed files with 10618 additions and 389 deletions

View file

@ -0,0 +1,47 @@
<script setup>
import { ref, watch } from 'vue';
import { useForm } from '@inertiajs/vue3';
import { Button } from '@/components/ui/button';
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from '@/components/ui/dialog';
import { Input } from '@/components/ui/input';
const props = defineProps({
parentId: { type: Number, default: null },
parentTitle: { type: String, default: '' },
});
const open = defineModel('open', { type: Boolean, default: false });
const emit = defineEmits(['before-create']);
const form = useForm({ title: '', parent_id: null });
watch(open, (value) => value && (form.reset(), form.clearErrors()));
async function create() {
emit('before-create');
form.parent_id = props.parentId;
form.post('/redaktion/seiten');
}
</script>
<template>
<Dialog v-model:open="open">
<DialogContent class="sm:max-w-md">
<DialogHeader>
<DialogTitle>{{ parentId ? 'Unterseite anlegen' : 'Neue Seite' }}</DialogTitle>
<DialogDescription v-if="parentId">Unter „{{ parentTitle }}“. Die Seite ist erst nach dem Veröffentlichen sichtbar.</DialogDescription>
<DialogDescription v-else>Auf der obersten Ebene. Die Seite ist erst nach dem Veröffentlichen sichtbar.</DialogDescription>
</DialogHeader>
<form class="grid gap-4" @submit.prevent="create">
<label class="grid gap-1.5">
<span class="text-[13px] font-medium">Titel</span>
<Input v-model="form.title" maxlength="200" autofocus :aria-invalid="!!form.errors.title" />
<span v-if="form.errors.title" class="text-[13px] text-destructive">{{ form.errors.title }}</span>
</label>
<DialogFooter>
<Button type="button" variant="outline" @click="open = false">Abbrechen</Button>
<Button type="submit" :disabled="form.processing || !form.title.trim()">Anlegen und bearbeiten</Button>
</DialogFooter>
</form>
</DialogContent>
</Dialog>
</template>

View file

@ -0,0 +1,67 @@
<script setup>
import { ref, watch } from 'vue';
import { Button } from '@/components/ui/button';
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from '@/components/ui/dialog';
import { Input } from '@/components/ui/input';
import { Switch } from '@/components/ui/switch';
import { http } from '@/lib/http';
const props = defineProps({
page: { type: Object, required: true },
base: { type: String, required: true },
});
const open = defineModel('open', { type: Boolean, default: false });
const emit = defineEmits(['saved']);
const form = ref({ slug: '', in_navigation: false });
const errors = ref({});
const busy = ref(false);
watch(open, (value) => {
if (value) {
form.value = { slug: props.page.slug, in_navigation: props.page.in_navigation };
errors.value = {};
}
});
async function save() {
busy.value = true;
try {
emit('saved', await http.put(`${props.base}/einstellungen`, form.value));
open.value = false;
} catch (error) {
errors.value = error.fieldErrors ?? {};
} finally {
busy.value = false;
}
}
</script>
<template>
<Dialog v-model:open="open">
<DialogContent class="sm:max-w-md">
<DialogHeader>
<DialogTitle>Seiteneinstellungen</DialogTitle>
<DialogDescription>Sichtbarkeit und Rechte pflegen Sie in der Administration unter „Seiten“.</DialogDescription>
</DialogHeader>
<form class="grid gap-4" @submit.prevent="save">
<label class="grid gap-1.5">
<span class="text-[13px] font-medium">Kürzel in der Adresse</span>
<Input v-model="form.slug" maxlength="120" :aria-invalid="!!errors.slug" />
<span v-if="errors.slug" class="text-[13px] text-destructive">{{ errors.slug }}</span>
<span v-else class="text-xs text-muted-foreground">Ändert auch die Adressen aller Unterseiten. Alte Links funktionieren dann nicht mehr.</span>
</label>
<label v-if="page.can.navigation" class="flex items-center justify-between gap-3 text-[13px] font-medium">
In der Hauptnavigation anzeigen
<Switch v-model="form.in_navigation" />
</label>
<DialogFooter>
<Button type="button" variant="outline" @click="open = false">Abbrechen</Button>
<Button type="submit" :disabled="busy">Speichern</Button>
</DialogFooter>
</form>
</DialogContent>
</Dialog>
</template>

View file

@ -0,0 +1,27 @@
<script setup>
import { Link } from '@inertiajs/vue3';
defineProps({
items: { type: Array, required: true },
current: { type: String, required: true },
depth: { type: Number, default: 0 },
});
const contains = (item, url) => item.url === url || item.children.some((child) => contains(child, url));
</script>
<template>
<ul class="grid gap-0.5" :class="depth ? 'mt-0.5 ml-3 border-l pl-2' : 'mt-1'">
<li v-for="item in items" :key="item.id">
<Link
:href="item.url"
class="block rounded-md px-3 py-1.5 text-sm"
:class="item.url === current ? 'bg-brand-soft font-medium text-brand-soft-foreground' : 'text-foreground/80 hover:bg-accent hover:text-foreground'"
:aria-current="item.url === current ? 'page' : undefined"
>
{{ item.title }}
</Link>
<PageTreeNav v-if="item.children.length && contains(item, current)" :items="item.children" :current="current" :depth="depth + 1" />
</li>
</ul>
</template>

View file

@ -0,0 +1,78 @@
<script setup>
import { ref, watch } from 'vue';
import { CalendarClock, Send } from '@lucide/vue';
import { Button } from '@/components/ui/button';
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from '@/components/ui/dialog';
import { Input } from '@/components/ui/input';
const props = defineProps({
scheduledAt: { type: String, default: null },
});
const open = defineModel('open', { type: Boolean, default: false });
const emit = defineEmits(['publish']);
const mode = ref('now');
const when = ref('');
const busy = ref(false);
function localValue(date) {
const pad = (n) => String(n).padStart(2, '0');
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}T${pad(date.getHours())}:${pad(date.getMinutes())}`;
}
watch(open, (value) => {
if (value) {
mode.value = 'now';
const next = new Date(Date.now() + 24 * 3600 * 1000);
next.setHours(7, 0, 0, 0);
when.value = localValue(next);
busy.value = false;
}
});
async function submit() {
busy.value = true;
emit('publish', mode.value === 'later' ? new Date(when.value).toISOString() : null);
setTimeout(() => (busy.value = false), 800);
}
</script>
<template>
<Dialog v-model:open="open">
<DialogContent class="sm:max-w-md">
<DialogHeader>
<DialogTitle>Seite veröffentlichen</DialogTitle>
<DialogDescription>Der aktuelle Stand wird für alle sichtbar, die die Seite sehen dürfen. Frühere Stände bleiben unter „Versionen“ erhalten.</DialogDescription>
</DialogHeader>
<p v-if="props.scheduledAt" class="rounded-md bg-amber-50 px-3 py-2 text-sm text-amber-900 dark:bg-amber-950/50 dark:text-amber-100">
Es ist bereits eine Veröffentlichung geplant. Sie wird durch diese ersetzt.
</p>
<fieldset class="grid gap-2">
<legend class="sr-only">Zeitpunkt</legend>
<label class="flex cursor-pointer items-start gap-3 rounded-md border p-3 has-checked:border-brand-400 has-checked:bg-brand-soft/60">
<input v-model="mode" type="radio" value="now" class="mt-1 accent-[var(--brand)]" />
<span><span class="block text-sm font-medium">Jetzt veröffentlichen</span><span class="block text-xs text-muted-foreground">Sofort sichtbar.</span></span>
</label>
<label class="flex cursor-pointer items-start gap-3 rounded-md border p-3 has-checked:border-brand-400 has-checked:bg-brand-soft/60">
<input v-model="mode" type="radio" value="later" class="mt-1 accent-[var(--brand)]" />
<span class="grid flex-1 gap-2">
<span><span class="block text-sm font-medium">Zeitgesteuert</span><span class="block text-xs text-muted-foreground">Der aktuelle Stand geht zum gewählten Zeitpunkt online.</span></span>
<Input v-if="mode === 'later'" v-model="when" type="datetime-local" :min="localValue(new Date())" aria-label="Zeitpunkt der Veröffentlichung" />
</span>
</label>
</fieldset>
<DialogFooter>
<Button variant="outline" @click="open = false">Abbrechen</Button>
<Button :disabled="busy || (mode === 'later' && !when)" @click="submit">
<CalendarClock v-if="mode === 'later'" /><Send v-else />
{{ mode === 'later' ? 'Planen' : 'Veröffentlichen' }}
</Button>
</DialogFooter>
</DialogContent>
</Dialog>
</template>

View file

@ -0,0 +1,39 @@
<script setup>
import { ref, watch } from 'vue';
import { Send } from '@lucide/vue';
import { Button } from '@/components/ui/button';
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from '@/components/ui/dialog';
import { Textarea } from '@/components/ui/textarea';
const open = defineModel('open', { type: Boolean, default: false });
const emit = defineEmits(['submit']);
const message = ref('');
const busy = ref(false);
watch(open, (value) => value && ((message.value = ''), (busy.value = false)));
function submit() {
busy.value = true;
emit('submit', message.value);
setTimeout(() => (busy.value = false), 1500);
}
</script>
<template>
<Dialog v-model:open="open">
<DialogContent class="sm:max-w-md">
<DialogHeader>
<DialogTitle>Freigabe anfordern</DialogTitle>
<DialogDescription>Ihre Änderungen sind als Entwurf gespeichert. Die Personen, die diese Seite veröffentlichen dürfen, werden benachrichtigt.</DialogDescription>
</DialogHeader>
<label class="grid gap-1.5">
<span class="text-[13px] font-medium">Nachricht (freiwillig)</span>
<Textarea v-model="message" rows="3" maxlength="1000" placeholder="z. B. Bitte bis Freitag veröffentlichen." />
</label>
<DialogFooter>
<Button variant="outline" @click="open = false">Abbrechen</Button>
<Button :disabled="busy" @click="submit"><Send /> Anfordern</Button>
</DialogFooter>
</DialogContent>
</Dialog>
</template>

View file

@ -0,0 +1,94 @@
<script setup>
import { ref, watch } from 'vue';
import { History, LoaderCircle } from '@lucide/vue';
import { toast } from 'vue-sonner';
import { Button } from '@/components/ui/button';
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@/components/ui/dialog';
import PageContent from '@/pagebuilder/PageContent.vue';
import { http } from '@/lib/http';
import { formatRelative } from '@/lib/format';
const props = defineProps({
base: { type: String, required: true },
readOnly: { type: Boolean, default: false },
});
const open = defineModel('open', { type: Boolean, default: false });
const emit = defineEmits(['restored']);
const revisions = ref(null);
const active = ref(null);
const preview = ref(null);
const loading = ref(false);
watch(open, async (value) => {
if (!value) return;
revisions.value = null;
preview.value = null;
active.value = null;
revisions.value = (await http.get(`${props.base}/versionen`)).revisions;
if (revisions.value.length) show(revisions.value[0]);
});
async function show(revision) {
active.value = revision;
loading.value = true;
try {
preview.value = await http.get(`${props.base}/versionen/${revision.id}`);
} finally {
loading.value = false;
}
}
async function restore() {
try {
emit('restored', await http.post(`${props.base}/versionen/${active.value.id}/wiederherstellen`));
} catch (error) {
toast.error(error.message);
}
}
</script>
<template>
<Dialog v-model:open="open">
<DialogContent class="flex h-[85vh] max-w-5xl flex-col gap-0 p-0 sm:max-w-5xl">
<DialogHeader class="border-b px-5 py-4">
<DialogTitle>Versionen</DialogTitle>
<DialogDescription>Jede Veröffentlichung wird gespeichert. Eine ältere Version lässt sich als Entwurf zurückholen.</DialogDescription>
</DialogHeader>
<div class="flex min-h-0 flex-1">
<ul class="w-64 shrink-0 overflow-y-auto border-r p-2">
<li v-if="revisions === null" class="grid place-items-center py-10"><LoaderCircle class="size-5 animate-spin text-muted-foreground" /></li>
<li v-else-if="!revisions.length" class="px-3 py-6 text-center text-sm text-muted-foreground">Noch keine veröffentlichten Versionen.</li>
<li v-for="revision in revisions ?? []" :key="revision.id">
<button
type="button"
class="w-full rounded-md px-3 py-2 text-left"
:class="active?.id === revision.id ? 'bg-brand-soft text-brand-soft-foreground' : 'hover:bg-accent'"
@click="show(revision)"
>
<span class="block text-sm font-medium">{{ formatRelative(revision.created_at) }}</span>
<span class="block truncate text-xs text-muted-foreground">{{ revision.action }}<template v-if="revision.user"> · {{ revision.user }}</template></span>
</button>
</li>
</ul>
<div class="flex min-w-0 flex-1 flex-col">
<div class="min-h-0 flex-1 overflow-y-auto bg-background p-6">
<div v-if="loading" class="grid place-items-center py-16"><LoaderCircle class="size-6 animate-spin text-muted-foreground" /></div>
<template v-else-if="preview">
<h1 class="mb-6 text-2xl font-semibold tracking-tight">{{ preview.title }}</h1>
<PageContent :content="preview.content" />
</template>
</div>
<div v-if="active" class="flex items-center justify-between gap-3 border-t px-5 py-3">
<span class="text-xs text-muted-foreground">{{ new Date(active.created_at).toLocaleString('de-DE', { dateStyle: 'medium', timeStyle: 'short' }) }}</span>
<Button :disabled="readOnly" @click="restore"><History /> Als Entwurf wiederherstellen</Button>
</div>
</div>
</div>
</DialogContent>
</Dialog>
</template>