From 9dc4b4e64d76e3dd89682bcbcc4da49880ff48dd Mon Sep 17 00:00:00 2001 From: Lars Date: Thu, 19 Nov 2026 22:52:25 +0100 Subject: [PATCH] =?UTF-8?q?F=C3=BChre=20Browser-Zur=C3=BCck=20aus=20der=20?= =?UTF-8?q?Redaktion=20verlustfrei=20in=20den=20Ausgangseditor.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Der geöffnete Redaktionsmanager steht in der Adresse (redaktion=1). Zurück und Vor im Browser wechseln innerhalb derselben Komponente; offene Eingaben beider Seiten bleiben erhalten. Co-Authored-By: Claude Opus 5.5 --- .../Support/ManagesEditorialSurface.php | 21 +++++++++++++++++++ tests/Feature/VerwaltungArbeitsplatzTest.php | 20 ++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/app/Filament/Support/ManagesEditorialSurface.php b/app/Filament/Support/ManagesEditorialSurface.php index 107ec6f..8480c81 100644 --- a/app/Filament/Support/ManagesEditorialSurface.php +++ b/app/Filament/Support/ManagesEditorialSurface.php @@ -17,6 +17,7 @@ use App\Http\Controllers\ContentPreviewController; use App\Models\User; use Illuminate\Database\Eloquent\Model; +use Livewire\Attributes\Url; /** * Gemeinsamer Redaktionsmanager für Medien, Module, Programme und Lizenzartikel. @@ -30,6 +31,8 @@ */ trait ManagesEditorialSurface { + /** Steht in der Adresse, damit „Zurück“ im Browser von der Redaktion in den Ausgangseditor führt. */ + #[Url(as: 'redaktion', history: true)] public bool $redaktionOpen = false; public string $redaktionTab = 'texte'; @@ -146,6 +149,24 @@ public function closeRedaktion(): void $this->deskFeedback = ''; } + /** + * Browser-Zurück und -Vor setzen den Wert über die Adresse. Dann gelten dieselben Regeln wie beim Knopf. + */ + public function updatedRedaktionOpen(bool $value): void + { + if ($value) { + abort_unless($this->canViewEditorial(), 403); + $this->redaktionWillOpen(); + $this->loadRedaktionStaging(); + + return; + } + + $this->ausgabeOpen = false; + $this->closePicker(); + $this->deskFeedback = ''; + } + public function showRedaktionTab(string $tab): void { if (in_array($tab, ['texte', 'medien', 'einordnung'], true)) { diff --git a/tests/Feature/VerwaltungArbeitsplatzTest.php b/tests/Feature/VerwaltungArbeitsplatzTest.php index 8b17dac..eedda15 100644 --- a/tests/Feature/VerwaltungArbeitsplatzTest.php +++ b/tests/Feature/VerwaltungArbeitsplatzTest.php @@ -130,6 +130,26 @@ public function test_media_redaktion_return_keeps_the_open_version_text(): void $this->assertNull($film->thumbnail_alt); } + public function test_the_redaktion_state_lives_in_the_address_for_browser_back(): void + { + $content = app(ContentService::class); + $film = $content->createElement('film', 'film', 'Lara im Park'); + $content->publishElementVersion($film, 'Filmfassung'); + + Livewire::actingAs($this->editor(), 'staff') + ->withQueryParams(['redaktion' => '1']) + ->test(ViewContentElement::class, ['record' => $film->getKey()]) + ->assertSet('redaktionOpen', true) + ->assertSee('Zurück zur Medienbearbeitung') + ->set('teaser', 'Offen beim Zurückblättern') + ->set('redaktionOpen', false) + ->assertDontSee('Zurück zur Medienbearbeitung') + ->assertSee('Redaktion mit ungespeicherten Änderungen') + ->assertSet('teaser', 'Offen beim Zurückblättern'); + + $this->assertNull($film->fresh()->teaser); + } + public function test_website_release_does_not_save_open_redaktion_inputs(): void { $content = app(ContentService::class);