complete dossier
All checks were successful
Deploy / Deploy to Production (push) Successful in 17s

This commit is contained in:
Julie Blanc 2026-02-26 17:54:47 +01:00
parent e5727b5630
commit ec72fa474c
10 changed files with 220 additions and 45 deletions

View file

@ -29,39 +29,14 @@
<section class="container-cards container-cards__investigations" data-sort-container>
<?php
$superPin = $page->superPinnedInvestigation()->toPage();
$pinned = $page->pinnedInvestigations()->toPages();
if ($superPin) $pinned = $pinned->not($superPin);
$shownIds = [];
$list = [];
if ($superPin) {
$list[] = ['page' => $superPin, 'type' => 'super'];
$shownIds[] = $superPin->id();
}
foreach ($pinned as $p) {
$list[] = ['page' => $p, 'type' => 'pinned'];
$shownIds[] = $p->id();
}
$rest = $page->children()->listed()->sortBy('created', 'desc')
->filter(fn($p) => !in_array($p->id(), $shownIds));
foreach ($rest as $p) {
$list[] = ['page' => $p, 'type' => 'latest'];
}
?>
<?php foreach ($list as $item):
$investigation = $item['page'];
$type = $item['type'];
$cover = $investigation->cover()->toFile();
$dateAttr = $investigation->incidentDate()->isNotEmpty()
<?php foreach ($page->children()->listed()->sortBy('created', 'desc') as $investigation):
$cover = $investigation->cover()->toFile();
$dateAttr = $investigation->incidentDate()->isNotEmpty()
? $investigation->incidentDate()->toDate('yyyy-MM-dd')
: ($investigation->created()->isNotEmpty() ? $investigation->created()->toDate('yyyy-MM-dd') : '');
$filterAttr = implode(' ', array_map(fn($c) => Str::slug($c), $investigation->incidentCountry()->split()));
?>
<article class="card--article<?= $type !== 'latest' ? ' pinned' : '' ?>"
<article class="card--article"
data-date="<?= esc($dateAttr) ?>"
data-filter="<?= esc($filterAttr) ?>">
@ -71,10 +46,6 @@ foreach ($rest as $p) {
</figure>
<?php endif ?>
<?php if ($type !== 'latest'): ?>
<div class="pin"><?= svg('assets/icons/pin.svg') ?></div>
<?php endif ?>
<div class="content">
<h4 class="title"><a href="<?= $investigation->url() ?>"><?= $investigation->title()->esc() ?></a></h4>