Offers by their own rules, seasonal photos per section, theme authoring tooling
- Special offers: kinds (rule, fixed dates, gap filler), package price, priority, highlight;
GapFinder detects calendar gaps (optionally waiving the minimum stay); OfferShowcase decides
what the website advertises and prices fixed dates/gaps with PriceCalculator; offers section
shows them side by side, as a list or rotating; hero can show the top offer. Appearances no
longer carry a featured offer.
- Sections get stable ids; appearances set photos per section ("Bilder je Baustein") and
sections can be limited to appearances. Photo pickers show thumbnails everywhere.
- Themes: themes:make (scaffold, never overwrites), themes:check (contract, build, markup,
colours, external resources, WCAG contrast), themes:preview (signed links per page and
appearance), signed ?theme= preview and preview action in the site form, inherited colour
tokens in the admin. Base CSS split into theme.css + reusable theme-base.css.
- docs/THEME-ERSTELLUNG.md: binding guide for building additional themes elsewhere.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
bc77b64ea7
commit
7d0bc93abc
50 files changed
+2805
-259
No files matched your search
@@ -6,6 +6,7 @@
|
||||
use App\Enums\UserRole;
|
||||
use App\Filament\Resources\Appearances\AppearanceResource;
|
||||
use App\Filament\Resources\Appearances\Pages\CreateAppearance;
|
||||
use App\Filament\Resources\Appearances\Pages\EditAppearance;
|
||||
use App\Filament\Resources\Pages\PageResource;
|
||||
use App\Filament\Resources\Pages\Pages\EditPage;
|
||||
use App\Filament\Resources\Sites\SiteResource;
|
||||
@@ -25,6 +26,8 @@
|
||||
use Database\Seeders\SiteSeeder;
|
||||
use Database\Seeders\WebsiteContentSeeder;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
use Livewire\Livewire;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
@@ -211,6 +214,70 @@ public function test_content_editor_manages_pages_and_appearances(): void
|
||||
$this->assertSame('Ostern', $this->site->appearanceOn(CarbonImmutable::parse('2027-04-01'))->name);
|
||||
}
|
||||
|
||||
public function test_placed_sections_get_stable_ids_and_copies_get_new_ones(): void
|
||||
{
|
||||
$page = $this->site->pages()->where('slug', 'start')->sole();
|
||||
$ids = array_map(fn (array $section): string => $section['data']['id'], $page->sections);
|
||||
|
||||
$this->assertCount(count($page->sections), array_unique($ids));
|
||||
|
||||
$page->update(['sections' => [...$page->sections, $page->sections[0]]]);
|
||||
|
||||
$this->assertSame($ids, array_slice(array_map(fn (array $section): string => $section['data']['id'], $page->fresh()->sections), 0, count($ids)));
|
||||
$this->assertNotSame($ids[0], last($page->fresh()->sections)['data']['id']);
|
||||
}
|
||||
|
||||
public function test_section_can_be_limited_to_an_appearance(): void
|
||||
{
|
||||
$christmas = $this->site->appearances()->where('name', 'Weihnachten')->sole();
|
||||
$page = $this->site->pages()->where('slug', 'start')->sole();
|
||||
$page->update(['sections' => [...$page->sections, ['type' => 'text_image', 'data' => ['heading' => 'Adventsmarkt am Hafen', 'appearances' => [(string) $christmas->id]]]]]);
|
||||
|
||||
$this->get('/')->assertOk()->assertDontSee('Adventsmarkt am Hafen');
|
||||
|
||||
$this->travelTo(CarbonImmutable::parse('2026-12-20 10:00'));
|
||||
$this->get('/')->assertOk()->assertSee('Adventsmarkt am Hafen');
|
||||
}
|
||||
|
||||
public function test_appearance_sets_seasonal_photos_per_section(): void
|
||||
{
|
||||
Storage::fake('public');
|
||||
$summerPhoto = Photo::factory()->create(['alt_text' => 'Strand im Sommer', 'sort_order' => 1]);
|
||||
$summerPhoto->addMedia(UploadedFile::fake()->image('sommer.jpg', 1600, 1000))->toMediaCollection(Photo::COLLECTION);
|
||||
$winterPhoto = Photo::factory()->create(['alt_text' => 'Raue See im Winter', 'sort_order' => 99]);
|
||||
$winterPhoto->addMedia(UploadedFile::fake()->image('winter.jpg', 1600, 1000))->toMediaCollection(Photo::COLLECTION);
|
||||
|
||||
$page = $this->site->pages()->where('slug', 'start')->sole();
|
||||
$cta = collect($page->sections)->firstWhere('type', 'cta');
|
||||
$winter = $this->site->appearances()->where('name', 'Winter')->sole();
|
||||
$winter->update(['section_photos' => [$cta['data']['id'] => ['photo_id' => $winterPhoto->id]]]);
|
||||
|
||||
$this->get('/')->assertOk()->assertDontSee('Raue See im Winter');
|
||||
|
||||
$this->travelTo(CarbonImmutable::parse('2026-11-15 10:00'));
|
||||
$this->get('/')->assertOk()->assertSee('Raue See im Winter');
|
||||
}
|
||||
|
||||
public function test_appearance_form_lists_the_sections_with_photos(): void
|
||||
{
|
||||
$this->actingAs(User::factory()->role(UserRole::Content)->create());
|
||||
$winter = $this->site->appearances()->where('name', 'Winter')->sole();
|
||||
$photo = Photo::factory()->create(['alt_text' => 'Strand im Schnee']);
|
||||
$cta = collect($this->site->pages()->where('slug', 'start')->sole()->sections)->firstWhere('type', 'cta');
|
||||
|
||||
$this->get(AppearanceResource::getUrl('edit', ['record' => $winter]))
|
||||
->assertOk()
|
||||
->assertSee('Bilder je Baustein')
|
||||
->assertSee('Abschluss');
|
||||
|
||||
Livewire::test(EditAppearance::class, ['record' => $winter->getRouteKey()])
|
||||
->set("data.section_photos.{$cta['data']['id']}.photo_id", $photo->id)
|
||||
->call('save')
|
||||
->assertHasNoFormErrors();
|
||||
|
||||
$this->assertSame($photo->id, (int) $winter->fresh()->section_photos[$cta['data']['id']]['photo_id']);
|
||||
}
|
||||
|
||||
public function test_invalid_day_is_rejected(): void
|
||||
{
|
||||
$this->actingAs(User::factory()->create());
|
||||
|
||||
Reference in new issue
Block a user