sort js
All checks were successful
Deploy / Deploy to Production (push) Successful in 14s

This commit is contained in:
Julie Blanc 2026-02-25 16:07:14 +01:00
parent a907d317b8
commit 494dd15166
10 changed files with 100 additions and 10 deletions

View file

@ -21,12 +21,13 @@
<?php foreach (page('database')->countries()->split() as $cat): ?>
<li><button type="button" data-filter="<?= esc(Str::slug($cat)) ?>"><?= esc($cat) ?></button></li>
<?php endforeach ?>
<li><button type="button" data-filter=""><?= t('filter.all.m') ?></button></li>
</ul>
</div>
</div>
</div>
<section class="container-cards container-cards__investigations">
<section class="container-cards container-cards__investigations" data-sort-container>
<?php
$superPin = $page->superPinnedInvestigation()->toPage();
@ -55,8 +56,14 @@ foreach ($rest as $p) {
$investigation = $item['page'];
$type = $item['type'];
$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<?= $type !== 'latest' ? ' pinned' : '' ?>"
data-date="<?= esc($dateAttr) ?>"
data-filter="<?= esc($filterAttr) ?>">
<?php if ($cover): ?>
<figure>