index-main/site/templates/package.php

115 lines
4.1 KiB
PHP
Raw Normal View History

2026-01-27 16:55:02 +01:00
2026-01-25 22:42:02 +01:00
<?php snippet('header') ?>
2026-02-25 19:05:22 +01:00
<main class="main__single">
2026-01-25 22:42:02 +01:00
2026-02-25 18:22:13 +01:00
<?php
$lang = kirby()->language();
$locale = $lang ? $lang->locale(LC_ALL) : 'fr_FR.UTF-8';
$dateLocale = substr(is_array($locale) ? reset($locale) : $locale, 0, 5);
$investigations = $page->linkedContent()->toPages();
$impacts = $page->linkedImpacts()->toPages();
?>
2026-01-25 22:42:02 +01:00
<header class="page__header">
2026-02-25 18:22:13 +01:00
<p class="page__type"><?= t('package.type') ?></p>
2026-01-25 22:42:02 +01:00
<h2 class="page__title"><?= $page->title() ?></h2>
2026-02-25 18:22:13 +01:00
<?php if ($investigations->isNotEmpty() || $impacts->isNotEmpty()): ?>
<ul class="details">
<?php if ($investigations->isNotEmpty()): ?>
<li><a href="#investigations"><?= $investigations->count() ?> <?= $investigations->count() > 1 ? t('investigation.type.plural') : t('investigation.type') ?></a></li>
<?php endif ?>
<?php if ($impacts->isNotEmpty()): ?>
<li><a href="#impacts"><?= $impacts->count() ?> <?= $impacts->count() > 1 ? t('impact.type.plural') : t('impact.type') ?></a></li>
<?php endif ?>
</ul>
2026-01-25 22:42:02 +01:00
<?php endif ?>
2026-02-25 19:05:22 +01:00
<?php if ($cover = $page->cover()->toFile()): ?>
<figure class="page__cover">
<?php snippet('picture', ['file' => $cover]) ?>
</figure>
<?php if ($cover->caption()->isNotEmpty()): ?>
<p class="caption"><?= $cover->caption()->html() ?></p>
<?php endif ?>
<?php endif ?>
2026-01-25 22:42:02 +01:00
</header>
2026-02-25 19:05:22 +01:00
2026-02-25 18:22:13 +01:00
<?php if ($page->description()->isNotEmpty()): ?>
<div class="page__content">
<p><?= $page->description() ?></p>
2026-01-27 18:33:27 +01:00
</div>
2026-02-25 18:22:13 +01:00
<?php endif ?>
2026-01-27 18:33:27 +01:00
2026-01-25 22:42:02 +01:00
<?php if ($investigations->isNotEmpty()): ?>
2026-02-25 18:22:13 +01:00
<div class="package__section" id="investigations">
<h3 class="section__title"><?= t('investigations.title') ?> (<?= $investigations->count() ?>)</h3>
2026-01-25 22:42:02 +01:00
2026-01-27 18:33:27 +01:00
<?php foreach ($investigations as $investigation): ?>
2026-02-25 18:22:13 +01:00
<article class="card--article-small">
2026-01-27 18:33:27 +01:00
<?php if ($cover = $investigation->cover()->toFile()): ?>
<figure>
<img src="<?= $cover->url() ?>" alt="<?= $investigation->title()->esc() ?>">
</figure>
<?php endif ?>
<div class="content">
2026-02-25 18:22:13 +01:00
<p class="type"><?= t('investigation.type') ?></p>
<h4 class="title"><a href="<?= $investigation->url() ?>"><?= $investigation->title()->esc() ?></a></h4>
2026-01-27 18:33:27 +01:00
<?php if ($investigation->incidentDate()->isNotEmpty()): ?>
2026-02-25 18:22:13 +01:00
<time class="date" datetime="<?= $investigation->incidentDate()->toDate('yyyy-MM-dd') ?>"><?= $investigation->incidentDate()->toDate('d MMMM yyyy', $dateLocale) ?></time>
2026-01-27 18:33:27 +01:00
<?php endif ?>
2026-02-25 18:22:13 +01:00
<?php if ($investigation->chapo()->isNotEmpty()): ?>
<p class="description"><?= $investigation->chapo()->excerpt(200) ?></p>
2026-01-27 18:33:27 +01:00
<?php endif ?>
</div>
2026-02-25 18:22:13 +01:00
<button class="btn--go-to"><a href="<?= $investigation->url() ?>"><?= svg('assets/icons/arrow-left.svg') ?></a></button>
<a class="link-block" href="<?= $investigation->url() ?>" aria-hidden="true"></a>
2026-01-27 18:33:27 +01:00
</article>
<?php endforeach ?>
2026-02-25 18:22:13 +01:00
</div>
2026-01-27 18:33:27 +01:00
<?php endif ?>
2026-01-25 22:42:02 +01:00
2026-01-27 18:33:27 +01:00
2026-02-25 18:22:13 +01:00
<?php if ($impacts->isNotEmpty()): ?>
<div class="package__section" id="impacts">
<h3 class="section__title"><?= t('impacts.title') ?> (<?= $impacts->count() ?>)</h3>
2026-01-27 18:33:27 +01:00
2026-02-25 18:22:13 +01:00
<?php foreach ($impacts as $impact): ?>
<div class="card--block-small has-link">
<div class="group-top">
<p class="type"><?= t('impact.type') ?></p>
<?php if ($impact->category()->isNotEmpty()): ?>
<p class="category"><?= $impact->category()->esc() ?></p>
<?php endif ?>
2026-01-29 20:57:17 +01:00
</div>
2026-01-25 22:42:02 +01:00
2026-02-25 18:22:13 +01:00
<h4 class="title"><?= $impact->title()->esc() ?></h4>
2026-01-27 18:33:27 +01:00
2026-02-25 18:22:13 +01:00
<?php if ($impact->created()->isNotEmpty()): ?>
<p class="date">
<time datetime="<?= $impact->created()->toDate('yyyy-MM-dd') ?>"><?= $impact->created()->toDate('d MMMM yyyy', $dateLocale) ?></time>
</p>
<?php endif ?>
2026-02-06 15:10:27 +01:00
2026-02-25 18:22:13 +01:00
<button class="btn--go-to">
<a href="<?= $impact->url() ?>"><?= svg('assets/icons/arrow-left.svg') ?></a>
</button>
<a class="link-block" href="<?= $impact->url() ?>" aria-hidden="true"></a>
2026-02-06 15:10:27 +01:00
</div>
2026-02-25 18:22:13 +01:00
<?php endforeach ?>
2026-02-06 15:10:27 +01:00
2026-01-27 18:33:27 +01:00
</div>
2026-02-25 18:22:13 +01:00
<?php endif ?>
2026-01-27 18:33:27 +01:00
2026-01-25 22:42:02 +01:00
</main>
<?php snippet('footer') ?>