index-main/site/templates/folders.php

56 lines
1.6 KiB
PHP
Raw Normal View History

2026-01-25 22:25:08 +01:00
<?php snippet('header') ?>
<main>
<header class="page__header">
<h2 class="page__title"><?= $page->title() ?></h2>
2026-01-25 22:42:02 +01:00
<?php if ($page->chapo()->isNotEmpty()): ?>
2026-01-25 22:25:08 +01:00
<div class="page__description">
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>
<section id="container-cards">
2026-01-25 22:42:02 +01:00
<?php foreach ($page->children()->listed() as $folder): ?>
<article class="card--article">
<?php if ($cover = $folder->cover()->toFile()): ?>
<figure>
<img src="<?= $cover->url() ?>" alt="<?= $folder->title()->esc() ?>">
</figure>
<?php endif ?>
<div class="content">
<h4 class="title"><a href="<?= $folder->url() ?>"><?= $folder->title()->esc() ?></a></h4>
<?php if ($folder->description()->isNotEmpty()): ?>
<p class="description"><?= $folder->description()->excerpt(200) ?></p>
<?php endif ?>
<?php
// Compter les enquêtes associées à ce dossier
$investigationsCount = site()->find('enquetes')->children()->listed()->filter(function($investigation) use ($folder) {
return $investigation->folder()->value() === $folder->slug();
})->count();
?>
<?php if ($investigationsCount > 0): ?>
<dl class="dl">
<div class="dl__group">
<dt>Enquêtes</dt>
<dd><?= $investigationsCount ?> enquête<?= $investigationsCount > 1 ? 's' : '' ?></dd>
</div>
</dl>
<?php endif ?>
</div>
2026-01-25 22:25:08 +01:00
2026-01-25 22:42:02 +01:00
<a class="link-block" href="<?= $folder->url() ?>"></a>
</article>
<?php endforeach ?>
2026-01-25 22:25:08 +01:00
</section>
</main>
<?php snippet('footer') ?>