- 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>
57 lines
2.2 KiB
PHP
57 lines
2.2 KiB
PHP
<?php
|
||
|
||
namespace App\Console\Commands;
|
||
|
||
use App\Models\Page;
|
||
use App\Themes\ThemeFactory;
|
||
use App\Themes\ThemeRegistry;
|
||
use Illuminate\Console\Attributes\Description;
|
||
use Illuminate\Console\Attributes\Signature;
|
||
use Illuminate\Console\Command;
|
||
use Illuminate\Support\Facades\URL;
|
||
|
||
#[Signature('themes:preview {theme : Key des Themes} {--hours=24 : Gültigkeit der Links}')]
|
||
#[Description('Print signed preview links: every page of the site with the theme, in every appearance – without switching the site')]
|
||
class PreviewTheme extends Command
|
||
{
|
||
/**
|
||
* Execute the console command.
|
||
*/
|
||
public function handle(ThemeRegistry $registry, ThemeFactory $factory): int
|
||
{
|
||
$key = (string) $this->argument('theme');
|
||
if (! isset($registry->all()[$key])) {
|
||
$this->error("Theme „{$key}“ nicht gefunden. Installiert: ".implode(', ', array_keys($registry->all())));
|
||
|
||
return self::FAILURE;
|
||
}
|
||
|
||
$site = $factory->site();
|
||
$expires = now()->addHours((int) $this->option('hours'));
|
||
$pages = $site->exists ? $site->pages()->where('is_published', true)->orderBy('sort_order')->get() : collect();
|
||
$appearances = $site->exists ? $site->appearances()->orderByDesc('is_default')->orderBy('starts_md')->get() : collect();
|
||
|
||
$this->info("Vorschau „{$registry->get($key)->name}“ für {$site->name} (gültig bis {$expires->format('d.m.Y H:i')}):");
|
||
foreach ($pages as $page) {
|
||
$this->line('');
|
||
$this->line("<options=bold>{$page->title}</>");
|
||
$this->line(' heute: '.$this->url($page, ['theme' => $key], $expires));
|
||
foreach ($appearances as $appearance) {
|
||
$this->line(str_pad(" {$appearance->name}:", 16).$this->url($page, ['theme' => $key, 'vorschau' => $appearance->id], $expires));
|
||
}
|
||
}
|
||
|
||
return self::SUCCESS;
|
||
}
|
||
|
||
/**
|
||
* @param array<string, mixed> $parameters
|
||
*/
|
||
private function url(Page $page, array $parameters, \DateTimeInterface $expires): string
|
||
{
|
||
return $page->isHome()
|
||
? URL::temporarySignedRoute('home', $expires, $parameters)
|
||
: URL::temporarySignedRoute('page', $expires, ['slug' => $page->slug, ...$parameters]);
|
||
}
|
||
}
|