index-main/site/templates/folders.php
Julie Blanc 849b506c50
All checks were successful
Deploy / Deploy to Production (push) Successful in 12s
add folders
2026-01-25 22:42:02 +01:00

55 lines
1.6 KiB
PHP

<?php snippet('header') ?>
<main>
<header class="page__header">
<h2 class="page__title"><?= $page->title() ?></h2>
<?php if ($page->chapo()->isNotEmpty()): ?>
<div class="page__description">
<p><?= $page->chapo() ?></p>
</div>
<?php endif ?>
</header>
<section id="container-cards">
<?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>
<a class="link-block" href="<?= $folder->url() ?>"></a>
</article>
<?php endforeach ?>
</section>
</main>
<?php snippet('footer') ?>