Ordne die Navigation unter Inhalte neu und führe alte Adressen weiter
Menü: Programme, Module, Übungen, Contentmanager (bisher Medien), dahinter die Fachlichen Kombinationen. Der Arbeitsplatz ist kein Menüpunkt mehr, die gemeinsame Übersicht bleibt über den Filterlink der Stammdaten erreichbar. Dokumente rückt vorläufig hinter die vier Einträge (Position folgt im Dokumentenauftrag). Adressen: programme, module, fachuebungen, contentmanager. Die alten Adressen kurse, uebungen (= Module) und content-elements leiten mit Objektnummer, Unterseite und Filtern per 302 weiter, hinter der Anmeldung des Panels; die Rechte prüft das Ziel. Rücklinks aus der Bearbeitung führen zur Liste der eigenen Art statt zum Arbeitsplatz. Tests: Reihenfolge in UebungNavigationTest bewusst geändert (Übungen standen vor Modulen und Programmen); 'content-elements/' in EditorialEditorTest folgt der neuen Adresse. Neu: VerwaltungNavigationTest. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e72c9ddb8d
commit
3aed45a2fe
15 files changed
+289
-22
No files matched your search
@@ -10,7 +10,7 @@
|
||||
use Illuminate\Contracts\Support\Htmlable;
|
||||
|
||||
/**
|
||||
* Arbeitsplatz: Programme und Module in der gemeinsamen Bestandsliste. Die Listen „Module“ und „Programme“ zeigen
|
||||
* Gemeinsame Übersicht „Programme und Module“ (kein Menüpunkt; Einstieg über die Stammdaten). Die Listen „Module“ und „Programme“ zeigen
|
||||
* dieselben Zeilen mit festem Typ (ListsCompositions).
|
||||
*/
|
||||
class EditorialDesk extends Page
|
||||
@@ -23,6 +23,9 @@ class EditorialDesk extends Page
|
||||
|
||||
protected static ?int $navigationSort = 0;
|
||||
|
||||
/** Kein Menüpunkt mehr; die gemeinsame Übersicht bleibt über den Filterlink der Stammdaten erreichbar. */
|
||||
protected static bool $shouldRegisterNavigation = false;
|
||||
|
||||
protected static ?string $slug = 'arbeitsplatz';
|
||||
|
||||
protected static ?string $title = 'Arbeitsplatz';
|
||||
|
||||
@@ -17,7 +17,7 @@ class CombinationResource extends CompositionKindResource
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Fachliche Kombinationen';
|
||||
|
||||
protected static ?int $navigationSort = 5;
|
||||
protected static ?int $navigationSort = 6;
|
||||
|
||||
public static function kind(): CompositionKind
|
||||
{
|
||||
|
||||
@@ -39,9 +39,7 @@ private function onDesk(): bool
|
||||
|
||||
public function getSubheading(): string|Htmlable|null
|
||||
{
|
||||
$desk = $this->onDesk() && ! in_array($this->kind(), [CompositionKind::Exercise, CompositionKind::Document], true) ? ' Programme und Module stehen gemeinsam auch auf dem Arbeitsplatz.' : '';
|
||||
|
||||
return $this->kind()->deskExplanation().$desk;
|
||||
return $this->kind()->deskExplanation();
|
||||
}
|
||||
|
||||
public function getMaxContentWidth(): Width|string|null
|
||||
|
||||
@@ -24,7 +24,9 @@ class ContentElementResource extends Resource
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Inhalte';
|
||||
|
||||
protected static ?string $navigationLabel = 'Medien';
|
||||
protected static ?string $navigationLabel = 'Contentmanager';
|
||||
|
||||
protected static ?string $slug = 'contentmanager';
|
||||
|
||||
protected static ?string $modelLabel = 'Medium';
|
||||
|
||||
@@ -32,7 +34,7 @@ class ContentElementResource extends Resource
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'working_title';
|
||||
|
||||
protected static ?int $navigationSort = 1;
|
||||
protected static ?int $navigationSort = 4;
|
||||
|
||||
public static function canViewAny(): bool
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
class CourseResource extends CompositionKindResource
|
||||
{
|
||||
protected static ?string $slug = 'kurse';
|
||||
protected static ?string $slug = 'programme';
|
||||
|
||||
protected static ?string $navigationLabel = 'Programme';
|
||||
|
||||
@@ -17,7 +17,7 @@ class CourseResource extends CompositionKindResource
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Programme';
|
||||
|
||||
protected static ?int $navigationSort = 4;
|
||||
protected static ?int $navigationSort = 1;
|
||||
|
||||
public static function kind(): CompositionKind
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ class DocumentResource extends CompositionKindResource
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Dokumente';
|
||||
|
||||
protected static ?int $navigationSort = 4;
|
||||
protected static ?int $navigationSort = 5;
|
||||
|
||||
public static function kind(): CompositionKind
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
class ExerciseResource extends CompositionKindResource
|
||||
{
|
||||
protected static ?string $slug = 'uebungen';
|
||||
protected static ?string $slug = 'module';
|
||||
|
||||
protected static ?string $navigationLabel = 'Module';
|
||||
|
||||
@@ -17,7 +17,7 @@ class ExerciseResource extends CompositionKindResource
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Module';
|
||||
|
||||
protected static ?int $navigationSort = 3;
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
||||
public static function kind(): CompositionKind
|
||||
{
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
use App\Filament\Resources\Practices\Pages\ListPractices;
|
||||
|
||||
/**
|
||||
* Die fachliche Übung. Der ältere Eintrag „Module“ (`ExerciseResource`, Adresse `uebungen`) bleibt unverändert und
|
||||
* zeigt die Zusammenstellungen der Art `uebung`; hier stehen die Übungen mit Varianten.
|
||||
* Die fachliche Übung. Der Eintrag „Module“ (`ExerciseResource`, Adresse `module`) zeigt die Zusammenstellungen der Art `uebung`;
|
||||
* hier stehen die Übungen mit Varianten.
|
||||
*/
|
||||
class PracticeResource extends CompositionKindResource
|
||||
{
|
||||
@@ -21,7 +21,7 @@ class PracticeResource extends CompositionKindResource
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Übungen';
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
protected static ?int $navigationSort = 3;
|
||||
|
||||
public static function kind(): CompositionKind
|
||||
{
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Support;
|
||||
|
||||
use Filament\Facades\Filament;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
/**
|
||||
* Frühere Adressen der Verwaltung. Die Bestände heißen seit der Neuordnung „Inhalte“ anders: Programme
|
||||
* (früher `kurse`), Module (früher `uebungen`) und Contentmanager (früher `content-elements`). Gespeicherte Links
|
||||
* führen mit Objektnummer, Unterseite und Filtern zum neuen Ziel.
|
||||
*
|
||||
* Die Weiterleitung steht hinter der Anmeldung des Panels und trägt selbst keine Daten. Die Rechte prüft erst das
|
||||
* Ziel; wer die Seite nicht sehen darf, bekommt über eine alte Adresse dieselbe Absage wie über die neue. Die
|
||||
* Antwort ist bewusst keine dauerhafte (302): Ein Rückfall des Codes setzt die neuen Adressen zurück, ein im Browser
|
||||
* gemerktes 301 würde dann ins Leere führen.
|
||||
*/
|
||||
final class LegacyAddresses
|
||||
{
|
||||
/** @var array<string, string> alte Adresse => neue Adresse (jeweils unter dem Panelpfad) */
|
||||
public const MOVED = [
|
||||
'kurse' => 'programme',
|
||||
'uebungen' => 'module',
|
||||
'content-elements' => 'contentmanager',
|
||||
];
|
||||
|
||||
public static function routes(): void
|
||||
{
|
||||
foreach (self::MOVED as $old => $new) {
|
||||
Route::get($old.'/{rest?}', fn (Request $request, ?string $rest = null): RedirectResponse => self::redirect($request, $new, $rest))
|
||||
->where('rest', '.*')
|
||||
->name('legacy.'.$old);
|
||||
}
|
||||
}
|
||||
|
||||
private static function redirect(Request $request, string $new, ?string $rest): RedirectResponse
|
||||
{
|
||||
$path = '/'.trim(Filament::getPanel('verwaltung')->getPath(), '/').'/'.$new;
|
||||
$rest = trim((string) $rest, '/');
|
||||
|
||||
if ($rest !== '') {
|
||||
$path .= '/'.$rest;
|
||||
}
|
||||
|
||||
$query = (string) $request->server->get('QUERY_STRING', '');
|
||||
|
||||
return redirect()->to(url($path).($query !== '' ? '?'.$query : ''));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user