Web-Frontend: Kartenkomponenten auf PressRelease-Helper umgestellt (R4.3)

@php-Bloecke von feed-item, feed-top-item, focus-side-item, focus-hero,
kategorie, newsroom, release-detail, veroeffentlichen nutzen die neuen
Model-Helper — gerendertes Markup unveraendert (Web-Suite 215 gruen).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Kevin Adametz 2026-07-10 11:57:26 +00:00
parent 01e175e138
commit 3843e534da
8 changed files with 27 additions and 50 deletions

View file

@ -4,9 +4,7 @@
]) ])
@php @php
$category = $release?->category?->translations?->firstWhere('locale', app()->getLocale()) $categoryName = $release?->localizedCategoryName();
?? $release?->category?->translations?->first();
$categoryName = $category?->name;
$company = $release?->company?->name; $company = $release?->company?->name;
$city = $release?->company?->city ?? null; $city = $release?->company?->city ?? null;
$title = $release->title; $title = $release->title;

View file

@ -3,21 +3,16 @@
]) ])
@php @php
$category = $release?->category?->translations?->firstWhere('locale', app()->getLocale()) $categoryName = $release?->localizedCategoryName();
?? $release?->category?->translations?->first(); $imageUrl = $release?->cardImageUrl();
$categoryName = $category?->name;
$image = $release?->images?->first();
$imageUrl = $image?->variantUrl('card') ?? $image?->url();
$placeholderUrl = $imageUrl ? null : $release?->chosenPlaceholderUrl(); $placeholderUrl = $imageUrl ? null : $release?->chosenPlaceholderUrl();
$teaser = (string) \Illuminate\Support\Str::of(strip_tags((string) ($release?->text ?? '')))->squish()->limit(180); $teaser = $release?->teaserText(180) ?? '';
$company = $release?->company?->name; $company = $release?->company?->name;
$title = $release->title; $title = $release->title;
$href = route('release.detail', ['slug' => $release->slug]); $href = route('release.detail', ['slug' => $release->slug]);
$time = $release?->published_at?->isToday() $time = $release?->compactPublishedLabel();
? $release->published_at->format('H:i')
: ($release?->published_at?->isYesterday() ? __('web.shared.yesterday') : $release?->published_at?->isoFormat('D. MMM'));
$city = $release?->company?->city ?? null; $city = $release?->company?->city ?? null;
$readTime = max(1, (int) round(str_word_count(strip_tags((string) ($release?->text ?? ''))) / 200)); $readTime = $release?->readTimeMinutes() ?? 1;
@endphp @endphp
<article class="py-6 border-b border-bg-rule grid gap-6 grid-cols-1 md:grid-cols-[240px_1fr] group"> <article class="py-6 border-b border-bg-rule grid gap-6 grid-cols-1 md:grid-cols-[240px_1fr] group">

View file

@ -7,17 +7,14 @@
$sideReleases = collect($sideReleases)->take(4)->values(); $sideReleases = collect($sideReleases)->take(4)->values();
if ($leadRelease) { if ($leadRelease) {
$leadCategory = $leadRelease->category?->translations?->firstWhere('locale', app()->getLocale()) $leadCategoryName = $leadRelease->localizedCategoryName();
?? $leadRelease->category?->translations?->first(); $leadImageUrl = $leadRelease->cardImageUrl();
$leadCategoryName = $leadCategory?->name;
$leadImage = $leadRelease->images?->first();
$leadImageUrl = $leadImage?->variantUrl('card') ?? $leadImage?->url();
$leadPlaceholderUrl = $leadImageUrl ? null : $leadRelease->chosenPlaceholderUrl(); $leadPlaceholderUrl = $leadImageUrl ? null : $leadRelease->chosenPlaceholderUrl();
$leadTitle = $leadRelease->title; $leadTitle = $leadRelease->title;
$leadTeaser = (string) \Illuminate\Support\Str::of(strip_tags((string) $leadRelease->text))->squish()->limit(200); $leadTeaser = $leadRelease->teaserText(200);
$leadCompany = $leadRelease->company?->name; $leadCompany = $leadRelease->company?->name;
$leadHref = route('release.detail', ['slug' => $leadRelease->slug]); $leadHref = route('release.detail', ['slug' => $leadRelease->slug]);
$leadReadTime = max(1, (int) round(str_word_count(strip_tags((string) $leadRelease->text)) / 200)); $leadReadTime = $leadRelease->readTimeMinutes();
$leadPublishedAt = $leadRelease->published_at; $leadPublishedAt = $leadRelease->published_at;
} }
@endphp @endphp

View file

