index-main/site/templates/investigations.php

108 lines
3.8 KiB
PHP
Raw Normal View History

2025-10-07 16:21:26 +02:00
<?php snippet('header') ?>
2026-01-25 19:40:55 +01:00
<main>
2026-01-08 14:53:08 +01:00
<header class="page__header">
<h2 class="page__title"><?= $page->title() ?></h2>
2026-02-26 17:24:54 +01:00
<?php if ($page->chapo()->isNotEmpty()): ?>
<div class="page__description">
<p><?= $page->chapo() ?></p>
</div>
2026-02-26 17:24:54 +01:00
<?php endif ?>
</header>
2026-01-08 14:53:08 +01:00
<div class="page__sort">
2026-01-21 16:33:15 +01:00
<button class="sort btn--small no-link" data-sort-type="down"><p>Trier par date</p> <span class="arrow"><?= svg('assets/icons/arrow-left.svg') ?></span></button>
2026-01-21 17:25:37 +01:00
<div class="dropdown">
2026-01-21 16:33:15 +01:00
<button class="dropdown__trigger sort btn--small no-link"><span class="icon"><?= svg('assets/icons/filter.svg') ?></span><p>Lieux</p></button>
<div class="dropdown__content">
<ul>
2026-02-25 15:30:25 +01:00
<?php foreach (page('database')->countries()->split() as $cat): ?>
<li><button type="button" data-filter="<?= esc(Str::slug($cat)) ?>"><?= esc($cat) ?></button></li>
<?php endforeach ?>
2026-02-25 16:07:14 +01:00
<li><button type="button" data-filter=""><?= t('filter.all.m') ?></button></li>
2026-01-21 16:33:15 +01:00
</ul>
</div>
</div>
2026-01-08 14:53:08 +01:00
</div>
2026-01-06 17:14:32 +01:00
2026-02-25 16:07:14 +01:00
<section class="container-cards container-cards__investigations" data-sort-container>
2026-01-06 17:14:32 +01:00
2026-02-26 17:54:47 +01:00
<?php foreach ($page->children()->listed()->sortBy('created', 'desc') as $investigation):
$cover = $investigation->cover()->toFile();
$dateAttr = $investigation->incidentDate()->isNotEmpty()
2026-02-25 16:07:14 +01:00
? $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()));
2026-02-19 16:25:44 +01:00
?>
2026-02-26 17:54:47 +01:00
<article class="card--article"
2026-02-25 16:07:14 +01:00
data-date="<?= esc($dateAttr) ?>"
data-filter="<?= esc($filterAttr) ?>">
2026-02-19 16:25:44 +01:00
<?php if ($cover): ?>
2026-01-06 17:14:32 +01:00
<figure>
2026-01-13 10:48:10 +01:00
<img src="<?= $cover->url() ?>" alt="<?= $investigation->title()->esc() ?>">
2026-01-06 17:14:32 +01:00
</figure>
2026-01-13 10:48:10 +01:00
<?php endif ?>
2026-01-06 17:14:32 +01:00
<div class="content">
2026-01-13 10:48:10 +01:00
<h4 class="title"><a href="<?= $investigation->url() ?>"><?= $investigation->title()->esc() ?></a></h4>
2026-01-06 17:14:32 +01:00
2026-01-13 10:48:10 +01:00
<?php if ($investigation->chapo()->isNotEmpty()): ?>
<p class="description"><?= $investigation->chapo()->excerpt(200) ?></p>
<?php endif ?>
2026-01-06 17:14:32 +01:00
<dl class="dl">
2026-01-13 10:48:10 +01:00
<?php if ($investigation->incidentDate()->isNotEmpty()): ?>
2026-01-06 17:14:32 +01:00
<div class="dl__group">
2026-01-13 10:48:10 +01:00
<dt>Date de l'incident</dt>
2026-01-13 10:57:17 +01:00
<dd><time datetime="<?= $investigation->incidentDate()->toDate('yyyy-MM-dd') ?>"><?= $investigation->incidentDate()->toDate('d MMMM yyyy', 'fr_FR') ?></time></dd>
2026-01-06 17:14:32 +01:00
</div>
2026-01-13 10:48:10 +01:00
<?php endif ?>
2026-01-06 17:14:32 +01:00
2026-01-13 10:48:10 +01:00
<?php if ($partners = $investigation->partners()->toStructure()): ?>
<?php if ($partners->isNotEmpty()): ?>
2026-01-06 17:14:32 +01:00
<div class="dl__group">
<dt>Partenaire(s)</dt>
<dd>
2026-01-13 10:48:10 +01:00
<?php $partnerNames = [] ?>
<?php foreach ($partners as $partner): ?>
<?php $partnerNames[] = $partner->name()->value() ?>
<?php endforeach ?>
<?= implode(', ', $partnerNames) ?>
2026-01-06 17:14:32 +01:00
</dd>
</div>
2026-01-13 10:48:10 +01:00
<?php endif ?>
<?php endif ?>
2026-01-06 17:14:32 +01:00
2026-01-13 10:48:10 +01:00
<?php if ($investigation->incidentLocation()->isNotEmpty()): ?>
2026-01-06 17:14:32 +01:00
<div class="dl__group">
2026-01-13 10:48:10 +01:00
<dt>Lieu de l'incident</dt>
<dd><?= $investigation->incidentLocation()->esc() ?></dd>
2026-01-06 17:14:32 +01:00
</div>
2026-01-13 10:48:10 +01:00
<?php endif ?>
2026-01-06 17:14:32 +01:00
</dl>
</div>
2026-01-27 18:51:58 +01:00
<?php if ($keywords = $investigation->keywords()->split()): ?>
2026-02-19 16:25:44 +01:00
<div class="keywords-wrapper">
<ul class="keywords">
<?php foreach ($keywords as $keyword): ?>
<li><a href="#keyword" target="_blank"><?= esc($keyword) ?></a></li>
<?php endforeach ?>
</ul>
2026-02-19 16:25:44 +01:00
</div>
<?php endif ?>
2026-01-13 10:48:10 +01:00
<a class="link-block" href="<?= $investigation->url() ?>"></a>
2026-01-06 17:14:32 +01:00
</article>
2026-01-13 10:48:10 +01:00
<?php endforeach ?>
2026-01-06 17:14:32 +01:00
</section>
2026-01-25 19:40:55 +01:00
</main>
<?php snippet('footer') ?>