index-main/site/templates/packages.php

60 lines
1.8 KiB
PHP
Raw Normal View History

2026-01-25 22:25:08 +01:00
<?php snippet('header') ?>
<main>
<header class="page__header">
2026-01-27 16:55:02 +01:00
2026-01-25 22:25:08 +01:00
<h2 class="page__title"><?= $page->title() ?></h2>
2026-01-25 22:42:02 +01:00
<?php if ($page->chapo()->isNotEmpty()): ?>
2026-01-27 16:55:02 +01:00
<div class="description-medium">
2026-01-25 22:42:02 +01:00
<p><?= $page->chapo() ?></p>
2026-01-25 22:25:08 +01:00
</div>
2026-01-25 22:42:02 +01:00
<?php endif ?>
2026-01-25 22:25:08 +01:00
</header>
2026-01-27 16:55:02 +01:00
<section class="container-cards">
2026-01-25 22:25:08 +01:00
<?php foreach ($page->children()->listed() as $package): ?>
<article class="card--package">
2026-01-25 22:42:02 +01:00
<?php if ($cover = $package->cover()->toFile()): ?>
2026-01-25 22:42:02 +01:00
<figure>
<img src="<?= $cover->url() ?>" alt="<?= $package->title()->esc() ?>">
2026-01-25 22:42:02 +01:00
</figure>
<?php endif ?>
2026-01-27 16:55:02 +01:00
2026-01-25 22:42:02 +01:00
<div class="content">
<h4 class="title"><a href="<?= $package->url() ?>"><span class="icon"><?= svg('assets/icons/package.svg') ?></span><?= $package->title()->esc() ?></a></h4>
2026-01-25 22:42:02 +01:00
<?php if ($package->description()->isNotEmpty()): ?>
<p class="short"><?= $package->description()->excerpt(200) ?></p>
2026-01-25 22:42:02 +01:00
<?php endif ?>
<?php
// Compter les enquêtes associées à ce dossier
$investigationsCount = site()->find('enquetes')->children()->listed()->filter(function($investigation) use ($package) {
return $investigation->package()->value() === $package->slug();
2026-01-25 22:42:02 +01:00
})->count();
?>
2026-01-27 16:55:02 +01:00
<ul>
<?php if ($investigationsCount > 0): ?>
<li><?= $investigationsCount ?> enquête<?= $investigationsCount > 1 ? 's' : '' ?></li>
<?php endif ?>
<li>8 impacts</li>
</ul>
2026-01-25 22:25:08 +01:00
2026-01-27 16:55:02 +01:00
</div>
<button class="btn--go-to"><a href="#" target="_blank"><?= svg('assets/icons/arrow-left.svg') ?></a></button>
<a class="link-block" href="<?= $package->url() ?>"></a>
2026-01-25 22:42:02 +01:00
</article>
<?php endforeach ?>
2026-01-25 22:25:08 +01:00
</section>
</main>
<?php snippet('footer') ?>