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

@ -14,5 +14,7 @@ return [
'investigation.type' => 'Investigation',
'investigations.related' => 'Related investigations',
'investigations.see_all' => 'See all investigations',
'filter.all' => 'All',
'filter.all.m' => 'All',
],
];

View file

@ -15,5 +15,7 @@ return [
'investigation.type' => 'Enquête',
'investigations.related' => 'Enquêtes liées',
'investigations.see_all' => 'Voir toutes les enquêtes',
'filter.all' => 'Toutes',
'filter.all.m' => 'Tous',
],
];

View file

@ -22,12 +22,13 @@
<?php foreach (page('database')->impactCategories()->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') ?></button></li>
</ul>
</div>
</div>
</div>
<div class="page__content grid-masonry">
<div class="page__content grid-masonry" data-sort-container>
<div class="grid-sizer"></div>
@ -40,7 +41,10 @@
$investigations = $impact->linkedInvestigations()->toPages();
?>
<div class="card--block has-link" data-impact-type="<?= esc(Str::slug($category)) ?>">
<div class="card--block has-link"
data-impact-type="<?= esc(Str::slug($category)) ?>"
data-filter="<?= esc(Str::slug($category)) ?>"
data-date="<?= $impact->created()->isNotEmpty() ? $impact->created()->toDate('yyyy-MM-dd') : '' ?>">
<?php if ($cover): ?>
<figure><?php snippet('picture', ['file' => $cover]) ?></figure>

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>

View file

@ -25,12 +25,13 @@ $dateLocale = substr(is_array($locale) ? reset($locale) : $locale, 0, 5);
<?php foreach (page('database')->newsCategories()->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') ?></button></li>
</ul>
</div>
</div>
</div>
<div class="page__content grid-masonry">
<div class="page__content grid-masonry" data-sort-container>
<div class="grid-sizer"></div>
@ -43,7 +44,10 @@ $dateLocale = substr(is_array($locale) ? reset($locale) : $locale, 0, 5);
$investigations = $newsItem->linkedInvestigations()->toPages();
?>
<div class="card--block has-link" data-news-type="<?= esc(Str::slug($category)) ?>">
<div class="card--block has-link"
data-news-type="<?= esc(Str::slug($category)) ?>"
data-filter="<?= esc(Str::slug($category)) ?>"
data-date="<?= $newsItem->created()->isNotEmpty() ? $newsItem->created()->toDate('yyyy-MM-dd') : '' ?>">
<?php if ($cover): ?>
<figure><?php snippet('picture', ['file' => $cover]) ?></figure>