index-main/site/templates/impacts.php

83 lines
2.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-28 00:05:06 +01:00
<header class="page__header">
<h2 class="page__title"><?= $page->title() ?></h2>
<?php if ($page->chapo()->isNotEmpty()): ?>
2026-02-24 17:05:22 +01:00
<div class="page__description">
2026-01-28 00:05:06 +01:00
<p><?= $page->chapo() ?></p>
</div>
<?php endif ?>
</header>
2026-01-29 20:57:17 +01:00
<div class="page__sort">
2026-02-24 17:05:22 +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-29 20:57:17 +01:00
<div class="dropdown">
2026-02-25 15:36:44 +01:00
<button class="dropdown__trigger sort btn--small no-link"><span class="icon"><?= svg('assets/icons/filter.svg') ?></span><p>Catégories</p></button>
2026-01-29 20:57:17 +01:00
<div class="dropdown__content">
<ul>
2026-02-24 17:05:22 +01:00
<?php foreach (page('database')->impactCategories()->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') ?></button></li>
2026-01-29 20:57:17 +01:00
</ul>
</div>
</div>
</div>
2026-02-25 16:07:14 +01:00
<div class="page__content grid-masonry" data-sort-container>
2026-01-28 01:03:42 +01:00
2026-02-09 15:15:27 +01:00
<div class="grid-sizer"></div>
2026-01-28 01:03:42 +01:00
2026-02-24 17:05:22 +01:00
<?php foreach ($page->children()->listed()->sortBy('created', 'desc') as $impact): ?>
2026-01-28 01:03:42 +01:00
2026-02-24 17:05:22 +01:00
<?php
$categories = $impact->category()->split();
$category = $categories[0] ?? '';
$cover = $impact->cover()->toFile();
$investigations = $impact->linkedInvestigations()->toPages();
?>
2026-02-14 16:05:22 +01:00
2026-02-25 16:07:14 +01:00
<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') : '' ?>">
2026-02-24 15:23:52 +01:00
2026-02-24 17:05:22 +01:00
<?php if ($cover): ?>
<figure><?php snippet('picture', ['file' => $cover]) ?></figure>
<?php endif ?>
2026-02-09 12:21:22 +01:00
2026-02-24 17:05:22 +01:00
<div class="group-top">
2026-02-24 15:23:52 +01:00
<p class="type">Impact</p>
2026-02-24 17:05:22 +01:00
<?php if ($category): ?>
<p class="category"><?= esc($category) ?></p>
<?php endif ?>
2026-02-09 13:50:20 +01:00
</div>
2026-02-24 17:05:22 +01:00
<h3 class="title"><?= $impact->title()->esc() ?></h3>
2026-02-09 12:21:22 +01:00
2026-02-24 17:05:22 +01:00
<?php if ($impact->created()->isNotEmpty()): ?>
<p class="date"><?= $impact->created()->toDate('d MMMM yyyy', 'fr_FR') ?></p>
<?php endif ?>
2026-02-09 12:21:22 +01:00
2026-02-24 17:05:22 +01:00
<?php if ($investigations->isNotEmpty()): ?>
<ul class="investigations">
<?php foreach ($investigations as $investigation): ?>
<li><a href="<?= $investigation->url() ?>"><?= $investigation->title()->esc() ?></a></li>
<?php endforeach ?>
</ul>
<?php endif ?>
2026-01-29 20:57:17 +01:00
2026-02-24 17:05:22 +01:00
<a class="link-block" href="<?= $impact->url() ?>"></a>
</div>
2026-01-29 20:57:17 +01:00
2026-02-24 17:05:22 +01:00
<?php endforeach ?>
2026-01-29 20:57:17 +01:00
2026-01-28 01:03:42 +01:00
</div>
2026-01-25 19:40:55 +01:00
</main>
2026-02-24 17:05:22 +01:00
<?php snippet('footer') ?>