Führe Bausteine ohne Zwischenschritt und wähle CMS-Bilder im gemeinsamen Picker
- Bausteindialog: „Zum Seitenaufbau“ kehrt an die Stelle zurück, „Entwurf speichern“ übernimmt und speichert direkt; Fehler erscheinen wie beim Kopf. - Karten mit Fachobjekt: zentrale Angaben aus der Redaktion als Platzhalter, eigene Angaben als „Eigene Angabe für diese Karte“ markiert. - Bildfelder des CMS (Bausteine und Abschnittshintergrund) öffnen den gemeinsamen visuellen Picker statt einer eigenen Auswahlliste. Der allgemeine Teil des Pickers liegt im Trait ChoosesMedia (aus der Redaktion herausgelöst, nicht kopiert); ChoosesWebsiteImages übernimmt nur Website-Bilder in genau das auslösende Feld, auch im Bausteindialog. Keine Freigabe durch Auswahl. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5548106c31
commit
75596bdaec
14 files changed
+520
-188
No files matched your search
@@ -163,13 +163,36 @@ public function test_configuring_a_block_names_it_and_its_place_and_returns_to_t
|
||||
$component->assertSee('Konfigurieren')->mountAction($edit);
|
||||
$action = $component->instance()->getMountedAction();
|
||||
$this->assertSame('Überschrift und Einleitung konfigurieren · Abschnitt 1 · Platz 1 · 4 Einheiten', $action->getModalHeading());
|
||||
$this->assertSame('Zur Seite', $action->getModalSubmitActionLabel());
|
||||
$this->assertSame('Zum Seitenaufbau', $action->getModalSubmitActionLabel());
|
||||
$this->assertSame(['entwurfSpeichern'], array_values(array_map(fn ($footer) => $footer->getName(), $action->getExtraModalFooterActions())));
|
||||
$this->assertFalse($action->isModalClosedByEscaping());
|
||||
$this->assertFalse($action->isModalClosedByClickingAway());
|
||||
$this->assertFalse($action->hasModalCloseButton(), 'Ohne Schließen-Kreuz: Verlassen nur über „Zur Seite“ oder „Änderungen verwerfen“.');
|
||||
$this->assertStringContainsString('luf-baustein-dialog', (string) $action->getExtraModalWindowAttributeBag(), 'Eigener Scrollbereich, damit der Dialogfuß erreichbar bleibt.');
|
||||
}
|
||||
|
||||
public function test_saving_from_the_block_applies_it_and_saves_the_draft_without_an_extra_step(): void
|
||||
{
|
||||
$page = Page::query()->where('path', '/praevention')->firstOrFail();
|
||||
$before = $page->latestRevision->id;
|
||||
$component = Livewire::actingAs($this->editor(), 'staff')->test(EditPage::class, ['record' => $page->id]);
|
||||
$sectionKey = array_key_first($component->get('data.sections'));
|
||||
$slotKey = array_key_first($component->get("data.sections.$sectionKey.slots"));
|
||||
$widgetKey = array_key_first($component->get("data.sections.$sectionKey.slots.$slotKey.widget"));
|
||||
$data = $component->get("data.sections.$sectionKey.slots.$slotKey.widget.$widgetKey.data");
|
||||
$data['data']['heading'] = 'Direkt aus dem Baustein gespeichert';
|
||||
|
||||
$component->callAction(
|
||||
TestAction::make('edit')->schemaComponent("sections.$sectionKey.slots.$slotKey.widget")->arguments(['item' => $widgetKey, 'speichern' => true]),
|
||||
$data,
|
||||
)->assertHasNoErrors();
|
||||
|
||||
$revision = $page->fresh()->latestRevision;
|
||||
$this->assertNotSame($before, $revision->id, 'Eine neue Revision ist gespeichert.');
|
||||
$this->assertSame('Direkt aus dem Baustein gespeichert', $revision->sections[0]['slots'][0]['data']['heading']);
|
||||
$this->assertNotSame($revision->id, $page->fresh()->published_revision_id, 'Speichern veröffentlicht nicht.');
|
||||
}
|
||||
|
||||
public function test_a_design_error_from_the_page_layout_opens_the_failing_section(): void
|
||||
{
|
||||
$page = Page::query()->where('path', '/')->firstOrFail();
|
||||
|
||||
@@ -221,6 +221,54 @@ public function test_the_picker_lists_website_images_with_their_release_state():
|
||||
$this->assertStringContainsString(route('editorial.card', ['kind' => 'element', 'subject' => $released->id]), $options[$released->id]);
|
||||
}
|
||||
|
||||
public function test_a_block_image_is_chosen_through_the_shared_picker_and_saved_with_the_draft(): void
|
||||
{
|
||||
$medium = $this->releasedImage('Lara im Park', 'Lara sitzt auf einer Parkbank');
|
||||
$page = Page::query()->firstOrCreate(['path' => '/bild-picker']);
|
||||
app(PageService::class)->saveRevision($page, [
|
||||
['layout' => 'u4', 'style' => [], 'slots' => [['type' => 'hero', 'v' => 2, 'variant' => 'photo_split', 'data' => ['heading' => 'Einstieg']]]],
|
||||
], null, null, null);
|
||||
$editor = User::factory()->redakteur()->create();
|
||||
$editor->saveAppAuthenticationSecret('JBSWY3DPEHPK3PXP');
|
||||
|
||||
$component = Livewire::actingAs($editor, 'staff')->test(EditPage::class, ['record' => $page->id]);
|
||||
$sectionKey = array_key_first($component->get('data.sections'));
|
||||
$slotKey = array_key_first($component->get("data.sections.$sectionKey.slots"));
|
||||
$widgetKey = array_key_first($component->get("data.sections.$sectionKey.slots.$slotKey.widget"));
|
||||
$component->mountAction(TestAction::make('edit')->schemaComponent("sections.$sectionKey.slots.$slotKey.widget")->arguments(['item' => $widgetKey]))
|
||||
->call('openWebsiteImagePicker', 'mountedActions.0.data.refs.image')
|
||||
->assertSet('pickerOpen', true)
|
||||
->assertSet('pickerPurpose', 'website-bild')
|
||||
->assertSee('Bild aus dem Medienmanager')
|
||||
->assertSee('Lara im Park');
|
||||
|
||||
$target = collect($component->instance()->pickerResult()['items'])->firstWhere('element_id', $medium->id)['target'] ?? null;
|
||||
$this->assertNotNull($target, 'Das Bild erscheint im gemeinsamen Picker.');
|
||||
|
||||
$component->call('markPicker', $target, true)
|
||||
->call('confirmPicker')
|
||||
->assertSet('pickerOpen', false)
|
||||
->assertSet('mountedActions.0.data.refs.image', $medium->id)
|
||||
->callMountedAction()
|
||||
->call('save')
|
||||
->assertHasNoErrors();
|
||||
|
||||
$this->assertSame($medium->id, $page->fresh()->latestRevision->sections[0]['slots'][0]['refs']['image']);
|
||||
}
|
||||
|
||||
public function test_the_picker_rejects_paths_outside_the_form(): void
|
||||
{
|
||||
$page = Page::query()->firstOrCreate(['path' => '/bild-picker-pfad']);
|
||||
app(PageService::class)->saveRevision($page, [['layout' => 'u4', 'style' => [], 'slots' => [['type' => 'heading', 'v' => 1, 'data' => ['heading' => 'X']]]]], null, null, null);
|
||||
$editor = User::factory()->redakteur()->create();
|
||||
$editor->saveAppAuthenticationSecret('JBSWY3DPEHPK3PXP');
|
||||
|
||||
Livewire::actingAs($editor, 'staff')->test(EditPage::class, ['record' => $page->id])
|
||||
->call('openWebsiteImagePicker', 'register')
|
||||
->assertSet('pickerOpen', false)
|
||||
->assertSet('bildZiel', null);
|
||||
}
|
||||
|
||||
private function releasedImage(string $title, ?string $alt): ContentElement
|
||||
{
|
||||
$path = 'cms/'.Str::slug($title).'.jpg';
|
||||
|
||||
Reference in new issue
Block a user