create template packages
All checks were successful
Deploy / Deploy to Production (push) Successful in 5m17s

This commit is contained in:
Julie Blanc 2026-02-25 18:22:13 +01:00
parent f73b8cb90b
commit aba8b4f37e
20 changed files with 414 additions and 526 deletions

View file

@ -17,41 +17,43 @@
<?php foreach ($page->children()->listed() as $package): ?>
<article class="card--package">
<?php if ($cover = $package->cover()->toFile()): ?>
<figure>
<img src="<?= $cover->url() ?>" alt="<?= $package->title()->esc() ?>">
</figure>
<?php endif ?>
<div class="content">
<h4 class="title"><a href="<?= $package->url() ?>"><span class="icon"><?= svg('assets/icons/package.svg') ?></span><?= $package->title()->esc() ?></a></h4>
<?php if ($package->description()->isNotEmpty()): ?>
<p class="short"><?= $package->description()->excerpt(200) ?></p>
<article class="card--package">
<?php if ($cover = $package->cover()->toFile()): ?>
<figure>
<img src="<?= $cover->url() ?>" alt="<?= $package->title()->esc() ?>">
</figure>
<?php endif ?>
<div class="content">
<p class="type"><?= t('package.type') ?></p>
<h4 class="title"><a href="<?= $package->url() ?>"><span class="icon"><?= svg('assets/icons/package.svg') ?></span><?= $package->title()->esc() ?></a></h4>
<?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();
})->count();
?>
<!-- <?php if ($package->description()->isNotEmpty()): ?>
<p class="description"><?= $package->description()->excerpt(100) ?></p>
<?php endif ?> -->
<ul>
<?php
$investigationsCount = $package->linkedContent()->toPages()->count();
$impactsCount = $package->linkedImpacts()->toPages()->count();
?>
<?php if ($investigationsCount > 0 || $impactsCount > 0): ?>
<ul class="details">
<?php if ($investigationsCount > 0): ?>
<li><?= $investigationsCount ?> enquête<?= $investigationsCount > 1 ? 's' : '' ?></li>
<li><?= $investigationsCount ?> enquête<?= $investigationsCount > 1 ? 's' : '' ?></li>
<?php endif ?>
<li>8 impacts</li>
</ul>
<?php if ($impactsCount > 0): ?>
<li><?= $impactsCount ?> impact<?= $impactsCount > 1 ? 's' : '' ?></li>
<?php endif ?>
</ul>
<?php endif ?>
</div>
<button class="btn--go-to"><a href="<?= $package->url() ?>" target="_blank"><?= svg('assets/icons/arrow-left.svg') ?></a></button>
<a class="link-block" href="<?= $package->url() ?>" target="_blank" aria-hidden="true"></a>
</article>
</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>
</article>
<?php endforeach ?>
</section>