@ -5,17 +5,12 @@
]) ])
@php @php
$category = $release?->category?->translations?->firstWhere('locale', app()->getLocale()) $categoryName = $release?->localizedCategoryName();
?? $release?->category?->translations?->first(); $time = $release?->compactPublishedLabel();
$categoryName = $category?->name;
$time = $release?->published_at?->isToday()
? $release->published_at->format('H:i')
: ($release?->published_at?->isYesterday() ? __('web.shared.yesterday') : $release?->published_at?->isoFormat('D. MMM'));
$title = $release->title; $title = $release->title;
$company = $release?->company?->name; $company = $release?->company?->name;
$href = route('release.detail', ['slug' => $release->slug]); $href = route('release.detail', ['slug' => $release->slug]);
$image = $release?->images?->first(); $imageUrl = $release?->cardImageUrl();
$imageUrl = $image?->variantUrl('card') ?? $image?->url();
$placeholderUrl = $imageUrl ? null : $release?->chosenPlaceholderUrl(); $placeholderUrl = $imageUrl ? null : $release?->chosenPlaceholderUrl();
$gradient = 'linear-gradient(135deg,#3A4A5A,#6B7C95)'; $gradient = 'linear-gradient(135deg,#3A4A5A,#6B7C95)';
$number = str_pad((string) $index, 2, '0', STR_PAD_LEFT); $number = str_pad((string) $index, 2, '0', STR_PAD_LEFT);

View file

@ -24,15 +24,12 @@
$leadImage = $leadRelease?->images->first(); $leadImage = $leadRelease?->images->first();
$leadImageUrl = $leadImage?->variantUrl('detail') ?? $leadImage?->variantUrl('card') ?? $leadImage?->url(); $leadImageUrl = $leadImage?->variantUrl('detail') ?? $leadImage?->variantUrl('card') ?? $leadImage?->url();
$leadPlaceholderUrl = $leadImageUrl ? null : $leadRelease?->chosenPlaceholderUrl(); $leadPlaceholderUrl = $leadImageUrl ? null : $leadRelease?->chosenPlaceholderUrl();
$leadCat = $leadRelease?->category?->translations->firstWhere('locale', app()->getLocale()) ?? $leadRelease?->category?->translations->first(); $leadCatName = $leadRelease?->localizedCategoryName();
$leadCompany = $leadRelease?->company?->name; $leadCompany = $leadRelease?->company?->name;
$leadLead = $leadRelease $leadLead = $leadRelease
? (filled($leadRelease->subtitle) ? (filled($leadRelease->subtitle) ? $leadRelease->subtitle : $leadRelease->teaserText(220))
? $leadRelease->subtitle
: (string) Str::of(strip_tags((string) $leadRelease->text))->squish()->limit(220))
: null; : null;
$leadWords = $leadRelease ? str_word_count(strip_tags((string) $leadRelease->text)) : 0; $leadReadTime = $leadRelease?->readTimeMinutes() ?? 1;
$leadReadTime = max(1, (int) round($leadWords / 200));
@endphp @endphp
@section('title', __('web.category.meta_title', ['category' => $catName, 'brand' => config('app.name')])) @section('title', __('web.category.meta_title', ['category' => $catName, 'brand' => config('app.name')]))
@ -135,8 +132,8 @@
<span class="bp-tag">{{ __('web.hero.top_story') }}</span> <span class="bp-tag">{{ __('web.hero.top_story') }}</span>
</div> </div>
<div class="absolute left-0 right-0 bottom-0 px-6 sm:px-9 pb-8 pt-[70px] text-white" style="background:linear-gradient(180deg,transparent,rgba(0,0,0,0.92));"> <div class="absolute left-0 right-0 bottom-0 px-6 sm:px-9 pb-8 pt-[70px] text-white" style="background:linear-gradient(180deg,transparent,rgba(0,0,0,0.92));">
@if ($leadCat) @if ($leadCatName)
<div class="eyebrow mb-3" style="color:#FF8B6F;">{{ $leadCat->name }}</div> <div class="eyebrow mb-3" style="color:#FF8B6F;">{{ $leadCatName }}</div>
@endif @endif
<h2 class="font-serif text-[26px] sm:text-[32px] font-semibold m-0 leading-[1.12] tracking-[-0.6px] max-w-[680px] group-hover:text-white"> <h2 class="font-serif text-[26px] sm:text-[32px] font-semibold m-0 leading-[1.12] tracking-[-0.6px] max-w-[680px] group-hover:text-white">
{{ $leadRelease->title }} {{ $leadRelease->title }}

View file

@ -25,14 +25,11 @@
$leadImage = $leadRelease?->images->first(); $leadImage = $leadRelease?->images->first();
$leadImageUrl = $leadImage?->variantUrl('detail') ?? $leadImage?->variantUrl('card') ?? $leadImage?->url(); $leadImageUrl = $leadImage?->variantUrl('detail') ?? $leadImage?->variantUrl('card') ?? $leadImage?->url();
$leadPlaceholderUrl = $leadImageUrl ? null : $leadRelease?->chosenPlaceholderUrl(); $leadPlaceholderUrl = $leadImageUrl ? null : $leadRelease?->chosenPlaceholderUrl();
$leadCat = $leadRelease?->category?->translations->firstWhere('locale', app()->getLocale()) ?? $leadRelease?->category?->translations->first(); $leadCatName = $leadRelease?->localizedCategoryName();
$leadLead = $leadRelease $leadLead = $leadRelease
? (filled($leadRelease->subtitle) ? (filled($leadRelease->subtitle) ? $leadRelease->subtitle : $leadRelease->teaserText(220))
? $leadRelease->subtitle
: (string) Str::of(strip_tags((string) $leadRelease->text))->squish()->limit(220))
: null; : null;
$leadWords = $leadRelease ? str_word_count(strip_tags((string) $leadRelease->text)) : 0; $leadReadTime = $leadRelease?->readTimeMinutes() ?? 1;
$leadReadTime = max(1, (int) round($leadWords / 200));
@endphp @endphp
@section('title', $company->name.' – Newsroom · '.$brandName.$brandAccent) @section('title', $company->name.' – Newsroom · '.$brandName.$brandAccent)
@ -164,8 +161,8 @@
<span class="bp-tag">{{ __('web.newsroom_page.latest') }}</span> <span class="bp-tag">{{ __('web.newsroom_page.latest') }}</span>
</div> </div>
<div class="absolute left-0 right-0 bottom-0 px-6 sm:px-9 pb-8 pt-[70px] text-white" style="background:linear-gradient(180deg,transparent,rgba(0,0,0,0.92));"> <div class="absolute left-0 right-0 bottom-0 px-6 sm:px-9 pb-8 pt-[70px] text-white" style="background:linear-gradient(180deg,transparent,rgba(0,0,0,0.92));">
@if ($leadCat) @if ($leadCatName)
<div class="eyebrow mb-3" style="color:#FF8B6F;">{{ $leadCat->name }}</div> <div class="eyebrow mb-3" style="color:#FF8B6F;">{{ $leadCatName }}</div>
@endif @endif
<h2 class="font-serif text-[26px] sm:text-[34px] font-semibold m-0 leading-[1.12] tracking-[-0.6px] max-w-[760px] group-hover:text-white"> <h2 class="font-serif text-[26px] sm:text-[34px] font-semibold m-0 leading-[1.12] tracking-[-0.6px] max-w-[760px] group-hover:text-white">
{{ $leadRelease->title }} {{ $leadRelease->title }}

View file

@ -29,10 +29,10 @@
$embargoAt = $release->embargoAtLocal(); $embargoAt = $release->embargoAtLocal();
$bodyHtml = $release->renderedText(); $bodyHtml = $release->renderedText();
$wordCount = str_word_count(strip_tags((string) $release->text)); $wordCount = $release->wordCount();
$readTime = max(1, (int) round($wordCount / 200)); $readTime = $release->readTimeMinutes();
$teaser = (string) Str::of(strip_tags((string) $release->text))->squish()->limit(180); $teaser = $release->teaserText(180);
// Subline nur bei explizit gesetztem Untertitel — kein Fallback auf den Textanfang, // Subline nur bei explizit gesetztem Untertitel — kein Fallback auf den Textanfang,
// sonst erscheint der erste Absatz doppelt. Der Teaser dient nur der Meta-Description. // sonst erscheint der erste Absatz doppelt. Der Teaser dient nur der Meta-Description.

View file

@ -20,9 +20,7 @@
$exampleCategory = $example?->category?->translations?->first()?->name; $exampleCategory = $example?->category?->translations?->first()?->name;
$exampleCompany = $example?->company?->name; $exampleCompany = $example?->company?->name;
$examplePublishedAt = $example?->published_at; $examplePublishedAt = $example?->published_at;
$exampleReadMinutes = $example $exampleReadMinutes = $example?->readTimeMinutes() ?? 3;
? max(1, (int) ceil(str_word_count(strip_tags((string) $example->text)) / 200))
: 3;
// Inhalte aus static.publish.* — Reihen als Datenstrukturen (DRY). // Inhalte aus static.publish.* — Reihen als Datenstrukturen (DRY).
$trustPrinciples = [ $trustPrinciples = [