index-main/site/templates/packages.php
Julie Blanc aba8b4f37e
All checks were successful
Deploy / Deploy to Production (push) Successful in 5m17s
create template packages
2026-02-25 18:22:13 +01:00

61 lines
2.1 KiB
PHP

<?php snippet('header') ?>
<main>
<header class="page__header">
<h2 class="page__title"><?= $page->title() ?></h2>
<?php if ($page->chapo()->isNotEmpty()): ?>
<div class="description-medium">
<p><?= $page->chapo() ?></p>
</div>
<?php endif ?>
</header>
<section class="container-cards">
<?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">
<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 if ($package->description()->isNotEmpty()): ?>
<p class="description"><?= $package->description()->excerpt(100) ?></p>
<?php endif ?> -->
<?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>
<?php endif ?>
<?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>
<?php endforeach ?>
</section>
</main>
<?php snippet('footer') ?>