Frontend: Editorial-Relaunch der öffentlichen Strecke + Ausgaben-Routing
Öffentliche Seiten auf gemeinsames Editorial-Design (x-web.site-header/-footer,
Design-Tokens) und Ausgaben-Präfix /{edition}/ (de|en) umgestellt.
- Routing: neue Middleware SetEdition (Locale + URL::defaults), /{edition}-Gruppe
in routes/web.php, Root-Redirect auf /de, 301 für Legacy-.html-URLs,
Baseline-Default in AppServiceProvider.
- Neue URL-Schemata: /{edition}/press-release/{slug}, /{edition}/category/{slug}.
- Ausgabe = Sprache: DE/EN-Umschalter (Region/CH/AT entfernt); EditorialClock
und Livewire-Komponenten sprachdynamisch.
- Detail-, Kategorie- und Veröffentlichen-Seite mit echten Daten neu aufgebaut.
- Suche aktiviert: Volt-Komponente livewire/web/search (Titel/Text/Keywords +
Firma + Rubrik, Filter, Sortierung, Pagination, URL-Parameter q/category/sort).
- Rubriken-Navigation statt Übersichtsseite: Helper CategoryNavigation;
web/kategorien.blade.php + Route entfernt (Legacy-301).
- Tests: Edition-Routing, Kategorie-Seite/-Navigation, Detail, Veröffentlichen,
Suche, EditorialClock. Doku in "Echte öffentliche Unterseiten.md" aktualisiert.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
a0547208d3
commit
253141c6dc
64 changed files with 4457 additions and 2971 deletions
67
app/Support/CategoryNavigation.php
Normal file
67
app/Support/CategoryNavigation.php
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
|
||||
namespace App\Support;
|
||||
|
||||
use App\Enums\Portal;
|
||||
use App\Enums\PressReleaseStatus;
|
||||
use App\Models\Category;
|
||||
use App\Scopes\PortalScope;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
* Liefert die Rubriken-Navigation der aktiven Ausgabe (Portal × Sprache).
|
||||
*
|
||||
* Es gibt bewusst keine separate Rubriken-Übersichtsseite: Die Navigation
|
||||
* führt direkt auf die jeweilige Kategorieseite (`route('kategorie', …)`),
|
||||
* auf der die Pressemitteilungen dieser Rubrik erscheinen.
|
||||
*/
|
||||
class CategoryNavigation
|
||||
{
|
||||
/**
|
||||
* Top-Level-Rubriken der aktiven Ausgabe als Navigationsitems.
|
||||
*
|
||||
* @return Collection<int, array{label:string, slug:string, href:string}>
|
||||
*/
|
||||
public static function items(int $limit = 9): Collection
|
||||
{
|
||||
$portal = Portal::tryFrom((string) config('app.theme')) ?? Portal::Businessportal24;
|
||||
$language = app()->getLocale();
|
||||
$portalValues = [$portal->value, Portal::Both->value];
|
||||
|
||||
return Category::query()
|
||||
->with(['translations' => fn ($query) => $query->where('locale', $language)])
|
||||
->withCount([
|
||||
'pressReleases as published_count' => function (Builder $query) use ($portalValues, $language): void {
|
||||
$query
|
||||
->withoutGlobalScope(PortalScope::class)
|
||||
->whereIn('portal', $portalValues)
|
||||
->where('status', PressReleaseStatus::Published)
|
||||
->where('language', $language)
|
||||
->whereNotNull('published_at');
|
||||
},
|
||||
])
|
||||
->whereIn('portal', $portalValues)
|
||||
->where('is_active', true)
|
||||
->whereNull('parent_id')
|
||||
->orderByDesc('published_count')
|
||||
->orderBy('id')
|
||||
->limit($limit)
|
||||
->get()
|
||||
->map(function (Category $category): ?array {
|
||||
$translation = $category->translations->first();
|
||||
|
||||
if (! $translation || ! $translation->slug) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return [
|
||||
'label' => $translation->name,
|
||||
'slug' => $translation->slug,
|
||||
'href' => route('kategorie', ['slug' => $translation->slug]),
|
||||
];
|
||||
})
|
||||
->filter()
|
||||
->values();
|
||||
}
|
||||
}
|
||||
48
app/Support/EditorialClock.php
Normal file
48
app/Support/EditorialClock.php
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
|
||||
namespace App\Support;
|
||||
|
||||
use App\Enums\PressReleaseStatus;
|
||||
use App\Models\PressRelease;
|
||||
use App\Scopes\PortalScope;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
/**
|
||||
* Liefert den „Redaktions-Stichtag" für aktualitätsbezogene Startseiten-Abfragen.
|
||||
*
|
||||
* Das migrierte Archiv ist historisch: Der jüngste veröffentlichte Datensatz
|
||||
* kann Wochen/Monate in der Vergangenheit liegen. Würde man „heute / letzte 7
|
||||
* Tage" hart gegen das echte now() rechnen, liefern alle Aktualitäts-Module
|
||||
* 0 Treffer und fallen auf Mock-Daten zurück.
|
||||
*
|
||||
* Stattdessen wird der Stichtag an den jüngsten verfügbaren Veröffentlichungs-
|
||||
* zeitpunkt gekoppelt (gedeckelt auf now()): Liegt das jüngste published_at in
|
||||
* der Vergangenheit, dient es als Referenz-„Jetzt"; sobald frische
|
||||
* Pressemitteilungen mit aktuellem Datum einlaufen, greift automatisch wieder
|
||||
* das echte now().
|
||||
*/
|
||||
class EditorialClock
|
||||
{
|
||||
/**
|
||||
* @param array<int, string> $portalValues
|
||||
*/
|
||||
public static function reference(array $portalValues, string $language = 'de'): Carbon
|
||||
{
|
||||
$latest = PressRelease::query()
|
||||
->withoutGlobalScope(PortalScope::class)
|
||||
->whereIn('portal', $portalValues)
|
||||
->where('status', PressReleaseStatus::Published)
|
||||
->where('language', $language)
|
||||
->whereNotNull('published_at')
|
||||
->where('published_at', '<=', now())
|
||||
->max('published_at');
|
||||
|
||||
if (! $latest) {
|
||||
return now();
|
||||
}
|
||||
|
||||
$latest = Carbon::parse($latest);
|
||||
|
||||
return $latest->lt(now()) ? $latest : now();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue