index-main/site/templates/investigations.php

131 lines
4.1 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-01-27 16:55:02 +01:00
<div class="description-medium">
<p>
<?= $page->chapo() ?>
</p>
</div>
</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>
<li><button type="button" data-filter="france">France</button></li>
<li><button type="button" data-filter="cisjordanie">Cisjordanie</button></li>
<li><button type="button" data-filter="etats-unis">États-Unis</button></li>
<li><button type="button" data-filter="gaza">Gaza</button></li>
</ul>
</div>
</div>
2026-01-08 14:53:08 +01:00
</div>
2026-01-06 17:14:32 +01:00
2026-01-27 16:55:02 +01:00
<section class="container-cards container-cards__investigations">
2026-01-06 17:14:32 +01:00
2026-02-19 16:25:44 +01:00
<?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();
?>
<article class="card--article<?= $type !== 'latest' ? ' pinned' : '' ?>">
<?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
2026-02-19 16:25:44 +01:00
<?php if ($type !== 'latest'): ?>
<div class="pin"><?= svg('assets/icons/pin.svg') ?></div>
<?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') ?>