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
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:
parent
6269d3302c
commit
f3987e8386
328 changed files with 10618 additions and 389 deletions
|
|
@ -4,18 +4,28 @@ namespace App\Support;
|
|||
|
||||
use App\Models\User;
|
||||
use App\Plugins\Hooks;
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* Hauptnavigation des Portals als Registry: Kern und Plugins tragen Einträge ein.
|
||||
*
|
||||
* app(Navigation::class)->add('news', 'Neuigkeiten', '/neuigkeiten', active: 'news.*', sort: 20);
|
||||
*
|
||||
* Dynamische Einträge (z. B. Seiten aus dem Seitenbaum) liefert ein Provider:
|
||||
*
|
||||
* app(Navigation::class)->provider('pages', fn (Request $request, ?User $user) => [
|
||||
* ['key' => 'page-3', 'label' => 'MAV', 'href' => '/seiten/mav', 'active' => true, 'sort' => 40],
|
||||
* ]);
|
||||
*/
|
||||
class Navigation
|
||||
{
|
||||
/** @var array<string, array{label: string, href: string, active: list<string>, sort: int, ability: string|null}> */
|
||||
/** @var array<string, array{label: string, href: string, active: list<string>, sort: int, ability: string|null, visible: Closure|null}> */
|
||||
private array $items = [];
|
||||
|
||||
/** @var array<string, Closure> */
|
||||
private array $providers = [];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->add('home', 'Startseite', '/', active: 'dashboard', sort: 0);
|
||||
|
|
@ -24,15 +34,24 @@ class Navigation
|
|||
|
||||
/**
|
||||
* @param string|list<string> $active Routennamen (mit *), bei denen der Eintrag aktiv ist
|
||||
* @param (Closure(User): bool)|null $visible zusätzliche Bedingung je Person
|
||||
*/
|
||||
public function add(string $key, string $label, string $href, string|array $active = [], int $sort = 50, ?string $ability = null): void
|
||||
public function add(string $key, string $label, string $href, string|array $active = [], int $sort = 50, ?string $ability = null, ?Closure $visible = null): void
|
||||
{
|
||||
$this->items[$key] = ['label' => $label, 'href' => $href, 'active' => (array) $active, 'sort' => $sort, 'ability' => $ability];
|
||||
$this->items[$key] = ['label' => $label, 'href' => $href, 'active' => (array) $active, 'sort' => $sort, 'ability' => $ability, 'visible' => $visible];
|
||||
}
|
||||
|
||||
public function remove(string $key): void
|
||||
{
|
||||
unset($this->items[$key]);
|
||||
unset($this->items[$key], $this->providers[$key]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Closure(Request, User|null): list<array{key: string, label: string, href: string, active: bool, sort: int}> $items
|
||||
*/
|
||||
public function provider(string $key, Closure $items): void
|
||||
{
|
||||
$this->providers[$key] = $items;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -42,13 +61,21 @@ class Navigation
|
|||
{
|
||||
$items = collect($this->items)
|
||||
->filter(fn (array $item) => $item['ability'] === null || ($user?->can($item['ability']) ?? false))
|
||||
->sortBy('sort')
|
||||
->filter(fn (array $item) => $item['visible'] === null || ($user !== null && ($item['visible'])($user)))
|
||||
->map(fn (array $item, string $key) => [
|
||||
'key' => $key,
|
||||
'label' => $item['label'],
|
||||
'href' => $item['href'],
|
||||
'active' => $item['active'] !== [] && $request->routeIs(...$item['active']),
|
||||
])
|
||||
'sort' => $item['sort'],
|
||||
]);
|
||||
|
||||
foreach ($this->providers as $provider) {
|
||||
$items = $items->merge($provider($request, $user));
|
||||
}
|
||||
|
||||
$items = $items->sortBy('sort')
|
||||
->map(fn (array $item) => ['key' => $item['key'], 'label' => $item['label'], 'href' => $item['href'], 'active' => (bool) $item['active']])
|
||||
->values()
|
||||
->all();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue