Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5233b96c42 | ||
|
|
3cf3e822b8 | ||
|
|
6160e95d57 | ||
|
|
f0ffb47210 |
No files matched your search
@@ -120,6 +120,12 @@ public function resolve(mixed $id, bool $preview): array
|
||||
];
|
||||
}
|
||||
|
||||
/** Ein Film, der nicht archiviert, nicht gesperrt und keine Traineranleitung ist (auch für den Medienwähler). */
|
||||
public function isSelectable(ContentElement $element): bool
|
||||
{
|
||||
return $this->allowed($element);
|
||||
}
|
||||
|
||||
/** Ein Film, der nicht archiviert, nicht gesperrt und keine Traineranleitung ist. */
|
||||
private function allowed(ContentElement $element): bool
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
use App\Domain\Cms\Widgets\RenderContext;
|
||||
use App\Domain\Cms\Widgets\Support\HeadingAccent;
|
||||
use App\Domain\Cms\Widgets\Support\HeroVideo;
|
||||
use App\Domain\Cms\Widgets\Support\ImageRefFields;
|
||||
use App\Domain\Cms\Widgets\Support\PremiumFields;
|
||||
use App\Domain\Cms\Widgets\Support\PublicMedia;
|
||||
@@ -13,6 +14,7 @@
|
||||
use App\Domain\Cms\Widgets\WidgetType;
|
||||
use Filament\Forms\Components\RichEditor;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\ViewField;
|
||||
use Filament\Schemas\Components\Group;
|
||||
|
||||
/**
|
||||
@@ -20,6 +22,11 @@
|
||||
*
|
||||
* Version 1 (Bestand): data {image, alt, body} mit Klartext.
|
||||
* Version 2: data {title, body (formatierter Text), alt}, refs {image}, Varianten Bild links/rechts.
|
||||
* Ohne Versionssprung ergänzt (ältere Revisionen bleiben unverändert darstellbar): Bildanteil (settings.image_share),
|
||||
* Bild ohne Text (Text ist nicht mehr Pflicht, wenn ein Bild gewählt ist) und ein Video (refs.video, ein Film aus dem
|
||||
* Medienmanager): Das freigegebene Video (Trailer, Vorschauclip oder Website-Datei, Regel CardClip) spielt auf dem Bild
|
||||
* beim Überfahren mit der Maus stumm und per Klick oder Schaltfläche mit Ton, wie auf der Medienkarte.
|
||||
*
|
||||
* Version 3: zusätzlich Label, zwei Schaltflächen, Bildfokus in Prozent; Einstellungen Oberfläche, Höhe und
|
||||
* Überschriftenebene. Die Bildseite bleibt die Variante (keine doppelte Einstellung). Die Einstellung
|
||||
* format der Designiteration 1 entfällt; die Bildproportion folgt jetzt der Höhe.
|
||||
@@ -110,10 +117,25 @@ public function optionIcons(): array
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Bildanteil an der Breite im zweispaltigen Stand (ab 900 px Containerbreite): Bild- und Textspalte als Verhältnis.
|
||||
* Ohne Wert gilt die bisherige Verteilung (Text 1,1 : Bild 0,9, je nach Bildseite).
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
public const IMAGE_SHARE = [
|
||||
'third' => 'Schmales Bild (ein Drittel Bild, zwei Drittel Text)',
|
||||
'two_fifths' => 'Eher schmales Bild (40 % Bild, 60 % Text)',
|
||||
'half' => 'Gleich breit (je die Hälfte)',
|
||||
'three_fifths' => 'Eher breites Bild (60 % Bild, 40 % Text)',
|
||||
'two_thirds' => 'Breites Bild (zwei Drittel Bild, ein Drittel Text)',
|
||||
];
|
||||
|
||||
public function settings(): array
|
||||
{
|
||||
return [
|
||||
'surface' => ['cream' => 'Creme (Markenfläche)', 'clear' => 'Ohne eigene Fläche', 'navy' => 'Navy (dunkel)'],
|
||||
'image_share' => self::IMAGE_SHARE,
|
||||
'heading_level' => PremiumFields::HEADING_LEVELS,
|
||||
'symbol' => HeadingAccent::symbols(),
|
||||
'symbol_size' => HeadingAccent::SIZE,
|
||||
@@ -124,7 +146,7 @@ public function settings(): array
|
||||
public function settingGroups(): array
|
||||
{
|
||||
return [
|
||||
'Aussehen' => ['surface', 'symbol', 'symbol_size', 'symbol_align'],
|
||||
'Aussehen' => ['surface', 'image_share', 'symbol', 'symbol_size', 'symbol_align'],
|
||||
'Seitenstruktur' => ['heading_level'],
|
||||
];
|
||||
}
|
||||
@@ -133,6 +155,7 @@ public function settingLabels(): array
|
||||
{
|
||||
return [
|
||||
'surface' => ['Hintergrund des Widgets', 'Unabhängig vom Abschnittshintergrund. „Ohne eigene Fläche“ übernimmt den Abschnitt.'],
|
||||
'image_share' => ['Bildanteil', 'Verhältnis von Bild und Text nebeneinander. Gilt erst ab 900 px Breite des Widgets; schmaler steht das Bild über dem Text. Ohne Auswahl bleibt es bei der bisherigen Verteilung (Text etwas breiter als das Bild). Ohne Text füllt das Bild die ganze Breite.'],
|
||||
'symbol' => HeadingAccent::SYMBOL_LABEL,
|
||||
'symbol_size' => HeadingAccent::SIZE_LABEL,
|
||||
'symbol_align' => HeadingAccent::ALIGN_LABEL,
|
||||
@@ -180,13 +203,14 @@ public function dataRules(): array
|
||||
{
|
||||
return [
|
||||
'title' => ['nullable', 'string', 'max:160'],
|
||||
'body' => ['required', 'string', 'max:40000'],
|
||||
// Der Text ist nur Pflicht, solange kein Bild gewählt ist (clean); ein Bild darf allein stehen.
|
||||
'body' => ['nullable', 'string', 'max:40000'],
|
||||
] + PremiumFields::rules();
|
||||
}
|
||||
|
||||
public function refRules(): array
|
||||
{
|
||||
return ImageRefFields::rules();
|
||||
return ImageRefFields::rules() + ['video' => ['nullable']];
|
||||
}
|
||||
|
||||
public function dataFields(): array
|
||||
@@ -196,7 +220,7 @@ public function dataFields(): array
|
||||
TextInput::make('title')->label('Überschrift')->maxLength(160)->live(onBlur: true),
|
||||
RichEditor::make('body')
|
||||
->label('Text')
|
||||
->required()
|
||||
->helperText('Leer lassen, wenn nur das Bild gezeigt werden soll. Ohne Text, Überschrift, Label und Schaltflächen füllt das Bild die ganze Breite.')
|
||||
->live(onBlur: true)
|
||||
->toolbarButtons(RichText::TOOLBAR),
|
||||
PremiumFields::ctaFields(),
|
||||
@@ -207,7 +231,16 @@ public function dataFields(): array
|
||||
|
||||
public function refFields(): array
|
||||
{
|
||||
return ImageRefFields::fields(live: true);
|
||||
return [...ImageRefFields::fields(live: true), $this->videoField()];
|
||||
}
|
||||
|
||||
private function videoField(): ViewField
|
||||
{
|
||||
return ViewField::make('video')
|
||||
->live()
|
||||
->label('Video (optional)')
|
||||
->view('filament.cms.video-feld')
|
||||
->helperText('Ein Film aus dem Medienmanager, über denselben Wähler wie das Bild. Das Bild bleibt stehen; das Video spielt darauf beim Überfahren stumm und per Klick oder Schaltfläche mit Ton, nur wenn ein Trailer, Vorschauclip oder die Website-Datei des Films für die Website freigegeben ist. Die Auswahl gibt nichts frei.');
|
||||
}
|
||||
|
||||
public function editorSchema(): array
|
||||
@@ -234,13 +267,47 @@ public function clean(array $data, array $refs, WidgetErrors $errors): array
|
||||
$data['title'] = filled($data['title'] ?? null) ? trim((string) $data['title']) : null;
|
||||
$data = PremiumFields::clean($data, $errors, $refs['image'] !== null);
|
||||
|
||||
if (RichText::isBlank($data['body'])) {
|
||||
$errors->add('data.body', 'Bitte einen Text eingeben.');
|
||||
$video = app(HeroVideo::class)->clean($refs['video'] ?? null, $errors);
|
||||
$video === null ? $refs = array_diff_key($refs, ['video' => true]) : $refs['video'] = $video;
|
||||
|
||||
if ($video !== null && $refs['image'] === null) {
|
||||
$errors->add('refs.image', 'Bitte auch ein Bild wählen: Es steht, bis das Video startet.');
|
||||
}
|
||||
|
||||
if ($refs['image'] === null && ! self::hasCopy($data)) {
|
||||
$errors->add('data.body', 'Bitte einen Text eingeben oder ein Bild wählen.');
|
||||
}
|
||||
|
||||
return [$data, $refs];
|
||||
}
|
||||
|
||||
/**
|
||||
* Ob neben dem Bild etwas zu lesen ist: Text, Überschrift, Label oder Schaltfläche. Ohne bleibt das Bild allein.
|
||||
*
|
||||
* @param array<string, mixed> $data
|
||||
*/
|
||||
public static function hasCopy(array $data): bool
|
||||
{
|
||||
$body = is_string($data['body'] ?? null) ? RichText::sanitize($data['body']) : '';
|
||||
|
||||
return ! RichText::isBlank($body)
|
||||
|| filled($data['title'] ?? null)
|
||||
|| filled($data['eyebrow'] ?? null)
|
||||
|| PremiumFields::actions($data) !== [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gültiger Bildanteil oder null (bisherige Verteilung).
|
||||
*
|
||||
* @param array<string, mixed> $settings
|
||||
*/
|
||||
public static function imageShare(array $settings): ?string
|
||||
{
|
||||
$share = $settings['image_share'] ?? null;
|
||||
|
||||
return is_string($share) && array_key_exists($share, self::IMAGE_SHARE) ? $share : null;
|
||||
}
|
||||
|
||||
public function resolve(array $widget, RenderContext $context): array
|
||||
{
|
||||
$surface = $widget['settings']['surface'] ?? 'cream';
|
||||
@@ -248,10 +315,23 @@ public function resolve(array $widget, RenderContext $context): array
|
||||
$images = app(WebsiteImage::class);
|
||||
$image = $widget['refs']['image'] ?? null;
|
||||
|
||||
$imageUrl = $images->url($image, $context->preview);
|
||||
$imageAlt = $images->alt($image, $widget['data']['alt'] ?? null);
|
||||
$hasCopy = self::hasCopy($widget['data'] ?? []);
|
||||
$video = app(HeroVideo::class)->resolve($widget['refs']['video'] ?? null, $context->preview);
|
||||
|
||||
// Ohne Bild gibt es nichts, worauf das Video stehen könnte; die Redaktion erfährt es in der Vorschau.
|
||||
if ($imageUrl === null && $video['url'] !== null) {
|
||||
$video = ['url' => null, 'title' => $video['title'], 'notice' => $context->preview ? 'Das Video braucht ein Bild: Es steht, bis das Video startet. Bitte ein Bild wählen.' : null];
|
||||
}
|
||||
|
||||
return [
|
||||
'imageUrl' => $images->url($image, $context->preview),
|
||||
'imageAlt' => $images->alt($image, $widget['data']['alt'] ?? null),
|
||||
'imageUrl' => $imageUrl,
|
||||
'imageAlt' => $imageAlt,
|
||||
'imageNotice' => $context->preview ? $images->previewNotice($image) : null,
|
||||
'video' => $video,
|
||||
'hasCopy' => $hasCopy,
|
||||
'imageShare' => self::imageShare($widget['settings'] ?? []),
|
||||
'body' => RichText::sanitize(is_string($widget['data']['body'] ?? null) ? $widget['data']['body'] : ''),
|
||||
'actions' => PremiumFields::actions($widget['data']),
|
||||
'focus' => PremiumFields::focus($widget['data'], 64, 43),
|
||||
@@ -270,6 +350,16 @@ public function summary(array $widget): string
|
||||
{
|
||||
$title = $widget['data']['title'] ?? null;
|
||||
|
||||
return filled($title) ? (string) $title : RichText::excerpt($widget['data']['body'] ?? '');
|
||||
if (filled($title)) {
|
||||
return (string) $title;
|
||||
}
|
||||
|
||||
$excerpt = RichText::excerpt($widget['data']['body'] ?? '');
|
||||
|
||||
if ($excerpt !== '') {
|
||||
return $excerpt;
|
||||
}
|
||||
|
||||
return filled($widget['data']['alt'] ?? null) ? 'Bild: '.$widget['data']['alt'] : 'Bild';
|
||||
}
|
||||
}
|
||||
@@ -79,6 +79,7 @@ public function variants(): array
|
||||
{
|
||||
return [
|
||||
'kacheln' => 'Kacheln mit Bild',
|
||||
'liste' => 'Liste mit kleinem Bild',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -88,6 +89,7 @@ public function settings(): array
|
||||
'sort' => ['name' => 'Alphabetisch', 'neu' => 'Neueste zuerst', 'preis' => 'Preis aufsteigend'],
|
||||
'limit' => ['alle' => 'Alle Produkte', 'n3' => '3 Produkte', 'n6' => '6 Produkte', 'n9' => '9 Produkte', 'n12' => '12 Produkte', 'n24' => '24 Produkte'],
|
||||
'search' => ['aus' => 'Ohne Suchfeld', 'an' => 'Mit Suchfeld'],
|
||||
'filter' => ['aus' => 'Ohne Auswahl', 'an' => 'Mit Suche, Auswahl, Ansicht und Seiten'],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -96,13 +98,14 @@ public function settingLabels(): array
|
||||
return [
|
||||
'sort' => ['Reihenfolge', 'Ohne Wahl gilt die Reihenfolge der Shopseite: Altbestand, Artikel, Pakete.'],
|
||||
'limit' => ['Anzahl', 'Wie viele Produkte höchstens erscheinen. Ohne Wahl erscheinen alle.'],
|
||||
'search' => ['Suchfeld', 'Ein Suchfeld über den Kacheln. Es wirkt auf der Shopseite; auf anderen Seiten führt die Suche in den Shop.'],
|
||||
'search' => ['Suchfeld', 'Ein einfaches Suchfeld über den Kacheln. Es sendet an die Seite, auf der das Widget steht.'],
|
||||
'filter' => ['Auswahl für Besucher', 'Suche, Auswahl nach Thema, Materialart, Eignung und Nutzerkreis, Reihenfolge, Umschalter Kacheln und Liste und Seiten. Sinnvoll auf der Shopseite mit vielen Produkten. Ersetzt das einfache Suchfeld und die Einstellung „Anzahl“.'],
|
||||
];
|
||||
}
|
||||
|
||||
public function settingGroups(): array
|
||||
{
|
||||
return ['Auswahl' => ['sort', 'limit', 'search']];
|
||||
return ['Auswahl' => ['sort', 'limit', 'search', 'filter']];
|
||||
}
|
||||
|
||||
public function dataRules(): array
|
||||
@@ -165,21 +168,28 @@ public function clean(array $data, array $refs, WidgetErrors $errors): array
|
||||
public function resolve(array $widget, RenderContext $context): array
|
||||
{
|
||||
if (! Shop::visible()) {
|
||||
return ['cards' => [], 'term' => '', 'shopVisible' => false];
|
||||
return ['listing' => null, 'cards' => [], 'term' => '', 'shopVisible' => false];
|
||||
}
|
||||
|
||||
$settings = is_array($widget['settings'] ?? null) ? $widget['settings'] : [];
|
||||
$filters = ($settings['filter'] ?? 'aus') === 'an';
|
||||
$search = ($settings['search'] ?? 'aus') === 'an';
|
||||
$term = $search && ! $context->preview ? trim((string) request()->query('suche', '')) : '';
|
||||
$limit = preg_match('/^n(\d+)$/', (string) ($settings['limit'] ?? ''), $match) === 1 ? (int) $match[1] : null;
|
||||
$limit = preg_match('/^n(\\d+)$/', (string) ($settings['limit'] ?? ''), $match) === 1 ? (int) $match[1] : null;
|
||||
$query = $context->preview ? [] : request()->query();
|
||||
$term = ($search || $filters) && isset($query['suche']) && is_string($query['suche']) ? mb_substr(trim($query['suche']), 0, 100) : '';
|
||||
$fixed = [
|
||||
'pillar' => $widget['data']['pillar'] ?? null,
|
||||
'kind' => $widget['data']['kind'] ?? null,
|
||||
'sort' => $settings['sort'] ?? null,
|
||||
'limit' => $filters ? null : $limit,
|
||||
'view' => ($widget['variant'] ?? 'kacheln') === 'liste' ? 'liste' : 'kacheln',
|
||||
'filters' => $filters,
|
||||
];
|
||||
$listing = app(ShopCatalog::class)->listing($filters ? $query : ['suche' => $term], $fixed);
|
||||
|
||||
return [
|
||||
'cards' => app(ShopCatalog::class)->cards($term, [
|
||||
'pillar' => $widget['data']['pillar'] ?? null,
|
||||
'kind' => $widget['data']['kind'] ?? null,
|
||||
'sort' => $settings['sort'] ?? null,
|
||||
'limit' => $limit,
|
||||
]),
|
||||
'listing' => $listing,
|
||||
'cards' => $listing['cards'],
|
||||
'term' => $term,
|
||||
'shopVisible' => true,
|
||||
];
|
||||
|
||||
@@ -210,7 +210,7 @@ private function optionsFor(string $key): array
|
||||
/**
|
||||
* Günstigster Preis und Zahl der Optionen je Seite einer Art ('a', 'b' oder 'c'): Kennung => Zusammenfassung.
|
||||
*
|
||||
* @return array<int, array{from_cents: int, count: int}>
|
||||
* @return array<int, array{from_cents: int, count: int, holders: list<string>, scopes: list<string>}>
|
||||
*/
|
||||
private function summariesOf(string $kind): array
|
||||
{
|
||||
@@ -224,6 +224,8 @@ private function summariesOf(string $kind): array
|
||||
$summary[(int) substr($key, 2)] = [
|
||||
'from_cents' => min(array_map(fn (array $row): int => (int) $row['version']->price_cents, $rows)),
|
||||
'count' => count($rows),
|
||||
'holders' => array_values(array_unique(array_map(fn (array $row): string => (string) $row['version']->holder_kind, $rows))),
|
||||
'scopes' => array_values(array_unique(array_filter(array_map(fn (array $row): ?string => $row['version']->licence_scope, $rows)))),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -233,7 +235,7 @@ private function summariesOf(string $kind): array
|
||||
/**
|
||||
* Artikel mit kaufbarer Option: Artikelkennung => günstigster Preis und Zahl der Optionen.
|
||||
*
|
||||
* @return array<int, array{from_cents: int, count: int}>
|
||||
* @return array<int, array{from_cents: int, count: int, holders: list<string>, scopes: list<string>}>
|
||||
*/
|
||||
public function articleSummaries(): array
|
||||
{
|
||||
@@ -243,7 +245,7 @@ public function articleSummaries(): array
|
||||
/**
|
||||
* Pakete mit kaufbarer Option: Paketkennung => günstigster Preis und Zahl der Optionen.
|
||||
*
|
||||
* @return array<int, array{from_cents: int, count: int}>
|
||||
* @return array<int, array{from_cents: int, count: int, holders: list<string>, scopes: list<string>}>
|
||||
*/
|
||||
public function bundleSummaries(): array
|
||||
{
|
||||
@@ -253,7 +255,7 @@ public function bundleSummaries(): array
|
||||
/**
|
||||
* Altbestand: Programmseiten mit kaufbaren Optionen (Angebote mit mehreren Positionen).
|
||||
*
|
||||
* @return array<int, array{from_cents: int, count: int}>
|
||||
* @return array<int, array{from_cents: int, count: int, holders: list<string>, scopes: list<string>}>
|
||||
*/
|
||||
public function summaries(): array
|
||||
{
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
use App\Domain\Catalog\Composition;
|
||||
use App\Domain\Catalog\EditorialProfileReader;
|
||||
use App\Domain\Catalog\FormattedText;
|
||||
use App\Domain\Catalog\LicenceScope;
|
||||
use App\Domain\Catalog\LicenseArticle;
|
||||
use App\Domain\Catalog\Pillar;
|
||||
use App\Domain\Catalog\PresentationMedia;
|
||||
@@ -37,11 +38,21 @@ public function __construct(
|
||||
public const SORTS = ['name' => 'Alphabetisch', 'neu' => 'Neueste zuerst', 'preis' => 'Preis aufsteigend'];
|
||||
|
||||
/**
|
||||
* @param array{pillar?: int|null, kind?: int|null, sort?: string|null, limit?: int|null} $options Filter nach Säule
|
||||
* und Materialart, Sortierung (name, neu, preis) und Höchstzahl
|
||||
* @param array{pillar?: int|null, kind?: int|null, holder?: string|null, scope?: string|null, sort?: string|null, limit?: int|null} $options Filter
|
||||
* nach Säule, Materialart, Eignung und Nutzerkreis, Sortierung (name, neu, preis) und Höchstzahl
|
||||
* @return list<array<string, mixed>>
|
||||
*/
|
||||
public function cards(string $term = '', array $options = []): array
|
||||
{
|
||||
return $this->arrange($this->all($term), $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Alle Kacheln zu einem Suchbegriff, ungefiltert und in der Reihenfolge der Quellen.
|
||||
*
|
||||
* @return list<array<string, mixed>>
|
||||
*/
|
||||
public function all(string $term = ''): array
|
||||
{
|
||||
$term = mb_strtolower(mb_substr(trim($term), 0, 100));
|
||||
$cards = [];
|
||||
@@ -56,10 +67,13 @@ public function cards(string $term = '', array $options = []): array
|
||||
|
||||
$title = (string) ($composition->display_title ?: $composition->designation);
|
||||
$teaser = (string) ($composition->teaser ?: FormattedText::plain($composition->summary));
|
||||
$pillars = $this->pillarNames($composition->pillars);
|
||||
$pillarMap = $this->publishedPillars($composition->pillars);
|
||||
$pillars = array_values($pillarMap);
|
||||
$card = $this->card('c:'.$composition->id, 'programm', route('public.program', $composition), $title, $teaser, $summaries[$composition->id], 'Programm', null, $pillars, [], $this->image($composition));
|
||||
$card['pillar_ids'] = $composition->pillars->pluck('id')->map(fn ($id): int => (int) $id)->all();
|
||||
$card['pillar_ids'] = array_keys($pillarMap);
|
||||
$card['kind_id'] = $composition->editorial_content_kind_id !== null ? (int) $composition->editorial_content_kind_id : null;
|
||||
$card['holders'] = $summaries[$composition->id]['holders'] ?? [];
|
||||
$card['scopes'] = $summaries[$composition->id]['scopes'] ?? [];
|
||||
|
||||
if ($this->matches($term, $title.' '.$teaser.' '.FormattedText::plain($composition->summary).' '.$composition->search_terms.' '.implode(' ', $pillars))) {
|
||||
$cards[] = $card;
|
||||
@@ -74,15 +88,18 @@ public function cards(string $term = '', array $options = []): array
|
||||
$title = $this->products->articleTitle($article);
|
||||
$teaser = (string) ($profile->value('teaser') ?: $profile->value('summary'));
|
||||
$kind = $article->editorialContentKind;
|
||||
$pillars = $this->pillarNames($article->pillars);
|
||||
$pillarMap = $this->publishedPillars($article->pillars);
|
||||
$pillars = array_values($pillarMap);
|
||||
$offerIds = array_map(fn ($offer): int => (int) $offer->id, $this->products->offersOfArticle($article));
|
||||
$card = $this->card(
|
||||
'a:'.$article->id, 'artikel', route('shop.article', $article), $title, $teaser, $articleSummaries[$article->id],
|
||||
(string) ($kind?->label ?? ''), $this->symbol($kind?->symbol), $pillars, $this->markers->visible($article, $offerIds), $this->image($article),
|
||||
);
|
||||
$card['pillar_ids'] = $article->pillars->pluck('id')->map(fn ($id): int => (int) $id)->all();
|
||||
$card['pillar_ids'] = array_keys($pillarMap);
|
||||
$card['kind_id'] = $kind !== null ? (int) $kind->id : null;
|
||||
$card['since'] = $this->markers->firstOffered($offerIds)?->getTimestamp() ?? 0;
|
||||
$card['holders'] = $articleSummaries[$article->id]['holders'] ?? [];
|
||||
$card['scopes'] = $articleSummaries[$article->id]['scopes'] ?? [];
|
||||
|
||||
if ($this->matches($term, $title.' '.$teaser.' '.$profile->value('summary').' '.$profile->searchTerms.' '.($kind?->label ?? '').' '.implode(' ', $pillars))) {
|
||||
$cards[] = $card;
|
||||
@@ -97,13 +114,15 @@ public function cards(string $term = '', array $options = []): array
|
||||
$names = implode(', ', array_column($contents, 'title'));
|
||||
$teaser = 'Paket mit '.count($contents).' '.(count($contents) === 1 ? 'Inhalt' : 'Inhalten').($names !== '' ? ': '.$names : '');
|
||||
$card = $this->card('b:'.$bundle->id, 'paket', route('public.package', $bundle), (string) $bundle->name, $teaser, $bundleSummaries[$bundle->id], 'Paket', null, [], [], $this->image($bundle));
|
||||
$card['holders'] = $bundleSummaries[$bundle->id]['holders'] ?? [];
|
||||
$card['scopes'] = $bundleSummaries[$bundle->id]['scopes'] ?? [];
|
||||
|
||||
if ($this->matches($term, $bundle->name.' '.$names)) {
|
||||
$cards[] = $card;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->arrange($cards, $options);
|
||||
return $cards;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,7 +133,7 @@ public function cards(string $term = '', array $options = []): array
|
||||
* @param array<string, mixed> $options
|
||||
* @return list<array<string, mixed>>
|
||||
*/
|
||||
private function arrange(array $cards, array $options): array
|
||||
public function arrange(array $cards, array $options): array
|
||||
{
|
||||
$pillar = isset($options['pillar']) ? (int) $options['pillar'] : 0;
|
||||
$kind = isset($options['kind']) ? (int) $options['kind'] : 0;
|
||||
@@ -127,6 +146,17 @@ private function arrange(array $cards, array $options): array
|
||||
$cards = array_filter($cards, fn (array $card): bool => ($card['kind_id'] ?? null) === $kind);
|
||||
}
|
||||
|
||||
$holder = (string) ($options['holder'] ?? '');
|
||||
$scope = (string) ($options['scope'] ?? '');
|
||||
|
||||
if ($holder !== '') {
|
||||
$cards = array_filter($cards, fn (array $card): bool => in_array($holder, $card['holders'] ?? [], true));
|
||||
}
|
||||
|
||||
if ($scope !== '') {
|
||||
$cards = array_filter($cards, fn (array $card): bool => in_array($scope, $card['scopes'] ?? [], true));
|
||||
}
|
||||
|
||||
$cards = array_values($cards);
|
||||
|
||||
match ($options['sort'] ?? null) {
|
||||
@@ -141,6 +171,103 @@ private function arrange(array $cards, array $options): array
|
||||
return $limit > 0 ? array_slice($cards, 0, $limit) : $cards;
|
||||
}
|
||||
|
||||
public const HOLDERS = ['person' => 'Privatpersonen', 'organisation' => 'Organisationen und Vereine'];
|
||||
|
||||
public const SCOPES = [LicenceScope::SINGLE => 'Einzellizenz', LicenceScope::MULTI => 'Mehrfachlizenz'];
|
||||
|
||||
/**
|
||||
* Die Auswahl, die ein Besucher bei diesen Kacheln hat: nur Werte, die es gibt, und nur Auswahlfelder mit mindestens
|
||||
* zwei Werten (sonst filtert nichts).
|
||||
*
|
||||
* @param list<array<string, mixed>> $cards
|
||||
* @return array{pillar: array<int, string>, kind: array<int, string>, holder: array<string, string>, scope: array<string, string>}
|
||||
*/
|
||||
public function facets(array $cards): array
|
||||
{
|
||||
$pillars = [];
|
||||
$kinds = [];
|
||||
$holders = [];
|
||||
$scopes = [];
|
||||
|
||||
foreach ($cards as $card) {
|
||||
foreach (array_values($card['pillar_ids'] ?? []) as $index => $id) {
|
||||
$pillars[(int) $id] = (string) ($card['pillars'][$index] ?? '');
|
||||
}
|
||||
|
||||
if (($card['kind_id'] ?? null) !== null && ($card['kind_label'] ?? '') !== '') {
|
||||
$kinds[(int) $card['kind_id']] = (string) $card['kind_label'];
|
||||
}
|
||||
|
||||
foreach ($card['holders'] ?? [] as $holder) {
|
||||
if (isset(self::HOLDERS[$holder])) {
|
||||
$holders[$holder] = self::HOLDERS[$holder];
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($card['scopes'] ?? [] as $scope) {
|
||||
if (isset(self::SCOPES[$scope])) {
|
||||
$scopes[$scope] = self::SCOPES[$scope];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
asort($pillars);
|
||||
asort($kinds);
|
||||
|
||||
$facets = ['pillar' => $pillars, 'kind' => $kinds, 'holder' => $holders, 'scope' => $scopes];
|
||||
|
||||
return array_map(fn (array $values): array => count($values) >= 2 ? $values : [], $facets);
|
||||
}
|
||||
|
||||
/**
|
||||
* Die Produktliste für Shopseite und Widget: Suche, Auswahl des Besuchers (Säule, Materialart, Eignung,
|
||||
* Nutzerkreis), Reihenfolge, Ansicht und Seiten. Alles kommt aus dem Abfragetext und wird gegen feste Werte
|
||||
* geprüft; unbekannte Werte entfallen.
|
||||
*
|
||||
* @param array<string, mixed> $query Abfrage des Besuchers (suche, saeule, art, eignung, kreis, sort, ansicht, seite)
|
||||
* @param array<string, mixed> $fixed Vorgaben der Seite (pillar, kind, sort, limit, view, filters)
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function listing(array $query, array $fixed = []): array
|
||||
{
|
||||
$text = fn (string $key): string => isset($query[$key]) && (is_string($query[$key]) || is_int($query[$key])) ? trim((string) $query[$key]) : '';
|
||||
$filters = (bool) ($fixed['filters'] ?? true);
|
||||
$term = mb_substr($text('suche'), 0, 100);
|
||||
$base = $this->arrange($this->all($term), array_intersect_key($fixed, ['pillar' => 1, 'kind' => 1]));
|
||||
$facets = $filters ? $this->facets($base) : ['pillar' => [], 'kind' => [], 'holder' => [], 'scope' => []];
|
||||
$pick = function (string $key, string $facet) use ($text, $facets, $filters): int|string|null {
|
||||
$value = $text($key);
|
||||
|
||||
return $filters && $value !== '' && array_key_exists($value, $facets[$facet]) ? (ctype_digit($value) ? (int) $value : $value) : null;
|
||||
};
|
||||
$chosen = [
|
||||
'pillar' => $pick('saeule', 'pillar'),
|
||||
'kind' => $pick('art', 'kind'),
|
||||
'holder' => $pick('eignung', 'holder'),
|
||||
'scope' => $pick('kreis', 'scope'),
|
||||
];
|
||||
$sort = $filters && isset(self::SORTS[$text('sort')]) ? $text('sort') : ($fixed['sort'] ?? null);
|
||||
$view = $filters && in_array($text('ansicht'), ['kacheln', 'liste'], true) ? $text('ansicht') : (string) ($fixed['view'] ?? 'kacheln');
|
||||
$cards = $this->arrange($base, $chosen + ['sort' => $sort, 'limit' => $fixed['limit'] ?? null]);
|
||||
$perPage = max(1, (int) config('shop.per_page', 12));
|
||||
$pages = max(1, (int) ceil(count($cards) / $perPage));
|
||||
$page = $filters ? min($pages, max(1, (int) $text('seite'))) : 1;
|
||||
$shown = $filters ? array_slice($cards, ($page - 1) * $perPage, $perPage) : $cards;
|
||||
|
||||
return [
|
||||
'cards' => $shown,
|
||||
'total' => count($cards),
|
||||
'page' => $page,
|
||||
'pages' => $filters ? $pages : 1,
|
||||
'facets' => $facets,
|
||||
'chosen' => $chosen,
|
||||
'sort' => $sort,
|
||||
'view' => $view,
|
||||
'term' => $term,
|
||||
'filters' => $filters,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array{from_cents: int, count: int} $summary
|
||||
* @param list<string> $pillars
|
||||
@@ -167,6 +294,8 @@ private function card(string $key, string $kind, string $url, string $title, str
|
||||
'pillar_ids' => [],
|
||||
'kind_id' => null,
|
||||
'since' => 0,
|
||||
'holders' => [],
|
||||
'scopes' => [],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -179,11 +308,11 @@ private function matches(string $term, string $haystack): bool
|
||||
* Nur veröffentlichte Säulen sind öffentlich (Säulenverwaltung).
|
||||
*
|
||||
* @param Collection<int, Pillar> $pillars
|
||||
* @return list<string>
|
||||
* @return array<int, string> Kennung => Name
|
||||
*/
|
||||
private function pillarNames(Collection $pillars): array
|
||||
private function publishedPillars(Collection $pillars): array
|
||||
{
|
||||
return $pillars->filter(fn (Pillar $pillar): bool => $pillar->published_at !== null)->map(fn (Pillar $pillar): string => (string) $pillar->name)->values()->all();
|
||||
return $pillars->filter(fn (Pillar $pillar): bool => $pillar->published_at !== null)->mapWithKeys(fn (Pillar $pillar): array => [(int) $pillar->id => (string) $pillar->name])->all();
|
||||
}
|
||||
|
||||
/** Ein Symbol zeigt nur, was die Symbolbibliothek kennt (die Auswahl wird an der Materialart geprüft, hier noch einmal). */
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
use App\Domain\Catalog\EditorialVocabulary;
|
||||
use App\Domain\Catalog\Pillar;
|
||||
use App\Domain\Cms\Catalog\PublicMaterialReader;
|
||||
use App\Domain\Cms\Widgets\Support\HeroVideo;
|
||||
use App\Domain\Cms\Widgets\Support\WebsiteImage;
|
||||
use App\Http\Controllers\ContentPreviewController;
|
||||
|
||||
@@ -127,6 +128,18 @@ public function pickerResult(): array
|
||||
$result = app(EditorialCatalog::class)->presentationBrowse($this->pickerQuery, $this->pickerKind);
|
||||
$result = $this->filterByMaterialart($result);
|
||||
|
||||
// CMS: nur Filme, die als Video wählbar sind (nicht archiviert, nicht gesperrt, keine Traineranleitung).
|
||||
if ($this->pickerPurpose === 'website-video') {
|
||||
$ids = array_values(array_filter(array_map(fn (array $item): int => (int) ($item['element_id'] ?? 0), $result['items'])));
|
||||
$elements = ContentElement::query()->with('editorialContentKind')->whereKey($ids)->get()->keyBy('id');
|
||||
$videos = app(HeroVideo::class);
|
||||
$result['items'] = array_values(array_filter($result['items'], function (array $item) use ($elements, $videos): bool {
|
||||
$element = $elements->get((int) ($item['element_id'] ?? 0));
|
||||
|
||||
return $element !== null && $videos->isSelectable($element);
|
||||
}));
|
||||
}
|
||||
|
||||
// CMS: nur Bilder, die als Website-Bild wählbar sind (keine vertraulichen Arten, nicht archiviert).
|
||||
if ($this->pickerPurpose === 'website-bild') {
|
||||
$ids = array_values(array_filter(array_map(fn (array $item): int => (int) ($item['element_id'] ?? 0), $result['items'])));
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
use App\Domain\Catalog\Composition;
|
||||
use App\Domain\Catalog\ContentElement;
|
||||
use App\Domain\Catalog\DomainRuleException;
|
||||
use App\Domain\Cms\Widgets\Support\HeroVideo;
|
||||
use App\Domain\Cms\Widgets\Support\WebsiteImage;
|
||||
use App\Domain\Media\CompositionStill;
|
||||
use App\Domain\Media\FilmStill;
|
||||
@@ -37,6 +38,22 @@ public function openWebsiteImagePicker(string $pfad): void
|
||||
$this->forceRenderForPicker();
|
||||
}
|
||||
|
||||
/**
|
||||
* Bild und Text: ein Film aus dem Medienmanager als Video wählen. Gleicher Wähler wie beim Bild, nur mit Filmen; das
|
||||
* Ziel ist ausschließlich ein Videofeld (…video). Die Auswahl gibt nichts frei.
|
||||
*/
|
||||
public function openWebsiteVideoPicker(string $pfad): void
|
||||
{
|
||||
if (preg_match('/^(data|mountedActions\.\d+\.data)(\.[A-Za-z0-9_-]+)+\.video$/', $pfad) !== 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->resetPicker('website-video');
|
||||
$this->pickerKind = 'film';
|
||||
$this->bildZiel = $pfad;
|
||||
$this->forceRenderForPicker();
|
||||
}
|
||||
|
||||
/**
|
||||
* Medien- und Materialkarte: das Vorschaubild des Films als Bild für die Website übernehmen. Es entsteht ein Bild
|
||||
* im Medienmanager (einmal gespeichert), das im Bildfeld ausgewählt wird. Die Datei des Films bleibt geschützt.
|
||||
@@ -197,8 +214,10 @@ public function confirmPicker(): void
|
||||
$row = app(EditorialCatalog::class)->rowForTarget((string) $target, 0, allowDraft: true);
|
||||
$element = isset($row['element_id']) ? ContentElement::query()->find((int) $row['element_id']) : null;
|
||||
|
||||
if (! $element instanceof ContentElement || ! WebsiteImage::isSelectable($element)) {
|
||||
Notification::make()->danger()->title('Dieses Medium kann nicht als Website-Bild gewählt werden.')->send();
|
||||
$video = $this->pickerPurpose === 'website-video';
|
||||
|
||||
if ($video ? ! ($element instanceof ContentElement && app(HeroVideo::class)->isSelectable($element)) : ! ($element instanceof ContentElement && WebsiteImage::isSelectable($element))) {
|
||||
Notification::make()->danger()->title($video ? 'Dieser Film kann nicht als Video gewählt werden.' : 'Dieses Medium kann nicht als Website-Bild gewählt werden.')->send();
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -212,17 +231,17 @@ public function confirmPicker(): void
|
||||
*/
|
||||
public function pickerKinds(): array
|
||||
{
|
||||
return ['bild' => 'Bilder'];
|
||||
return $this->pickerPurpose === 'website-video' ? ['film' => 'Filme'] : ['bild' => 'Bilder'];
|
||||
}
|
||||
|
||||
public function pickerTitle(): string
|
||||
{
|
||||
return 'Bild aus dem Medienmanager';
|
||||
return $this->pickerPurpose === 'website-video' ? 'Video aus dem Medienmanager' : 'Bild aus dem Medienmanager';
|
||||
}
|
||||
|
||||
public function pickerConfirmLabel(): string
|
||||
{
|
||||
return 'Bild übernehmen';
|
||||
return $this->pickerPurpose === 'website-video' ? 'Video übernehmen' : 'Bild übernehmen';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -35,8 +35,6 @@ public function index(Request $request, ShopCatalog $catalog, PageController $pa
|
||||
return $pages->showPage($page);
|
||||
}
|
||||
|
||||
$term = trim((string) $request->query('suche', ''));
|
||||
|
||||
return view('shop.index', ['cards' => $catalog->cards($term), 'term' => $term]);
|
||||
return view('shop.index', ['listing' => $catalog->listing($request->query())]);
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,10 @@
|
||||
|
||||
'marker_days' => 30,
|
||||
|
||||
/* Produkte je Seite in der Shopliste (Kacheln und Liste). */
|
||||
|
||||
'per_page' => 12,
|
||||
|
||||
/*
|
||||
| Kauf auf Rechnung für Vereine und Organisationen (PAY-006): auf Anfrage, Rechnung manuell durch den Betreiber.
|
||||
| Standardmäßig aus: Das Mitglied sieht die Möglichkeit erst, wenn der Prozess vollständig ist (Rechnungserstellung
|
||||
|
||||
@@ -28,7 +28,7 @@ ## Phasen
|
||||
| 2 | Kachel und Datenquelle: ein Dienst für Liste und Widget, Titelbild über die Website-Freigabe, Säulen und Materialart als Gruppen, Symbol je Materialart, Marker | umgesetzt (ADR-54) |
|
||||
| 3 | CMS: Seite „shop“ mit Abschnitten, Widget „Shop-Produkte“, Kacheln auf der Mitgliederseite (ADR-55) | umgesetzt; „Für dich“ folgt mit Phase 4 |
|
||||
| 4 | Regelmodell für freie Artikel: für alle, besitzt einen Artikel, bestimmte Konten (Freigabe je Angebot und Konto, wie bei Rabattcodes), „Für dich“ | umgesetzt (ADR-56) |
|
||||
| 5 | Viele Produkte: Listenansicht, Filter, Sortierung, Seiten | offen |
|
||||
| 5 | Viele Produkte: Listenansicht, Filter, Sortierung, Seiten | umgesetzt (ADR-57) |
|
||||
|
||||
Jede Phase wird mit Tests, einer Sicherheitsdurchsicht und (bei Oberfläche) der Abnahme auf `luf-test` belegt (`docs/ux/verwaltung/abnahme/etappe-1.md`).
|
||||
|
||||
|
||||
@@ -837,3 +837,16 @@ ## ADR-56 – Regeln für freie Artikel und „Für dich“ im Mitgliederbereich
|
||||
**Nicht Teil dieses Schritts.** Keine Benachrichtigung per E-Mail bei einer Freigabe (das Konto sieht sie bei seinem nächsten Besuch); Gruppen und „Konto seit …“ als weitere Regeln; ein Ende des Abrufs je Angebot (dafür gibt es das Beenden der Fassung).
|
||||
**Folgen.** Eine additive Migration (zwei Spalten an `offers`, Tabelle `offer_releases`). **Bis zum Deployment gilt weiter die Regel „alle“** für jedes Angebot auf Abruf; die Vorgabe ändert kein bestehendes Verhalten. Wer ein Angebot auf Abruf nur bestimmten Konten geben will, stellt die Regel um, bevor er es aktiviert.
|
||||
**Quelle.** Anfrage von Lars vom 26.11.2026; ADR-09, ADR-47, ADR-52, ADR-55.
|
||||
|
||||
## ADR-57 – Shopliste für viele Produkte: Auswahl, Reihenfolge, Listenansicht und Seiten
|
||||
|
||||
**Status am 26.11.2026:** Umgesetzt auf `feature/shop-aufraeumen` (Phase 5 des Plans `docs/analysen/shop-umbauplan-2026-11-26.md`); Abnahme siehe `docs/ux/verwaltung/abnahme/etappe-1.md`, Abschnitt „Shopliste für viele Produkte“. Die Produktivfreigabe bleibt bei Lars.
|
||||
**Kontext.** Kacheln sind für wenige Produkte übersichtlich; mit größeren Mengen wird die Shopseite unübersichtlich.
|
||||
**Entscheidung (Auftrag von Lars, 26.11.2026).**
|
||||
- **Eine Liste für Shopseite und Widget** (`ShopCatalog::listing`, `shop/liste.blade.php`): Suche, Auswahl nach **Thema** (veröffentlichte Säule), **Materialart**, **Eignung** (Privatpersonen, Organisationen und Vereine) und **Nutzerkreis** (Einzel- oder Mehrfachlizenz), **Reihenfolge** (alphabetisch, neueste zuerst, Preis aufsteigend), **Ansicht** (Kacheln oder Liste) und **Seiten** (`shop.per_page`, Vorgabe 12). Ein Auswahlfeld erscheint nur, wenn es mindestens zwei Werte gibt, die es bei den Produkten tatsächlich gibt.
|
||||
- **Alles im Abfragetext, ohne Script.** Das Formular sendet per GET; Seiten- und Ansichtsumschalter sind Links, die die Auswahl behalten. Jeder Wert wird gegen die vorhandenen Werte geprüft; unbekannte, fehlerhafte oder als Liste gesendete Werte entfallen, nie ein Fehler. Der Suchbegriff ist auf 100 Zeichen gekürzt und maskiert; eine Seitenzahl außerhalb des Bereichs wird auf die erste oder letzte Seite gesetzt.
|
||||
- **Listenansicht** (`shop/zeile.blade.php`) mit denselben Angaben wie die Kachel: kleines Bild oder Symbol, Art, Marker mit Wort, Titel als Link, Kurztext, Themen, Preis ab und Zahl der Optionen. Bei schmalem Fenster steht der Preis unter dem Text.
|
||||
- **Widget.** Variante „Liste mit kleinem Bild“ und die Einstellung „Auswahl für Besucher“ (an: Suche, Auswahl, Ansicht, Seiten; aus: wie bisher mit Anzahl und einfachem Suchfeld). Festlegungen im Widget (Säule, Materialart) gelten immer und lassen sich vom Besucher nicht aufheben.
|
||||
**Grenzen.** Die Kacheln werden bei jedem Aufruf aus den Fachdaten gebildet (kein Zwischenspeicher). Für die erwartete Zahl von Produkten (Dutzende bis wenige Hundert) genügt das; bei deutlich mehr wird ein Zwischenspeicher nötig. Pakete haben keine Materialart und kein Thema und erscheinen daher bei diesen Auswahlen nicht.
|
||||
**Folgen.** Kein Schema, keine Migration. Die bisherige Suche der Shopseite bleibt (Feld „Shop durchsuchen“).
|
||||
**Quelle.** Anfrage von Lars vom 26.11.2026; ADR-54, ADR-55.
|
||||
@@ -73,7 +73,7 @@ ## 4. Registrierte Widget-Arten
|
||||
| `hero` | Einstieg (Hero), Premium nach Kit v1.6 | 2 | `photo_split` (Foto mit Textfläche), `editorial_solid` (Navy-Markenfläche) | 3, 4 | `compact` (Kompakt), `normal` (Standard, Vorgabe), `large` (Großzügig); Mindesthöhe aus der Größenskala (ADR-44) | `refs.image`, `refs.video` (optional) |
|
||||
| `heading` | Überschrift und Einleitung | 1 | `standard` | 1–4 | – | – |
|
||||
| `prose` | Fließtext | 1 | `standard` | 1–4 | – | – |
|
||||
| `image_text` | Bild und Text, Premium nach Kit v1.6 | 3 | `image_left`, `image_right` (Bildseite) | 1–4 | `compact` (Kompakt), `normal` (Standard, Vorgabe), `spacious` (Großzügig) | `refs.image` |
|
||||
| `image_text` | Bild und Text, Premium nach Kit v1.6 | 3 | `image_left`, `image_right` (Bildseite) | 1–4 | `compact` (Kompakt), `normal` (Standard, Vorgabe), `spacious` (Großzügig) | `refs.image`, optional `refs.video` |
|
||||
| `cards` | Redaktionelle Karten | 1 | `standard` (Raster), `compact` (Liste), `featured` (erste Karte hervorgehoben) | 1–4 | – | Bild je Karte in `data.items[].image` |
|
||||
| `features` | Merkmalszeile (1–12 Merkmale mit Symbol, Kurztitel, Satz, optionalem Link) | 1 | `standard` | 1–4 | – | – |
|
||||
| `catalog_cards` | Programm- und Modulkarten | 1 | `standard`, `compact` | 1–4 | – | `refs.items[] = {type: composition, id}` |
|
||||
@@ -82,7 +82,7 @@ ## 4. Registrierte Widget-Arten
|
||||
| `program_card` | Programm- oder Modulkarte, Kit v1.7 | 1 | `adaptive`, `stacked` | 1–4 | `auto` (Vorgabe), `fill` | `refs.composition`, `refs.image` |
|
||||
| `call_to_action` | Handlungsaufruf | 1 | `standard` | 1–4 | `auto` (Vorgabe), `fill` (Abschnittshöhe füllen) | – |
|
||||
| `faq` | FAQ | 1 | `standard` | 2–4 | – | – |
|
||||
| `shop_products` | Shop-Produkte (Kacheln aus `ShopCatalog`, ADR-55) | 1 | `kacheln` | 2–4 | – | – (Filter `data.pillar`, `data.kind`; Einstellungen `sort`, `limit`, `search`) |
|
||||
| `shop_products` | Shop-Produkte (Kacheln aus `ShopCatalog`, ADR-55, ADR-57) | 1 | `kacheln`, `liste` | 2–4 | – | – (Filter `data.pillar`, `data.kind`; Einstellungen `sort`, `limit`, `search`, `filter`) |
|
||||
|
||||
Darstellungsklassen an der Widget-Hülle: `widget widget-<typ> widget-variant-<variante>` und, wenn die Art Höhen anbietet, `widget-height-<höhe>`. Premium-Ansichten: `lf-hero lf-hero--{photo-split|editorial-solid} lf-hero--height-<höhe> lf-hero--accent-<akzent>` und `lf-bt lf-bt--{cream|clear|navy} lf-bt--image-{left|right} lf-bt--height-<höhe>`.
|
||||
|
||||
@@ -110,6 +110,11 @@ ## 4. Registrierte Widget-Arten
|
||||
**Merkmalszeile.** `data.items[]` mit `symbol` (Auswahl wie oben), `title` (höchstens 60 Zeichen) und optional `text` (höchstens 200 Zeichen), `url` (über `SafeUrl`) und `link_label` (höchstens 60 Zeichen, Vorgabe „Mehr erfahren“, wird ohne `url` verworfen); ein bis zwölf Einträge, in jeder Platzbreite (1–4 Einheiten). Die Spaltenzahl ergibt sich aus der Anzahl der Einträge und der tatsächlichen Breite (Raster ab 12 rem je Merkmal), nicht aus einer eigenen Einstellung. `settings.link_style` bestimmt für alle Links des Widgets die Darstellung: `text` (kleiner Textlink, Vorgabe) oder `pill` (Pille). Weitere Einstellungen: `settings.align` (`left` Vorgabe, `center`, `right`; richtet Symbol, Titel, Satz und Link aus), `settings.symbol_size` (`small` 2,5 rem, `medium` 3,5 rem Vorgabe, `large` 5 rem, `xlarge` 7 rem) `settings.symbol_position` (`top` über dem Text, Vorgabe; `left` oder `right` neben Titel, Satz und Link; die Klasse `lf-features--symbol-<lage>` erscheint nur bei Abweichung, Titel, Satz und Link stehen dann in `lf-features__body`, das Symbol sitzt oben bündig mit dem Titel, Mindestbreite je Merkmal 18 rem statt 12 rem, darunter stehen die Merkmale untereinander) und `settings.divider` = `line` (feiner Strich in der Mitte der Lücke: senkrecht zwischen Spalten, waagerecht zwischen Zeilen und bei untereinander stehenden Merkmalen; die Liste schneidet die Striche am Rand ab). Ungültige gespeicherte Werte fallen auf die Vorgaben zurück (`FeaturesWidget::layout`). Der zugängliche Name des Links nennt das Merkmal („Mehr erfahren: Kurze Filme“).
|
||||
|
||||
**Abweichungen vom Kit (bewusst):**
|
||||
**Bild und Text: Bildanteil, Bild ohne Text, Video.** Ohne Versionssprung ergänzt; ältere Revisionen und Seiten ohne die neuen Felder stellen sich unverändert dar (Test `CmsImageTextMediaTest`).
|
||||
- `settings.image_share` = `third`, `two_fifths`, `half`, `three_fifths`, `two_thirds` (Bild : Text = 1:2, 2:3, 1:1, 3:2, 2:1). Wirkt nur im zweispaltigen Stand ab 900 px Containerbreite und nur mit Bild und Text; die Klassen `lf-bt--shared lf-bt--share-<wert>` erscheinen nur dann. Ohne Wert bleibt die bisherige Verteilung (Text 1,1 : Bild 0,9, links/rechts je nach Bildseite). Die Spurbreiten stehen als `fr`-Werte in `--bt-img` und `--bt-txt` (in `calc()` sind `fr`-Einheiten nicht zulässig).
|
||||
- Bild ohne Text: `data.body` ist nur Pflicht, solange kein Bild gewählt ist. Das Widget braucht Bild oder (Text, Überschrift, Label oder Schaltfläche) (`ImageTextWidget::hasCopy`). Ohne Text, Überschrift, Label und Schaltflächen steht das Bild allein über die ganze Breite (`lf-bt--without-text`, Seitenverhältnis nach der Höhen-Einstellung: Kompakt 3:1, Standard 21:9, Großzügig 16:9 ab 900 px); ein Bildanteil entfällt dann. Ohne Bild und ohne Text rendert das Widget nichts.
|
||||
- Video: `refs.video` ist die Kennung eines Films aus dem Medienmanager (leer: Schlüssel entfällt). Gewählt wird über denselben visuellen Picker wie das Bild (`ChoosesWebsiteImages::openWebsiteVideoPicker`, Zweck `website-video`, nur Filme; Ziel nur ein Feld `…video`). Geprüft wird wie beim Einstieg (`HeroVideo::clean`: Film, nicht archiviert, keine Traineranleitung), und ein Video braucht ein Bild, das bis zum Start steht. Abgespielt wird nur ein für die Website freigegebener Clip nach der Regel der Medienkarte (`CardClip`: Trailer, sonst Vorschauclip, sonst die eigene Website-Datei des Films); der vollständige Film und nicht freigegebene Clips kommen nie über das Widget, die Auswahl gibt nichts frei. Die Darstellung nutzt `card-clip.js` und die Bausteine der Premium-Karte: Das `<video>` liegt auf dem Bild (`.lf-bt__media[data-card-clip]`), startet beim Überfahren mit der Maus stumm in Schleife und per Klick, Tipp oder Schaltfläche mit Ton (zweiter Klick hält an); bei „reduzierte Bewegung“ und im Datensparmodus nur auf Bedienung. Ohne freigegebenen Clip bleibt es beim Bild; die Redaktionsvorschau erklärt, warum.
|
||||
|
||||
- Kennungen bleiben `hero` und `image_text`, nicht `lf-brand-hero`/`lf-editorial-bild-text`; Varianten `photo_split`/`editorial_solid` mit Unterstrich, weil Variantenkennungen `^[a-z][a-z0-9_]*$` folgen.
|
||||
- Bildseite von Bild und Text bleibt die Variante (`image_left/right`), nicht zusätzlich `settings.image_side`, damit es keine doppelte Einstellung gibt.
|
||||
- Bildfokus in `data` statt `settings.image_focus`, weil Einstellungen nur Aufzählungswerte tragen.
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
# Abnahme: Bild und Text, Bildanteil, Bild ohne Text, Video (2026-11-26)
|
||||
|
||||
**Geprüft wurde nur die Ausgabe, lokal und nicht auf luf-test:** Die Ansicht des Widgets wurde mit den gebauten Styles und Skripten in Chromium gerendert (Playwright), mit einem Prüfbild und einem erzeugten Prüfvideo, in 1240 px und 440 px Fensterbreite. Der Seiteneditor (Einstellung „Bildanteil“, Videofeld, Videowähler) wurde noch nicht im Browser geprüft; das steht nach dem Deploy auf Test aus. Den Videowähler deckt ein Livewire-Test ab (`CmsImageTextMediaTest`).
|
||||
|
||||
Geprüft:
|
||||
- **Bildanteil** (ab 900 px Breite): Vorgabe unverändert; Ein Drittel, Gleich breit und Zwei Drittel stellen die Spalten wie benannt, bei Bild links und Bild rechts (siehe Bild „breit“). Unter 900 px bleibt es beim Stapel, der Bildanteil wirkt nicht.
|
||||
- **Bild ohne Text:** Das Bild steht allein über die ganze Breite, ohne leere Textspalte (Bild „breit“, vorletzter Fall).
|
||||
- **Video** (mit und ohne Text): Schaltfläche oben rechts auf dem Bild. Beim Überfahren mit der Maus startet der Clip stumm und in Schleife über dem Bild (gleicher Ausschnitt, gleiche Ecken). Ein Klick schaltet auf Ton ohne Schleife, der Clip läuft auch nach dem Verlassen weiter, ein zweiter Klick hält an. Wie auf der Medienkarte.
|
||||
- Keine Konsolenfehler.
|
||||
|
||||
Nicht geprüft: Screenreader, Touch (Tipp), Browser außer Chromium, ein echter freigegebener Clip aus dem Medienmanager.
|
||||
|
||||
| Breit | Video läuft | Schmal |
|
||||
|---|---|---|
|
||||
|  |  |  |
|
||||
|
After Width: | Height: | Size: 673 KiB |
|
After Width: | Height: | Size: 282 KiB |
|
After Width: | Height: | Size: 269 KiB |
@@ -59,6 +59,43 @@ ## Produktseite je Lizenzartikel (25.11.2026, auf `luf-test`)
|
||||
3. **Altbestand mit mehreren Positionen und Programmseite** im Browser: durch Test belegt, auf `luf-test` gibt es keinen solchen Fall.
|
||||
4. **Der Dialog selbst** ist unverändert lang (Eignung, Nutzerkreis, Vergabe, Preis, „Programmfassung, die abgedeckt sein muss“, Positionen). Die Vereinfachung mit mehreren Optionen je Artikel (Rechteprofil mit Preis) folgt als nächster Schritt.
|
||||
|
||||
## Shop im CMS, Regeln für freie Artikel und Shopliste (26.11.2026, auf `luf-test` und lokal)
|
||||
|
||||
**Geprüfter Stand:** Commit `6160e95` auf `develop` (enthält Phase 3 `61c6559`, Phase 4 `95a888d`, Phase 5 `f0ffb47` und den Merge von `fbe4226`); `CI Feature / test`, `Deploy Test / test` und `Deploy Test / deploy` **success** (öffentliche Gitea-Statusabfrage). Entscheidungen: ADR-55, ADR-56, ADR-57; Plan `docs/analysen/shop-umbauplan-2026-11-26.md`, Phasen 3 bis 5.
|
||||
|
||||
**Tests.**
|
||||
- `ShopCmsTest` (13): Das Widget ist registriert; es zeigt die Produkte auf jeder Seite, filtert nach Säule und Materialart, sortiert und begrenzt; es bleibt leer und die Seite `/shop` ist weg, solange der Shop nicht sichtbar ist; eine veröffentlichte CMS-Seite „shop“ bestimmt den Aufbau von `/shop` (Banner und Widget), ohne sie oder unveröffentlicht gilt die Standardseite; die Sitemap enthält `/shop` nicht, solange nicht gekauft werden kann; der Editor legt eine Seite mit dem Widget an, speichert die Einstellungen und öffnet sie wieder; ein langer oder skriptartiger Suchbegriff ist harmlos; die Mitgliederseite zeigt die neuesten Produkte als Kacheln.
|
||||
- `OfferClaimRulesTest` (17): Regel „alle“ (Vorgabe, einmaliger Abruf); „nur freigeschaltete Konten“ (andere Konten sehen das Angebot nicht und bekommen beim Abruf nichts, auch mit der Adresse; eine Freigabe zählt nur für ihr Angebot und Konto; Entzug und Ablauf sperren den Abruf, Übernommenes bleibt, Freigaben werden nie gelöscht; doppelte, vergangene und profillose Freigaben werden abgelehnt); „Besitz eines Artikels“ (nur mit gültiger Berechtigung, eine widerrufene zählt nicht, je Konto); die Regel selbst wird geprüft (unbekannt, Artikel fehlt, archiviert, anderer Wert löscht den Artikel); „bei Registrierung“ kennt keine Regel; Kauf- und beendete Angebote lassen sich nicht frei abrufen; `GrantIssuer::claim` prüft die Regel ohne die Seite; in der Verwaltung stellt der Katalogverwalter Regel, Freigabe und Entzug ein, die Aktionen gibt es nur bei Angeboten auf Abruf, ein Redakteur bekommt 403, eine Freigabe eines anderen Angebots lässt sich nicht über dieses entziehen; „Neu für dich“ erscheint für besessene Artikel 90 Tage, nur für den Besitzer, nicht bei widerrufener Berechtigung; die Seite zeigt einen ehrlichen leeren Zustand.
|
||||
- `ShopListingTest` (10): Auswahlfelder nur mit mindestens zwei vorhandenen Werten; Auswahl nach Thema, Materialart, Eignung und Nutzerkreis; unbekannte, fehlerhafte und als Liste gesendete Werte sind harmlos; Reihenfolge und unbekannte Reihenfolge; Seiten mit Begrenzung der Seitenzahl; Seitenlinks behalten Auswahl und Ansicht; Umschalter Kacheln und Liste mit denselben Angaben; Formular mit Beschriftungen, maskierter Suchtext; Leerzustand mit Weg zurück; Widget mit und ohne Auswahl, feste Filter bleiben bestehen.
|
||||
- Gesamtsuite lokal: 1083 Tests ohne andere Fehler als die bekannten Symbolfehler der lokalen `vendor`-Kopie; das CI-Gate ist grün. Ein bestehender Test wurde bewusst geändert (Beschriftung „Zurücksetzen“ statt „Suche zurücksetzen“), ebenso die Liste der Widgetarten und der Kopfmenü-Test (Eintrag „Shop“ statt „Angebote“).
|
||||
|
||||
**Sicherheitsdurchsicht (Phasen 3 bis 5).** Die Abrufregel wird serverseitig im Dienst geprüft (`GrantIssuer::claim`), nicht nur in der Anzeige; die Ablehnung nennt die Regel nicht. Freigaben sind je Angebot und Konto, nie löschbar (restrict), Entzug mit Person und Zeitpunkt. Die Verwaltungsaktionen sind auf den Katalogverwalter beschränkt; ein fremder Freigabe-Eintrag wird über ein anderes Angebot nicht gefunden. Alle Werte der Shopliste kommen aus dem Abfragetext und werden gegen vorhandene Werte geprüft (kein SQL aus Eingaben, Felder als Liste ergeben keinen Fehler, Suchtext auf 100 Zeichen gekürzt und maskiert, Seitenzahl begrenzt). Das Widget gibt nichts aus, solange der Shop nicht sichtbar ist.
|
||||
|
||||
**Geprüft im echten Browser.** Chromium über Playwright (Skripte nicht im Repository). Auf `luf-test` gibt es kein Mitgliedskonto; die Mitgliederseite „Für dich“ und die CMS-Seite „shop“ mit Bild wurden deshalb lokal mit der Demo-Datenbank geprüft.
|
||||
|
||||
| Fall | Ort | Ergebnis | Belege |
|
||||
|---|---|---|---|
|
||||
| CMS-Seite „shop“ mit Banner, Widget mit Suchfeld und Reihenfolge nach Preis | lokal | die Seite bestimmt den Aufbau von `/shop`; Kacheln mit Bild, Symbol, Markern und Säulen; kein Überlauf (1280 und 390 px) | [01](etappe-1/shop-cms-regeln-liste/01-lokal-shop-cms-seite.jpg) |
|
||||
| Mitgliederseite „Angebote“ als Konto mit Besitz | lokal | „Neu für dich“ (Stand 2 von „Konflikte im Training“), „Zum Übernehmen“ (Angebot mit der Regel „Besitz“), darunter der Shop | [02](etappe-1/shop-cms-regeln-liste/02-lokal-fuer-dich-mit-besitz.jpg) |
|
||||
| dieselbe Seite als Konto ohne Besitz | lokal | die Checkliste mit Besitzregel erscheint nicht; ehrlicher leerer Zustand | [03](etappe-1/shop-cms-regeln-liste/03-lokal-fuer-dich-leer.jpg) |
|
||||
| Angebot auf Abruf mit der Vorgabe „Alle angemeldeten Mitglieder“ | `luf-test` | Abschnitt „Wer darf abrufen“, „Regel für den Abruf“, noch kein „Konto freischalten“ | [04](etappe-1/shop-cms-regeln-liste/04-luf-test-angebot-regel-alle.jpg), [05](etappe-1/shop-cms-regeln-liste/05-luf-test-dialog-regel.jpg) |
|
||||
| Regel „nur freigeschaltete Konten“ | `luf-test` | „Freigeschaltete Konten“ (leer) und „Konto freischalten“; der Dialog fragt Konto, Ende und Grundlage ab, Escape verwirft | [06](etappe-1/shop-cms-regeln-liste/06-luf-test-regel-konten.jpg), [07](etappe-1/shop-cms-regeln-liste/07-luf-test-dialog-freischalten.jpg) |
|
||||
| Regel „Besitz eines Artikels“ | `luf-test` | die Wahl des Artikels erscheint; die Regel nennt den erforderlichen Artikel | [08](etappe-1/shop-cms-regeln-liste/08-luf-test-regel-besitz.jpg) |
|
||||
| Shop mit Suche, Auswahl, Reihenfolge und Ansicht (1280 und 390 px) | `luf-test` | Felder mit Beschriftung, Umschalter Kacheln und Liste, kein Überlauf; Suche per Enter in der Adresse; „Keine Treffer“ mit Weg zurück; manipulierte Felder ergeben keine Fehlerseite | [09](etappe-1/shop-cms-regeln-liste/09-luf-test-shop-auswahl-1280.jpg), [10](etappe-1/shop-cms-regeln-liste/10-luf-test-shop-auswahl-390.jpg) |
|
||||
| Listenansicht (1280 und 390 px) | `luf-test` | Zeile mit Platzhalter, Art, Marker, Titel, Preis; bei 390 px steht der Preis unter dem Text | [11](etappe-1/shop-cms-regeln-liste/11-luf-test-shop-liste-1280.jpg), [12](etappe-1/shop-cms-regeln-liste/12-luf-test-shop-liste-390.jpg) |
|
||||
| Liste mit Bild, Symbol, Markern und Themen | lokal | Zeilen mit allen Angaben der Kachel | [13](etappe-1/shop-cms-regeln-liste/13-lokal-liste-mit-bild-und-symbol.jpg) |
|
||||
|
||||
**Zustand von `luf-test` danach:** Das Angebot „Testangebot Abstand“ hat wieder die Regel „Alle angemeldeten Mitglieder“ (für den Lauf vorübergehend „nur freigeschaltete Konten“ und „Besitz“). Die Kauf-Option „Einzellizenz Abstand“ wurde für den Lauf aktiv gesetzt und wieder beendet; `/shop/4` antwortet 404. Im Shop steht weiterhin der Artikel mit der Kennung 10, den ich nicht angelegt habe. Der Menüpunkt „Angebote“ der Website und die alte CMS-Seite `/angebote` bestehen noch (Daten, die Lars in der Webpräsenz entfernt); die Adresse leitet auf `/shop`.
|
||||
|
||||
**Nicht geprüft (mit Grund):**
|
||||
|
||||
1. **Mitgliedsabläufe auf `luf-test`:** kein Mitgliedskonto dort; „Für dich“, Abruf mit Regel und neue Stände sind durch Tests und lokal belegt, nicht auf der Instanz.
|
||||
2. **Freigabe eines Kontos im Browser:** Der Dialog öffnet sich, die Kontosuche und das Speichern sind durch Test belegt; auf `luf-test` gibt es kein Konto mit Mitgliedsprofil.
|
||||
3. **Widget-Editor im Browser:** Das Anlegen einer Seite mit dem Widget ist durch Test (Seite anlegen, Einstellungen speichern, Seite öffnen) belegt, nicht in der echten Oberfläche durchgespielt.
|
||||
4. **Titelbild und Symbol auf `luf-test`:** Dort ist kein Bild mit Website-Freigabe am Artikel gepflegt; lokal und durch Tests belegt.
|
||||
5. **Leistung bei vielen Produkten:** Die Kacheln werden bei jedem Aufruf aus den Fachdaten gebildet. Für Dutzende bis wenige Hundert Produkte genügt das; mit sehr vielen braucht es einen Zwischenspeicher (ADR-57).
|
||||
6. **Zoom und Bildschirmleser** nicht geprüft; Tastaturbedienung der Kacheln, der Suche und der Dialoge wurde geprüft.
|
||||
|
||||
## Shopkachel: Titelbild, Säulen, Materialart mit Symbol, Marker (26.11.2026, auf `luf-test` und lokal)
|
||||
|
||||
**Geprüfter Stand:** Commit `0ac7088` auf `develop`; `CI Feature / test`, `Deploy Test / test` und `Deploy Test / deploy` **success** (öffentliche Gitea-Statusabfrage). Entscheidung: ADR-54, Plan `docs/analysen/shop-umbauplan-2026-11-26.md`, Phase 2.
|
||||
|
||||
|
After Width: | Height: | Size: 72 KiB |
|
After Width: | Height: | Size: 85 KiB |
|
After Width: | Height: | Size: 71 KiB |
|
After Width: | Height: | Size: 121 KiB |
|
After Width: | Height: | Size: 101 KiB |
|
After Width: | Height: | Size: 132 KiB |
|
After Width: | Height: | Size: 113 KiB |
|
After Width: | Height: | Size: 121 KiB |
|
After Width: | Height: | Size: 57 KiB |
|
After Width: | Height: | Size: 56 KiB |
|
After Width: | Height: | Size: 55 KiB |
|
After Width: | Height: | Size: 50 KiB |
|
After Width: | Height: | Size: 72 KiB |
@@ -182,6 +182,28 @@ .lf-bt--height-compact .lf-bt__image { aspect-ratio: 16 / 9; }
|
||||
.lf-bt--height-spacious .lf-bt__image { aspect-ratio: 4 / 3; }
|
||||
.lf-bt--without-image { grid-template-columns: minmax(0, 1fr); }
|
||||
|
||||
/*
|
||||
* Bildanteil (Einstellung „Bildanteil“): Verhältnis der Bild- zur Textspalte, nur im zweispaltigen Stand (ab 900 px, siehe
|
||||
* unten). Ohne Einstellung bleibt die bisherige Verteilung. Die Klassen erscheinen nur mit Bild und Text.
|
||||
*/
|
||||
.lf-bt--share-third { --bt-img: 1fr; --bt-txt: 2fr; }
|
||||
.lf-bt--share-two_fifths { --bt-img: 2fr; --bt-txt: 3fr; }
|
||||
.lf-bt--share-half { --bt-img: 1fr; --bt-txt: 1fr; }
|
||||
.lf-bt--share-three_fifths { --bt-img: 3fr; --bt-txt: 2fr; }
|
||||
.lf-bt--share-two_thirds { --bt-img: 2fr; --bt-txt: 1fr; }
|
||||
|
||||
/* Ohne Text steht das Bild allein über die ganze Breite (Bildanteil entfällt). */
|
||||
.lf-bt--without-text { grid-template-columns: minmax(0, 1fr); }
|
||||
|
||||
/*
|
||||
* Video auf dem Bild (CardClip, resources/js/card-clip.js, Bausteine der Premium-Karte): Der Clip liegt über dem Bild, mit
|
||||
* demselben Ausschnitt und denselben Ecken, und blendet erst mit dem ersten Bild ein; bis dahin bleibt das Bild stehen.
|
||||
*/
|
||||
.lf-bt__media > .lf-pc__clip {
|
||||
object-position: var(--bt-focus-x) var(--bt-focus-y);
|
||||
border-radius: clamp(0.78rem, 1.8cqi, 1.3rem);
|
||||
}
|
||||
|
||||
/* Schmale Plätze: vollständiger Text und Links, keine erzwungene Höhe. */
|
||||
@container lf-bt (max-width: 539.99px) {
|
||||
.lf-bt__actions { display: grid; grid-template-columns: minmax(0, 1fr); }
|
||||
@@ -218,6 +240,20 @@ @container lf-bt (min-width: 900px) {
|
||||
.lf-bt--image-left .lf-bt__media { order: -1; }
|
||||
.lf-bt__image { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; max-block-size: none; aspect-ratio: auto; }
|
||||
.lf-bt--without-image { grid-template-columns: minmax(0, 1fr); }
|
||||
|
||||
/* Bildanteil: erste Spur ist die linke; bei „Bild links“ ist das die Bildspalte, sonst die Textspalte. */
|
||||
.lf-bt--shared.lf-bt--image-left { grid-template-columns: minmax(0, var(--bt-img)) minmax(0, var(--bt-txt)); }
|
||||
.lf-bt--shared.lf-bt--image-right { grid-template-columns: minmax(0, var(--bt-txt)) minmax(0, var(--bt-img)); }
|
||||
|
||||
/*
|
||||
* Bild ohne Text: Eine Spalte über die volle Breite. Das Bild bestimmt hier seine Höhe selbst (Seitenverhältnis nach
|
||||
* der Höhen-Einstellung), statt eine Fläche neben dem Text zu füllen.
|
||||
*/
|
||||
.lf-bt--without-text { grid-template-columns: minmax(0, 1fr); }
|
||||
.lf-bt--without-text .lf-bt__media { min-block-size: 0; }
|
||||
.lf-bt--without-text .lf-bt__image { position: static; inset: auto; block-size: auto; max-block-size: none; aspect-ratio: 21 / 9; }
|
||||
.lf-bt--without-text.lf-bt--height-compact .lf-bt__image { aspect-ratio: 3 / 1; }
|
||||
.lf-bt--without-text.lf-bt--height-spacious .lf-bt__image { aspect-ratio: 16 / 9; }
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
|
||||
@@ -563,3 +563,157 @@ .shop-marker-beliebt {
|
||||
border-color: var(--color-success);
|
||||
color: var(--color-success);
|
||||
}
|
||||
|
||||
/*
|
||||
* Auswahl, Listenansicht und Seiten (ADR-57). Alles ohne Script bedienbar; die Auswahl steht im Abfragetext.
|
||||
*/
|
||||
.shop-filter {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
|
||||
gap: var(--space-3) var(--space-4);
|
||||
align-items: end;
|
||||
max-width: none;
|
||||
}
|
||||
|
||||
.shop-filter-field {
|
||||
display: grid;
|
||||
gap: var(--space-1);
|
||||
}
|
||||
|
||||
.shop-filter-search {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
.shop-filter-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-2);
|
||||
}
|
||||
|
||||
.shop-viewbar {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: var(--space-3);
|
||||
margin: var(--space-4) 0 0;
|
||||
}
|
||||
|
||||
.shop-view {
|
||||
display: flex;
|
||||
gap: var(--space-2);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.shop-view a {
|
||||
padding: 0.2rem 0.8rem;
|
||||
border: 2px solid var(--color-border-strong);
|
||||
border-radius: var(--radius-pill);
|
||||
text-decoration: none;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.shop-view a[aria-current='true'] {
|
||||
background: var(--lf-navy);
|
||||
border-color: var(--lf-navy);
|
||||
color: var(--lf-white);
|
||||
}
|
||||
|
||||
.shop-rows {
|
||||
list-style: none;
|
||||
margin: var(--space-5) 0;
|
||||
padding: 0;
|
||||
display: grid;
|
||||
gap: var(--space-3);
|
||||
}
|
||||
|
||||
.shop-row {
|
||||
position: relative;
|
||||
display: grid;
|
||||
grid-template-columns: 7rem minmax(0, 1fr) auto;
|
||||
gap: var(--space-4);
|
||||
align-items: center;
|
||||
background: var(--color-surface-raised);
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: var(--radius-card);
|
||||
padding: var(--space-3) var(--space-4);
|
||||
}
|
||||
|
||||
.shop-row-media {
|
||||
aspect-ratio: 16 / 9;
|
||||
background: var(--color-surface-subtle);
|
||||
border-radius: var(--radius-card);
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.shop-row-media img {
|
||||
inline-size: 100%;
|
||||
block-size: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.shop-row-symbol {
|
||||
--sym-s: 2.5rem;
|
||||
}
|
||||
|
||||
.shop-row-body h2 {
|
||||
margin: 0 0 var(--space-1);
|
||||
font-size: var(--text-h3);
|
||||
}
|
||||
|
||||
.shop-row-body h2 a {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.shop-row-body h2 a:hover,
|
||||
.shop-row-body h2 a:focus-visible {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.shop-row-body h2 a::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
}
|
||||
|
||||
.shop-row .shop-tile-kind {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.shop-row-price {
|
||||
margin: 0;
|
||||
font-weight: 700;
|
||||
text-align: end;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.shop-row-price span {
|
||||
display: block;
|
||||
font-weight: 400;
|
||||
font-size: var(--text-small);
|
||||
color: var(--color-text-muted);
|
||||
}
|
||||
|
||||
.shop-pages {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: var(--space-4);
|
||||
margin: var(--space-5) 0;
|
||||
}
|
||||
|
||||
@media (max-width: 40rem) {
|
||||
.shop-row {
|
||||
grid-template-columns: 4.5rem minmax(0, 1fr);
|
||||
}
|
||||
|
||||
.shop-row-price {
|
||||
grid-column: 1 / -1;
|
||||
text-align: start;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
{{-- Gemeinsamer Picker für Website-Bilder im CMS (ChoosesWebsiteImages). --}}
|
||||
@if ($this->pickerOpen && $this->pickerPurpose === 'website-bild')
|
||||
{{-- Gemeinsamer Picker für Website-Bilder und Videos im CMS (ChoosesWebsiteImages). --}}
|
||||
@if ($this->pickerOpen && in_array($this->pickerPurpose, ['website-bild', 'website-video'], true))
|
||||
@include('filament.verwaltung.picker')
|
||||
@endif
|
||||
@@ -0,0 +1,26 @@
|
||||
{{-- Videofeld im CMS (Bild und Text): Auswahl eines Films über den gemeinsamen Picker (ChoosesWebsiteImages::openWebsiteVideoPicker). Gespeichert wird die Kennung des Films; abgespielt wird nur ein für die Website freigegebener Clip (HeroVideo, CardClip). --}}
|
||||
@php
|
||||
$wert = $getState();
|
||||
$pfad = $getStatePath();
|
||||
$mitPicker = method_exists($getLivewire(), 'openWebsiteVideoPicker');
|
||||
$titel = filled($wert) ? app(\App\Domain\Cms\Widgets\Support\HeroVideo::class)->labelFor($wert) : null;
|
||||
@endphp
|
||||
<x-dynamic-component :component="$getFieldWrapperView()" :field="$field">
|
||||
<div class="luf-bild-feld">
|
||||
@if (blank($wert))
|
||||
<span class="luf-bild-feld-leer">Kein Video gewählt.</span>
|
||||
@else
|
||||
<span class="luf-bild-feld-leer" data-video-status>{{ $titel ?? 'Dieses Medium gibt es nicht mehr.' }}</span>
|
||||
@endif
|
||||
@if ($mitPicker)
|
||||
<x-filament::button color="gray" size="sm" icon="heroicon-o-film" wire:click="openWebsiteVideoPicker({{ \Illuminate\Support\Js::from($pfad) }})">
|
||||
{{ blank($wert) ? 'Video auswählen' : 'Anderes Video wählen' }}
|
||||
</x-filament::button>
|
||||
@endif
|
||||
@if (filled($wert))
|
||||
<x-filament::button color="gray" size="sm" outlined wire:click="$set({{ \Illuminate\Support\Js::from($pfad) }}, null)">
|
||||
Video entfernen
|
||||
</x-filament::button>
|
||||
@endif
|
||||
</div>
|
||||
</x-dynamic-component>
|
||||
@@ -243,6 +243,8 @@
|
||||
{{ $zweck === 'praesentation' ? 'Diese Rolle hat nur ein Medium. ' : '' }}Erst „Austauschen“ ersetzt die Zuordnung an derselben Stelle. Abbrechen lässt sie unverändert.
|
||||
@elseif ($zweck === 'website-bild')
|
||||
Das gewählte Bild wird in diesen Platz des Seitenentwurfs übernommen. Öffentlich erscheint es nur mit Website-Freigabe; die Auswahl gibt es nicht frei.
|
||||
@elseif ($zweck === 'website-video')
|
||||
Der gewählte Film wird als Video in diesen Platz des Seitenentwurfs übernommen. Öffentlich spielt nur ein für die Website freigegebener Clip (Trailer, Vorschauclip oder Website-Datei); die Auswahl gibt nichts frei.
|
||||
@elseif ($zweck === 'vorschaubild')
|
||||
Das gewählte Bild wird als Vorschaubild übernommen. Es wird dadurch nicht für die Website freigegeben.
|
||||
@elseif ($zweck === 'aufbau')
|
||||
|
||||
@@ -6,26 +6,5 @@
|
||||
<h1>Shop</h1>
|
||||
<p class="lede">Hier findest du kaufbare Produkte und Pakete. Jede Kachel öffnet die Produktseite mit Inhalt und den verfügbaren Lizenzoptionen.</p>
|
||||
|
||||
<form class="shop-search" method="get" action="{{ route('shop') }}" role="search">
|
||||
<label for="shop-suche">Shop durchsuchen</label>
|
||||
<input id="shop-suche" type="search" name="suche" value="{{ $term }}" autocomplete="off">
|
||||
<button class="button" type="submit">Suchen</button>
|
||||
@if ($term !== '')
|
||||
<a class="button button-quiet" href="{{ route('shop') }}">Suche zurücksetzen</a>
|
||||
@endif
|
||||
</form>
|
||||
|
||||
@if ($cards === [])
|
||||
<div class="empty">
|
||||
<h2>{{ $term !== '' ? 'Keine Treffer' : 'Noch keine kaufbaren Produkte' }}</h2>
|
||||
<p>{{ $term !== '' ? 'Zu „'.$term.'“ gibt es keine kaufbaren Produkte. Prüfe die Schreibweise oder setze die Suche zurück.' : 'Sobald ein Angebot aktiv ist, erscheint es hier.' }}</p>
|
||||
</div>
|
||||
@else
|
||||
<p class="shop-count" role="status">{{ count($cards) }} {{ count($cards) === 1 ? 'Produkt' : 'Produkte' }}</p>
|
||||
<ul class="shop-tiles">
|
||||
@foreach ($cards as $card)
|
||||
@include('shop.kachel', ['card' => $card])
|
||||
@endforeach
|
||||
</ul>
|
||||
@endif
|
||||
@include('shop.liste', ['listing' => $listing, 'action' => route('shop'), 'uid' => 'seite'])
|
||||
@endsection
|
||||
@@ -0,0 +1,89 @@
|
||||
{{--
|
||||
Die Produktliste des Shops: Suche, Auswahl (Säule, Materialart, Eignung, Nutzerkreis), Reihenfolge, Ansicht und Seiten.
|
||||
Parameter: $listing (ShopCatalog::listing), $action (Adresse der Seite, an die das Formular sendet), $uid (Kennung
|
||||
für die Feldnamen). Die Auswahl steht im Abfragetext; ohne Script bleibt alles bedienbar.
|
||||
--}}
|
||||
@php
|
||||
$keep = ['suche', 'saeule', 'art', 'eignung', 'kreis', 'sort', 'ansicht'];
|
||||
$link = fn (array $extra): string => $action.'?'.http_build_query(array_filter(array_merge(request()->only($keep), $extra), fn ($value): bool => $value !== null && $value !== ''));
|
||||
$chosen = $listing['chosen'];
|
||||
$facets = $listing['facets'];
|
||||
$active = count(array_filter($chosen, fn ($value): bool => $value !== null)) + ($listing['term'] !== '' ? 1 : 0);
|
||||
@endphp
|
||||
@if ($listing['filters'])
|
||||
<form class="shop-search shop-filter" method="get" action="{{ $action }}" role="search" aria-label="Shop durchsuchen und filtern">
|
||||
<div class="shop-filter-field shop-filter-search">
|
||||
<label for="shop-suche-{{ $uid }}">Shop durchsuchen</label>
|
||||
<input id="shop-suche-{{ $uid }}" type="search" name="suche" value="{{ $listing['term'] }}" maxlength="100" autocomplete="off">
|
||||
</div>
|
||||
@foreach ([['saeule', 'pillar', 'Thema'], ['art', 'kind', 'Materialart'], ['eignung', 'holder', 'Geeignet für'], ['kreis', 'scope', 'Nutzerkreis']] as [$name, $facet, $label])
|
||||
@if ($facets[$facet] !== [])
|
||||
<div class="shop-filter-field">
|
||||
<label for="shop-{{ $name }}-{{ $uid }}">{{ $label }}</label>
|
||||
<select id="shop-{{ $name }}-{{ $uid }}" name="{{ $name }}">
|
||||
<option value="">Alle</option>
|
||||
@foreach ($facets[$facet] as $value => $text)
|
||||
<option value="{{ $value }}" @selected((string) ($chosen[$facet] ?? '') === (string) $value)>{{ $text }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
@endif
|
||||
@endforeach
|
||||
<div class="shop-filter-field">
|
||||
<label for="shop-sort-{{ $uid }}">Reihenfolge</label>
|
||||
<select id="shop-sort-{{ $uid }}" name="sort">
|
||||
<option value="">Standard</option>
|
||||
@foreach (\App\Domain\Commerce\ShopCatalog::SORTS as $value => $text)
|
||||
<option value="{{ $value }}" @selected(($listing['sort'] ?? '') === $value)>{{ $text }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<input type="hidden" name="ansicht" value="{{ $listing['view'] }}">
|
||||
<div class="shop-filter-actions">
|
||||
<button class="button" type="submit">Anwenden</button>
|
||||
@if ($active > 0)
|
||||
<a class="button button-quiet" href="{{ $action }}?ansicht={{ $listing['view'] }}">Zurücksetzen</a>
|
||||
@endif
|
||||
</div>
|
||||
</form>
|
||||
<div class="shop-viewbar">
|
||||
<p class="shop-count" role="status">{{ $listing['total'] }} {{ $listing['total'] === 1 ? 'Produkt' : 'Produkte' }}@if ($listing['pages'] > 1), Seite {{ $listing['page'] }} von {{ $listing['pages'] }}@endif</p>
|
||||
<p class="shop-view" aria-label="Ansicht">
|
||||
<a href="{{ $link(['ansicht' => 'kacheln', 'seite' => null]) }}" @if ($listing['view'] === 'kacheln') aria-current="true" @endif>Kacheln</a>
|
||||
<a href="{{ $link(['ansicht' => 'liste', 'seite' => null]) }}" @if ($listing['view'] === 'liste') aria-current="true" @endif>Liste</a>
|
||||
</p>
|
||||
</div>
|
||||
@elseif ($listing['cards'] !== [])
|
||||
<p class="shop-count" role="status">{{ $listing['total'] }} {{ $listing['total'] === 1 ? 'Produkt' : 'Produkte' }}</p>
|
||||
@endif
|
||||
|
||||
@if ($listing['cards'] === [])
|
||||
<div class="empty">
|
||||
<h3>{{ $active > 0 ? 'Keine Treffer' : 'Noch keine kaufbaren Produkte' }}</h3>
|
||||
<p>{{ $active > 0 ? 'Zu dieser Auswahl gibt es keine kaufbaren Produkte. Ändere die Auswahl oder setze sie zurück.' : 'Sobald ein Angebot aktiv ist, erscheint es hier.' }}</p>
|
||||
</div>
|
||||
@elseif ($listing['view'] === 'liste')
|
||||
<ul class="shop-rows">
|
||||
@foreach ($listing['cards'] as $card)
|
||||
@include('shop.zeile', ['card' => $card])
|
||||
@endforeach
|
||||
</ul>
|
||||
@else
|
||||
<ul class="shop-tiles">
|
||||
@foreach ($listing['cards'] as $card)
|
||||
@include('shop.kachel', ['card' => $card])
|
||||
@endforeach
|
||||
</ul>
|
||||
@endif
|
||||
|
||||
@if ($listing['pages'] > 1)
|
||||
<nav class="shop-pages" aria-label="Seiten">
|
||||
@if ($listing['page'] > 1)
|
||||
<a href="{{ $link(['seite' => $listing['page'] - 1]) }}" rel="prev">Zurück</a>
|
||||
@endif
|
||||
<span>Seite {{ $listing['page'] }} von {{ $listing['pages'] }}</span>
|
||||
@if ($listing['page'] < $listing['pages'])
|
||||
<a href="{{ $link(['seite' => $listing['page'] + 1]) }}" rel="next">Weiter</a>
|
||||
@endif
|
||||
</nav>
|
||||
@endif
|
||||
@@ -0,0 +1,31 @@
|
||||
{{--
|
||||
Ein Produkt in der Listenansicht. Die Zeile trägt dieselben Angaben wie die Kachel: kleines Bild oder Symbol, Art,
|
||||
Marker mit Wort, Titel als Link, Kurztext, Themen und Preis.
|
||||
--}}
|
||||
<li class="shop-row">
|
||||
<div class="shop-row-media @if ($card['image'] === null) is-placeholder @endif" aria-hidden="true">
|
||||
@if ($card['image'] !== null)
|
||||
<img src="{{ $card['image']['url'] }}" alt="" loading="lazy" decoding="async">
|
||||
@elseif ($card['symbol'] !== null)
|
||||
<x-brand.symbol :name="$card['symbol']" class="shop-row-symbol" />
|
||||
@endif
|
||||
</div>
|
||||
<div class="shop-row-body">
|
||||
<p class="shop-tile-kind">
|
||||
@if ($card['kind_label'] !== '')<span>{{ $card['kind_label'] }}</span>@endif
|
||||
@foreach ($card['markers'] as $marker)
|
||||
<span class="shop-marker shop-marker-{{ $marker['key'] }}">{{ $marker['label'] }}</span>
|
||||
@endforeach
|
||||
</p>
|
||||
<h2><a href="{{ $card['url'] }}">{{ $card['title'] }}</a></h2>
|
||||
@if ($card['teaser'] !== '')<p class="shop-tile-teaser">{{ $card['teaser'] }}</p>@endif
|
||||
@if ($card['pillars'] !== [])
|
||||
<ul class="shop-tile-pillars" aria-label="Themen">
|
||||
@foreach (array_slice($card['pillars'], 0, 3) as $pillar)
|
||||
<li>{{ $pillar }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
@endif
|
||||
</div>
|
||||
<p class="shop-row-price">ab {{ $card['from'] }}<span>{{ $card['count'] }} {{ $card['count'] === 1 ? 'Lizenzoption' : 'Lizenzoptionen' }}</span></p>
|
||||
</li>
|
||||
@@ -3,12 +3,20 @@
|
||||
Darstellung nach tatsächlicher Containerbreite: unter 540 px gestapelt, 540–899 px flacher Bildstreifen,
|
||||
ab 900 px zweispaltig mit Bild links oder rechts (Variante). Die Höhe ändert Bildproportion und Abstände,
|
||||
nie die zulässige Textmenge. Der Text ist bereits bereinigter formatierter Text (RichText::sanitize).
|
||||
Der Bildanteil (imageShare) gilt nur im zweispaltigen Stand. Ohne Text, Überschrift, Label und Schaltflächen
|
||||
(hasCopy) steht das Bild allein über die ganze Breite. Ein freigegebenes Video (video.url, CardClip) liegt über dem
|
||||
Bild und spielt dort wie auf der Medienkarte (resources/js/card-clip.js); ohne freigegebenen Clip bleibt es beim Bild.
|
||||
--}}
|
||||
@php
|
||||
$side = $variant === 'image_left' ? 'left' : 'right';
|
||||
$heightClass = in_array($height, ['compact', 'normal', 'spacious'], true) ? $height : 'normal';
|
||||
$tag = \App\Domain\Cms\Widgets\Support\PremiumFields::headingTag($settings, ! empty($first));
|
||||
$hasCopy = $hasCopy ?? true;
|
||||
$imageShare = $imageShare ?? null;
|
||||
$clipUrl = $imageUrl ? ($video['url'] ?? null) : null;
|
||||
$clipTitle = (string) ($video['title'] ?? '');
|
||||
@endphp
|
||||
@if ($imageUrl || $hasCopy)
|
||||
<div class="lf-bt-host">
|
||||
<div @class([
|
||||
'lf-bt',
|
||||
@@ -16,7 +24,11 @@
|
||||
'lf-bt--image-'.$side,
|
||||
'lf-bt--height-'.$heightClass,
|
||||
'lf-bt--without-image' => ! $imageUrl,
|
||||
'lf-bt--without-text' => ! $hasCopy,
|
||||
'lf-bt--shared' => $imageShare !== null && $imageUrl && $hasCopy,
|
||||
'lf-bt--share-'.$imageShare => $imageShare !== null && $imageUrl && $hasCopy,
|
||||
]) style="--bt-focus-x: {{ $focus['x'] }}%; --bt-focus-y: {{ $focus['y'] }}%">
|
||||
@if ($hasCopy)
|
||||
<div class="lf-bt__copy">
|
||||
@php($lead = \App\Domain\Cms\Widgets\Support\HeadingAccent::lead($settings))
|
||||
@if ($lead['side'] !== null)<div class="lf-lead lf-lead--{{ $lead['side'] }} lf-lead--{{ $lead['align'] }}"><x-brand.symbol :name="$lead['symbol']" class="lf-lead__symbol" /><div class="lf-lead__body">@endif
|
||||
@@ -41,11 +53,17 @@
|
||||
@endif
|
||||
@if ($lead['side'] !== null)</div></div>@endif
|
||||
</div>
|
||||
@endif
|
||||
@if ($imageUrl)
|
||||
<div class="lf-bt__media">
|
||||
<div class="lf-bt__media" @if ($clipUrl !== null) data-card-clip data-clip-src="{{ $clipUrl }}" data-clip-title="{{ $clipTitle }}" @endif>
|
||||
<img class="lf-bt__image" src="{{ $imageUrl }}" alt="{{ $imageAlt ?? '' }}" @if (! empty($first)) loading="eager" fetchpriority="high" @else loading="lazy" @endif decoding="async">
|
||||
@include('widgets.partials.card-clip')
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@include('widgets.partials.image-notice')
|
||||
@if ($context->preview && ! empty($video['notice']))
|
||||
<p class="preview-note">{{ $video['notice'] }}</p>
|
||||
@endif
|
||||
@@ -1,6 +1,6 @@
|
||||
{{--
|
||||
Shop-Produkte (ADR-55). Die Kacheln kommen aus ShopCatalog, nichts davon wird im CMS gespeichert. Ist der Shop nicht
|
||||
sichtbar, bleibt der Abschnitt öffentlich leer; die Redaktionsvorschau zeigt einen Hinweis.
|
||||
Shop-Produkte (ADR-55, ADR-57). Die Produkte kommen aus ShopCatalog, nichts davon wird im CMS gespeichert. Ist der Shop
|
||||
nicht sichtbar, bleibt der Abschnitt öffentlich leer; die Redaktionsvorschau zeigt einen Hinweis.
|
||||
--}}
|
||||
@if ($shopVisible || $context->preview)
|
||||
<div class="shop-products">
|
||||
@@ -13,29 +13,17 @@
|
||||
@unless ($shopVisible)
|
||||
<p class="preview-note">Der Shop ist zurzeit nicht sichtbar. Öffentlich erscheint dieser Abschnitt nicht.</p>
|
||||
@else
|
||||
@if (($settings['search'] ?? 'aus') === 'an')
|
||||
<form class="shop-search" method="get" action="{{ route('shop') }}" role="search">
|
||||
@if (($settings['search'] ?? 'aus') === 'an' && ($settings['filter'] ?? 'aus') !== 'an')
|
||||
<form class="shop-search" method="get" action="{{ url()->current() }}" role="search">
|
||||
<label for="shop-suche-{{ $widget['id'] ?? 'w' }}">Shop durchsuchen</label>
|
||||
<input id="shop-suche-{{ $widget['id'] ?? 'w' }}" type="search" name="suche" value="{{ $term }}" autocomplete="off">
|
||||
<input id="shop-suche-{{ $widget['id'] ?? 'w' }}" type="search" name="suche" value="{{ $term }}" maxlength="100" autocomplete="off">
|
||||
<button class="button" type="submit">Suchen</button>
|
||||
@if ($term !== '')
|
||||
<a class="button button-quiet" href="{{ route('shop') }}">Suche zurücksetzen</a>
|
||||
<a class="button button-quiet" href="{{ url()->current() }}">Suche zurücksetzen</a>
|
||||
@endif
|
||||
</form>
|
||||
@endif
|
||||
@if ($cards === [])
|
||||
<div class="empty">
|
||||
<h3>{{ $term !== '' ? 'Keine Treffer' : 'Noch keine kaufbaren Produkte' }}</h3>
|
||||
<p>{{ $term !== '' ? 'Zu „'.$term.'“ gibt es keine kaufbaren Produkte. Prüfe die Schreibweise oder setze die Suche zurück.' : 'Sobald ein Angebot aktiv ist, erscheint es hier.' }}</p>
|
||||
</div>
|
||||
@else
|
||||
<p class="shop-count" role="status">{{ count($cards) }} {{ count($cards) === 1 ? 'Produkt' : 'Produkte' }}</p>
|
||||
<ul class="shop-tiles">
|
||||
@foreach ($cards as $card)
|
||||
@include('shop.kachel', ['card' => $card])
|
||||
@endforeach
|
||||
</ul>
|
||||
@endif
|
||||
@include('shop.liste', ['listing' => $listing, 'action' => url()->current(), 'uid' => $widget['id'] ?? 'w'])
|
||||
@endunless
|
||||
</div>
|
||||
@endif
|
||||
@@ -0,0 +1,354 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Domain\Catalog\ContentElement;
|
||||
use App\Domain\Catalog\ContentService;
|
||||
use App\Domain\Catalog\EditorialContentKind;
|
||||
use App\Domain\Cms\Page;
|
||||
use App\Domain\Cms\PageRevision;
|
||||
use App\Domain\Cms\PageService;
|
||||
use App\Domain\Cms\Widgets\Support\CardClip;
|
||||
use App\Domain\Cms\Widgets\Support\WebsiteImage;
|
||||
use App\Domain\Cms\Widgets\Types\ImageTextWidget;
|
||||
use App\Domain\Cms\Widgets\WidgetRegistry;
|
||||
use App\Domain\Media\PresentationFile;
|
||||
use App\Domain\Media\WebsiteMedia;
|
||||
use App\Domain\Media\WebsiteRelease;
|
||||
use App\Filament\Resources\Pages\Pages\EditPage;
|
||||
use App\Models\User;
|
||||
use Filament\Actions\Testing\TestAction;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Livewire\Livewire;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* Bild und Text: Bildanteil, Bild ohne Text und ein Video, das auf dem Bild beim Überfahren und per Klick spielt
|
||||
* (CardClip, wie auf der Medienkarte). Öffentlich spielt nur ein für die Website freigegebener Clip.
|
||||
*/
|
||||
class CmsImageTextMediaTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
Storage::fake('cms_incoming');
|
||||
Storage::fake('media_derived');
|
||||
Storage::fake('media_public');
|
||||
Storage::fake('media_originals');
|
||||
}
|
||||
|
||||
public function test_without_a_share_the_layout_is_unchanged_and_each_share_sets_its_own_class(): void
|
||||
{
|
||||
$image = $this->image('Foto Pause');
|
||||
$this->release($image);
|
||||
|
||||
$default = $this->publish('/anteil-vorgabe', $this->widget(['body' => '<p>Text</p>'], ['image' => $image->id]));
|
||||
$this->assertStringContainsString('class="lf-bt lf-bt--cream lf-bt--image-left lf-bt--height-normal"', $default, 'Ohne Einstellung ändert sich die Darstellung gespeicherter Seiten nicht.');
|
||||
$this->assertStringNotContainsString('lf-bt--share', $default);
|
||||
|
||||
foreach (array_keys(ImageTextWidget::IMAGE_SHARE) as $share) {
|
||||
$html = $this->publish('/anteil-'.str_replace('_', '-', $share), $this->widget(['body' => '<p>Text</p>'], ['image' => $image->id], ['image_share' => $share]));
|
||||
$this->assertStringContainsString('lf-bt--shared lf-bt--share-'.$share, $html, $share);
|
||||
}
|
||||
}
|
||||
|
||||
public function test_the_share_is_ignored_without_image_or_without_text_and_unknown_values_are_rejected(): void
|
||||
{
|
||||
$image = $this->image('Foto Pause');
|
||||
$this->release($image);
|
||||
|
||||
$noImage = $this->publish('/anteil-ohne-bild', $this->widget(['body' => '<p>Text</p>'], [], ['image_share' => 'half']));
|
||||
$this->assertStringNotContainsString('lf-bt--share', $noImage);
|
||||
|
||||
$noText = $this->publish('/anteil-ohne-text', $this->widget([], ['image' => $image->id], ['image_share' => 'half']));
|
||||
$this->assertStringNotContainsString('lf-bt--share', $noText);
|
||||
|
||||
try {
|
||||
app(WidgetRegistry::class)->normalize($this->widget(['body' => '<p>Text</p>'], [], ['image_share' => 'dreiviertel'])[0]['slots']);
|
||||
$this->fail('Angenommen: unbekannter Bildanteil');
|
||||
} catch (ValidationException $exception) {
|
||||
$this->assertStringContainsString('nicht freigegeben', implode(' ', array_merge(...array_values($exception->errors()))));
|
||||
}
|
||||
|
||||
$this->assertNull(ImageTextWidget::imageShare(['image_share' => ['half']]));
|
||||
$this->assertSame('third', ImageTextWidget::imageShare(['image_share' => 'third']));
|
||||
}
|
||||
|
||||
public function test_an_image_can_stand_alone_without_any_text(): void
|
||||
{
|
||||
$image = $this->image('Foto Pause');
|
||||
$this->release($image);
|
||||
|
||||
$html = $this->publish('/nur-bild', $this->widget([], ['image' => $image->id], [], ['alt' => 'Gruppe im Park']));
|
||||
|
||||
$this->assertStringContainsString('lf-bt--without-text', $html);
|
||||
$this->assertStringNotContainsString('lf-bt__copy', $html, 'Ohne Text gibt es keine leere Textspalte.');
|
||||
$this->assertStringContainsString('<img class="lf-bt__image" src="'.route('website.media', $image).'" alt="Gruppe im Park"', $html);
|
||||
|
||||
$normalized = app(WidgetRegistry::class)->normalize($this->widget([], ['image' => $image->id])[0]['slots']);
|
||||
$this->assertSame($image->id, $normalized[0]['refs']['image']);
|
||||
}
|
||||
|
||||
public function test_a_widget_with_neither_text_nor_image_is_rejected_but_any_text_part_is_enough_without_image(): void
|
||||
{
|
||||
try {
|
||||
app(WidgetRegistry::class)->normalize($this->widget([])[0]['slots']);
|
||||
$this->fail('Angenommen: leeres Widget');
|
||||
} catch (ValidationException $exception) {
|
||||
$this->assertArrayHasKey('blocks.0.data.body', $exception->errors());
|
||||
$this->assertStringContainsString('Text eingeben oder ein Bild wählen', $exception->errors()['blocks.0.data.body'][0]);
|
||||
}
|
||||
|
||||
foreach ([['title' => 'Nur Überschrift'], ['eyebrow' => 'Nur Label'], ['cta_label' => 'Los', 'cta_url' => '/los'], ['body' => '<p>Nur Text</p>']] as $data) {
|
||||
$normalized = app(WidgetRegistry::class)->normalize($this->widget($data)[0]['slots']);
|
||||
$this->assertNotEmpty($normalized, json_encode($data));
|
||||
}
|
||||
}
|
||||
|
||||
public function test_the_released_trailer_plays_on_the_image_on_hover_and_click(): void
|
||||
{
|
||||
$film = $this->clip('Teaser Pause');
|
||||
$image = $this->image('Foto Pause');
|
||||
$this->release($film);
|
||||
$this->release($image);
|
||||
|
||||
$html = $this->publish('/bild-video', $this->widget(['body' => '<p>Text</p>'], ['image' => $image->id, 'video' => $film->id]));
|
||||
|
||||
$this->assertMatchesRegularExpression('~<div class="lf-bt__media"\s+data-card-clip data-clip-src="'.preg_quote(route('website.media', $film), '~').'" data-clip-title="[^"]+"\s*>~', $html);
|
||||
$this->assertStringContainsString('<video class="lf-pc__clip" muted loop playsinline preload="none"', $html, 'Stumm, in Schleife, nichts wird vorab geladen.');
|
||||
$this->assertDoesNotMatchRegularExpression('/<video[^>]* src=/', $html, 'Die Quelle wird erst beim ersten Start gesetzt.');
|
||||
$this->assertStringNotContainsString('autoplay', $html);
|
||||
$this->assertStringContainsString('data-clip-toggle', $html, 'Die Schaltfläche steht für Tastatur und Handy bereit.');
|
||||
$this->assertStringContainsString('lf-bt__image', $html, 'Das Bild bleibt stehen, bis das Video startet.');
|
||||
$this->assertStringNotContainsString('originals/', $html);
|
||||
}
|
||||
|
||||
public function test_an_image_with_a_video_can_also_stand_without_text(): void
|
||||
{
|
||||
$film = $this->clip('Teaser Pause');
|
||||
$image = $this->image('Foto Pause');
|
||||
$this->release($film);
|
||||
$this->release($image);
|
||||
|
||||
$html = $this->publish('/bild-video-allein', $this->widget([], ['image' => $image->id, 'video' => $film->id], [], ['alt' => 'Pause']));
|
||||
|
||||
$this->assertStringContainsString('lf-bt--without-text', $html);
|
||||
$this->assertStringContainsString('data-card-clip', $html);
|
||||
}
|
||||
|
||||
public function test_an_unreleased_video_is_not_played_publicly_and_explained_in_the_preview(): void
|
||||
{
|
||||
$film = $this->clip('Teaser Pause');
|
||||
$image = $this->image('Foto Pause');
|
||||
$this->release($image);
|
||||
|
||||
$revision = $this->publishRevision('/bild-video-offen', $this->widget(['body' => '<p>Text</p>'], ['image' => $image->id, 'video' => $film->id]));
|
||||
|
||||
$public = $this->get('/bild-video-offen')->assertOk()->getContent();
|
||||
$this->assertStringNotContainsString('data-card-clip', $public);
|
||||
$this->assertStringNotContainsString('<video', $public);
|
||||
$this->assertStringNotContainsString('freigegebenes Video', $public, 'Hinweise für die Redaktion erscheinen öffentlich nie.');
|
||||
|
||||
$preview = $this->actingAs(User::factory()->redakteur()->create(), 'staff')->get(route('pages.preview', $revision))->assertOk()->getContent();
|
||||
$this->assertStringNotContainsString('<video', $preview);
|
||||
$this->assertStringContainsString('kein für die Website freigegebenes Video', $preview);
|
||||
}
|
||||
|
||||
public function test_withdrawing_the_release_takes_the_video_off_the_page(): void
|
||||
{
|
||||
$film = $this->clip('Teaser Pause');
|
||||
$image = $this->image('Foto Pause');
|
||||
$this->release($film);
|
||||
$this->release($image);
|
||||
$this->publish('/bild-video-zurueck', $this->widget(['body' => '<p>Text</p>'], ['image' => $image->id, 'video' => $film->id]));
|
||||
$this->assertStringContainsString('data-card-clip', $this->get('/bild-video-zurueck')->getContent());
|
||||
|
||||
app(WebsiteRelease::class)->withdraw($film->fresh());
|
||||
$this->flushScoped();
|
||||
|
||||
$this->assertStringNotContainsString('data-card-clip', $this->get('/bild-video-zurueck')->assertOk()->getContent());
|
||||
}
|
||||
|
||||
public function test_a_video_needs_an_image_to_stand_on(): void
|
||||
{
|
||||
$film = $this->clip('Teaser Pause');
|
||||
$this->release($film);
|
||||
|
||||
try {
|
||||
app(WidgetRegistry::class)->normalize($this->widget(['body' => '<p>Text</p>'], ['video' => $film->id])[0]['slots']);
|
||||
$this->fail('Angenommen: Video ohne Bild');
|
||||
} catch (ValidationException $exception) {
|
||||
$this->assertArrayHasKey('blocks.0.refs.image', $exception->errors());
|
||||
$this->assertStringContainsString('Bitte auch ein Bild wählen', $exception->errors()['blocks.0.refs.image'][0]);
|
||||
}
|
||||
}
|
||||
|
||||
public function test_the_video_choice_is_validated_and_dropped_when_empty(): void
|
||||
{
|
||||
$film = $this->clip('Teaser Pause');
|
||||
$image = $this->image('Foto Pause');
|
||||
$archived = $this->clip('Archiv Pause');
|
||||
$archived->forceFill(['archived_at' => now()])->save();
|
||||
$confidential = $this->publicFilm('traineranleitung');
|
||||
$registry = app(WidgetRegistry::class);
|
||||
|
||||
$normalized = $registry->normalize($this->widget(['body' => '<p>Text</p>'], ['image' => $image->id, 'video' => $film->id])[0]['slots']);
|
||||
$this->assertSame($film->id, $normalized[0]['refs']['video']);
|
||||
|
||||
$without = $registry->normalize($this->widget(['body' => '<p>Text</p>'], ['image' => $image->id, 'video' => null])[0]['slots']);
|
||||
$this->assertArrayNotHasKey('video', $without[0]['refs'], 'Ohne Wahl bleibt die gespeicherte Form wie bisher.');
|
||||
|
||||
foreach (['kein Film' => $image->id, 'archiviert' => $archived->id, 'Traineranleitung' => $confidential->id, 'unbekannt' => 999999] as $case => $id) {
|
||||
try {
|
||||
$registry->normalize($this->widget(['body' => '<p>Text</p>'], ['image' => $image->id, 'video' => $id])[0]['slots']);
|
||||
$this->fail('Angenommen: '.$case);
|
||||
} catch (ValidationException $exception) {
|
||||
$this->assertArrayHasKey('blocks.0.refs.video', $exception->errors(), $case);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function test_a_video_is_chosen_through_the_shared_picker_which_offers_only_films(): void
|
||||
{
|
||||
$film = $this->clip('Teaser Pause');
|
||||
$image = $this->image('Foto Pause');
|
||||
$confidential = $this->publicFilm('traineranleitung');
|
||||
$page = Page::query()->firstOrCreate(['path' => '/video-picker']);
|
||||
app(PageService::class)->saveRevision($page, $this->widget(['body' => '<p>Text</p>']), 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('openWebsiteVideoPicker', 'mountedActions.0.data.refs.image')
|
||||
->assertSet('pickerOpen', false)
|
||||
->call('openWebsiteVideoPicker', 'mountedActions.0.data.refs.video')
|
||||
->assertSet('pickerOpen', true)
|
||||
->assertSet('pickerPurpose', 'website-video')
|
||||
->assertSet('pickerKind', 'film')
|
||||
->assertSee('Video aus dem Medienmanager')
|
||||
->assertSee('Teaser Pause');
|
||||
|
||||
$items = collect($component->instance()->pickerResult()['items']);
|
||||
$this->assertNotNull($items->firstWhere('element_id', $film->id), 'Der Film erscheint im gemeinsamen Picker.');
|
||||
$this->assertNull($items->firstWhere('element_id', $image->id), 'Bilder erscheinen im Videowähler nicht.');
|
||||
$this->assertNull($items->firstWhere('element_id', $confidential->id), 'Traineranleitungen sind nicht wählbar.');
|
||||
|
||||
$component->call('markPicker', $items->firstWhere('element_id', $film->id)['target'], true)
|
||||
->call('confirmPicker')
|
||||
->assertSet('pickerOpen', false)
|
||||
->assertSet('mountedActions.0.data.refs.video', $film->id);
|
||||
|
||||
// Der Bildwähler bleibt beim Bild.
|
||||
$component->call('openWebsiteImagePicker', 'mountedActions.0.data.refs.image')
|
||||
->assertSet('pickerPurpose', 'website-bild')
|
||||
->assertSet('pickerKind', 'bild');
|
||||
}
|
||||
|
||||
public function test_an_older_saved_widget_without_the_new_fields_renders_as_before(): void
|
||||
{
|
||||
$html = $this->publish('/bild-text-alt', [['layout' => 'u4', 'style' => [], 'slots' => [
|
||||
['type' => 'image_text', 'v' => 3, 'variant' => 'image_right', 'settings' => ['surface' => 'cream'], 'data' => ['title' => 'Alt', 'body' => '<p>Bestand</p>'], 'refs' => ['image' => 'cms/park.jpg']],
|
||||
]]]);
|
||||
|
||||
$this->assertStringContainsString('class="lf-bt lf-bt--cream lf-bt--image-right lf-bt--height-normal"', $html);
|
||||
$this->assertStringNotContainsString('data-card-clip', $html);
|
||||
$this->assertStringContainsString('<p>Bestand</p>', $html);
|
||||
}
|
||||
|
||||
public function test_the_widget_summary_names_an_image_only_widget(): void
|
||||
{
|
||||
$widget = app(WidgetRegistry::class)->get('image_text');
|
||||
|
||||
$this->assertSame('Bild: Gruppe im Park', $widget->summary(['data' => ['alt' => 'Gruppe im Park']]));
|
||||
$this->assertSame('Bild', $widget->summary(['data' => []]));
|
||||
$this->assertSame('Titel', $widget->summary(['data' => ['title' => 'Titel']]));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $data
|
||||
* @param array<string, mixed> $refs
|
||||
* @param array<string, mixed> $settings
|
||||
* @return list<array<string, mixed>>
|
||||
*/
|
||||
private function widget(array $data, array $refs = [], array $settings = [], array $more = []): array
|
||||
{
|
||||
return [['layout' => 'u4', 'style' => [], 'slots' => [
|
||||
['type' => 'image_text', 'v' => 3, 'variant' => 'image_left', 'settings' => $settings, 'data' => $data + $more, 'refs' => $refs],
|
||||
]]];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<array<string, mixed>> $sections
|
||||
*/
|
||||
private function publishRevision(string $path, array $sections): PageRevision
|
||||
{
|
||||
$page = Page::query()->create(['path' => $path]);
|
||||
$service = app(PageService::class);
|
||||
$revision = $service->saveRevision($page, $sections, null, null, null);
|
||||
$service->publish($page, $revision);
|
||||
|
||||
return $revision;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<array<string, mixed>> $sections
|
||||
*/
|
||||
private function publish(string $path, array $sections): string
|
||||
{
|
||||
$this->publishRevision($path, $sections);
|
||||
|
||||
return $this->get($path)->assertOk()->getContent();
|
||||
}
|
||||
|
||||
private function publicFilm(string $kind = 'unterrichtsfilm'): ContentElement
|
||||
{
|
||||
$film = app(ContentService::class)->createElement('film', 'film', 'Denkpause Rohschnitt');
|
||||
$film->forceFill(['editorial_content_kind_id' => EditorialContentKind::query()->where('slug', $kind)->value('id')])->save();
|
||||
|
||||
return $film->refresh();
|
||||
}
|
||||
|
||||
private function clip(string $title): ContentElement
|
||||
{
|
||||
return $this->presentation('film', $title, '0123456789abcdefghij', 'mp4');
|
||||
}
|
||||
|
||||
private function image(string $title): ContentElement
|
||||
{
|
||||
return $this->presentation('bild', $title, 'bild-bytes', 'jpg');
|
||||
}
|
||||
|
||||
private function presentation(string $output, string $title, string $bytes, string $extension): ContentElement
|
||||
{
|
||||
$path = 'inhalte/'.md5($title).'.'.$extension;
|
||||
Storage::disk('cms_incoming')->put($path, $bytes);
|
||||
$element = app(ContentService::class)->createElement($output, $output, $title);
|
||||
$element->display_title = $title;
|
||||
$element->save();
|
||||
app(PresentationFile::class)->store($element, $path);
|
||||
|
||||
return $element->fresh();
|
||||
}
|
||||
|
||||
private function release(ContentElement $element): void
|
||||
{
|
||||
app(WebsiteRelease::class)->release($element->fresh());
|
||||
$this->flushScoped();
|
||||
}
|
||||
|
||||
private function flushScoped(): void
|
||||
{
|
||||
foreach ([WebsiteImage::class, CardClip::class, WebsiteMedia::class] as $class) {
|
||||
$this->app->forgetInstance($class);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,181 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Domain\Catalog\EditorialContentKind;
|
||||
use App\Domain\Catalog\PillarService;
|
||||
use App\Domain\Cms\Page;
|
||||
use App\Domain\Cms\PageService;
|
||||
use App\Domain\Commerce\ShopCatalog;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\Support\BuildsShop;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* Viele Produkte (ADR-57): Auswahl nach Thema, Materialart, Eignung und Nutzerkreis, Reihenfolge, Ansicht (Kacheln oder
|
||||
* Liste) und Seiten. Alles kommt aus dem Abfragetext und wird gegen feste Werte geprüft.
|
||||
*/
|
||||
class ShopListingTest extends TestCase
|
||||
{
|
||||
use BuildsShop;
|
||||
use RefreshDatabase;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->seedShop();
|
||||
}
|
||||
|
||||
/** Zwei Säulen, je ein Artikel; zwei Materialarten. */
|
||||
private function classify(): array
|
||||
{
|
||||
$service = app(PillarService::class);
|
||||
$grenzen = $service->create('Grenzen');
|
||||
$service->present($grenzen, 'Grenzen', 'grenzen-saeule', null, true, 10);
|
||||
$konflikte = $service->create('Konfliktklärung');
|
||||
$service->present($konflikte, 'Konfliktklärung', 'konfliktklaerung', null, true, 20);
|
||||
$service->assign($this->article('shop-grenzen'), [$grenzen->id]);
|
||||
$service->assign($this->article('shop-konflikte'), [$konflikte->id]);
|
||||
$programm = EditorialContentKind::query()->where('slug', 'programm')->firstOrFail();
|
||||
$modul = EditorialContentKind::query()->where('slug', 'modul')->firstOrFail();
|
||||
$this->article('shop-grenzen')->forceFill(['editorial_content_kind_id' => $programm->id])->save();
|
||||
$this->article('shop-konflikte')->forceFill(['editorial_content_kind_id' => $modul->id])->save();
|
||||
|
||||
return [$grenzen, $konflikte, $programm, $modul];
|
||||
}
|
||||
|
||||
private function titles(array $listing): array
|
||||
{
|
||||
return array_column($listing['cards'], 'title');
|
||||
}
|
||||
|
||||
public function test_the_choices_offer_only_values_that_exist_and_only_when_there_is_a_real_choice(): void
|
||||
{
|
||||
[$grenzen, $konflikte, $programm, $modul] = $this->classify();
|
||||
$facets = app(ShopCatalog::class)->listing([])['facets'];
|
||||
|
||||
$this->assertSame([$grenzen->id => 'Grenzen', $konflikte->id => 'Konfliktklärung'], $facets['pillar']);
|
||||
$this->assertEquals([$programm->id => $programm->label, $modul->id => $modul->label], $facets['kind']);
|
||||
$this->assertArrayHasKey('person', $facets['holder']);
|
||||
$this->assertArrayHasKey('organisation', $facets['holder']);
|
||||
|
||||
$html = $this->get(route('shop'))->assertOk()->getContent();
|
||||
$this->assertStringContainsString('name="saeule"', $html);
|
||||
$this->assertStringContainsString('name="art"', $html);
|
||||
$this->assertStringContainsString('name="eignung"', $html);
|
||||
$this->assertStringContainsString('name="sort"', $html);
|
||||
}
|
||||
|
||||
public function test_a_choice_narrows_the_list_and_unknown_or_junk_values_are_ignored(): void
|
||||
{
|
||||
[$grenzen, , , $modul] = $this->classify();
|
||||
$catalog = app(ShopCatalog::class);
|
||||
|
||||
$this->assertSame(['Grenzen setzen im Verein'], $this->titles($catalog->listing(['saeule' => (string) $grenzen->id])));
|
||||
$this->assertSame(['Konflikte im Training'], $this->titles($catalog->listing(['art' => (string) $modul->id])));
|
||||
$this->assertCount(3, $catalog->listing(['saeule' => '999999'])['cards'], 'Eine unbekannte Säule filtert nichts.');
|
||||
$this->assertCount(3, $catalog->listing(['saeule' => '1 OR 1=1', 'art' => '../x', 'eignung' => 'alle', 'kreis' => '<script>'])['cards']);
|
||||
$this->assertSame(3, $catalog->listing(['saeule' => ['1'], 'suche' => ['x'], 'sort' => ['name'], 'seite' => ['9'], 'ansicht' => ['liste']])['total'], 'Felder als Liste werden ignoriert, nie ein Fehler.');
|
||||
$this->get(route('shop', ['saeule' => ['1'], 'suche' => ['x'], 'seite' => ['2']]))->assertOk();
|
||||
}
|
||||
|
||||
public function test_holder_and_licence_scope_filter_by_the_options_a_product_has(): void
|
||||
{
|
||||
$this->classify();
|
||||
$catalog = app(ShopCatalog::class);
|
||||
|
||||
$organisation = $catalog->listing(['eignung' => 'organisation']);
|
||||
$this->assertContains('Konflikte im Training', $this->titles($organisation), 'Die Vereinslizenz gehört zu Konflikte im Training.');
|
||||
$this->assertNotContains('Starterpaket', $this->titles($organisation), 'Das Starterpaket gibt es nur für Privatpersonen.');
|
||||
|
||||
$person = $catalog->listing(['eignung' => 'person']);
|
||||
$this->assertContains('Starterpaket', $this->titles($person));
|
||||
}
|
||||
|
||||
public function test_the_order_can_be_chosen_and_an_unknown_order_is_ignored(): void
|
||||
{
|
||||
$catalog = app(ShopCatalog::class);
|
||||
|
||||
$this->assertSame(['Grenzen setzen im Verein', 'Konflikte im Training', 'Starterpaket'], $this->titles($catalog->listing(['sort' => 'name'])));
|
||||
$this->assertSame(['Grenzen setzen im Verein', 'Konflikte im Training', 'Starterpaket'], $this->titles($catalog->listing(['sort' => 'preis'])));
|
||||
$this->assertSame($this->titles($catalog->listing([])), $this->titles($catalog->listing(['sort' => 'zufall'])));
|
||||
}
|
||||
|
||||
public function test_the_list_is_split_into_pages_and_a_page_number_is_clamped(): void
|
||||
{
|
||||
config(['shop.per_page' => 2]);
|
||||
$catalog = app(ShopCatalog::class);
|
||||
|
||||
$first = $catalog->listing([]);
|
||||
$this->assertSame([2, 1, 2, 3], [count($first['cards']), $first['page'], $first['pages'], $first['total']]);
|
||||
$this->assertCount(1, $catalog->listing(['seite' => '2'])['cards']);
|
||||
$this->assertSame(2, $catalog->listing(['seite' => '99'])['page']);
|
||||
$this->assertSame(1, $catalog->listing(['seite' => '-4'])['page']);
|
||||
$this->assertSame(1, $catalog->listing(['seite' => 'abc'])['page']);
|
||||
|
||||
$page = $this->get(route('shop'))->assertOk();
|
||||
$page->assertSee('Seite 1 von 2')->assertSee('rel="next"', false)->assertDontSee('rel="prev"', false);
|
||||
$this->get(route('shop', ['seite' => 2]))->assertOk()->assertSee('rel="prev"', false)->assertDontSee('rel="next"', false);
|
||||
}
|
||||
|
||||
public function test_page_links_keep_the_choice_and_the_view(): void
|
||||
{
|
||||
config(['shop.per_page' => 1]);
|
||||
$html = $this->get(route('shop', ['sort' => 'preis', 'ansicht' => 'liste']))->assertOk()->getContent();
|
||||
|
||||
$this->assertStringContainsString('sort=preis', $html);
|
||||
$this->assertMatchesRegularExpression('#rel="next"#', $html);
|
||||
$this->assertMatchesRegularExpression('#href="[^"]*ansicht=liste[^"]*seite=2[^"]*"|href="[^"]*seite=2[^"]*ansicht=liste[^"]*"#', $html);
|
||||
}
|
||||
|
||||
public function test_the_view_can_be_switched_between_tiles_and_list_and_the_list_carries_the_same_facts(): void
|
||||
{
|
||||
$this->classify();
|
||||
$tiles = $this->get(route('shop'))->assertOk();
|
||||
$tiles->assertSee('class="shop-tiles"', false)->assertDontSee('class="shop-rows"', false);
|
||||
|
||||
$list = $this->get(route('shop', ['ansicht' => 'liste']))->assertOk();
|
||||
$list->assertSee('class="shop-rows"', false)->assertDontSee('class="shop-tiles"', false)
|
||||
->assertSee('Konflikte im Training')->assertSee('ab 49,00 €')->assertSee('2 Lizenzoptionen')->assertSee('Konfliktklärung')
|
||||
->assertSee('aria-current="true"', false);
|
||||
$this->get(route('shop', ['ansicht' => 'quatsch']))->assertOk()->assertSee('class="shop-tiles"', false);
|
||||
}
|
||||
|
||||
public function test_the_filter_form_is_accessible_and_escapes_the_search_text(): void
|
||||
{
|
||||
$html = $this->get(route('shop', ['suche' => '"><script>alert(1)</script>']))->assertOk()->getContent();
|
||||
|
||||
$this->assertStringNotContainsString('<script>alert(1)</script>', $html);
|
||||
$this->assertMatchesRegularExpression('#<label for="shop-suche-seite">Shop durchsuchen</label>#', $html);
|
||||
$this->assertMatchesRegularExpression('#<label for="shop-sort-seite">Reihenfolge</label>#', $html);
|
||||
$this->assertStringContainsString('role="search"', $html);
|
||||
$this->assertStringContainsString('Keine Treffer', $html);
|
||||
}
|
||||
|
||||
public function test_an_empty_choice_shows_an_honest_empty_state_with_a_way_back(): void
|
||||
{
|
||||
[$grenzen] = $this->classify();
|
||||
|
||||
$this->get(route('shop', ['saeule' => $grenzen->id, 'suche' => 'gibt-es-nicht']))->assertOk()
|
||||
->assertSee('Keine Treffer')->assertSee('Zurücksetzen');
|
||||
}
|
||||
|
||||
public function test_the_widget_offers_the_choice_only_when_asked_and_keeps_its_fixed_filters(): void
|
||||
{
|
||||
[$grenzen] = $this->classify();
|
||||
$widget = fn (array $settings, array $data = [], string $variant = 'kacheln'): array => ['type' => 'shop_products', 'v' => 1, 'variant' => $variant, 'settings' => $settings, 'data' => $data];
|
||||
$service = app(PageService::class);
|
||||
$page = Page::query()->create(['path' => '/auswahl']);
|
||||
$service->publish($page, $service->saveRevision($page, [['layout' => 'u4', 'style' => [], 'slots' => [$widget(['filter' => 'an'], [], 'liste')]]], null, null, null));
|
||||
$plain = Page::query()->create(['path' => '/ohne-auswahl']);
|
||||
$service->publish($plain, $service->saveRevision($plain, [['layout' => 'u4', 'style' => [], 'slots' => [$widget([])]]], null, null, null));
|
||||
$fixed = Page::query()->create(['path' => '/nur-grenzen']);
|
||||
$service->publish($fixed, $service->saveRevision($fixed, [['layout' => 'u4', 'style' => [], 'slots' => [$widget(['filter' => 'an'], ['pillar' => $grenzen->id])]]], null, null, null));
|
||||
|
||||
$this->get('/auswahl')->assertOk()->assertSee('name="saeule"', false)->assertSee('class="shop-rows"', false);
|
||||
$this->get('/auswahl?ansicht=kacheln')->assertOk()->assertSee('class="shop-tiles"', false);
|
||||
$this->get('/ohne-auswahl')->assertOk()->assertDontSee('name="saeule"', false)->assertDontSee('role="search"', false);
|
||||
$this->get('/nur-grenzen')->assertOk()->assertSee('Grenzen setzen im Verein')->assertDontSee('Starterpaket')
|
||||
->assertDontSee('name="saeule"', false);
|
||||
}
|
||||
}
|
||||
@@ -47,7 +47,7 @@ public function test_the_shop_search_filters_and_shows_an_empty_state(): void
|
||||
$this->get(route('shop', ['suche' => 'gibt-es-nicht']))
|
||||
->assertOk()
|
||||
->assertSee('Keine Treffer')
|
||||
->assertSee('Suche zurücksetzen');
|
||||
->assertSee('Zurücksetzen');
|
||||
}
|
||||
|
||||
public function test_the_product_page_shows_content_and_options_with_price_rights_and_term(): void
|
||||
|
||||