123 lines
4.5 KiB
PHP
123 lines
4.5 KiB
PHP
<?php snippet('header') ?>
|
|
<?php
|
|
$lang = kirby()->language();
|
|
$locale = $lang ? $lang->locale(LC_ALL) : 'fr_FR.UTF-8';
|
|
$dateLocale = substr(is_array($locale) ? reset($locale) : $locale, 0, 5);
|
|
?>
|
|
|
|
<main class="main__single">
|
|
|
|
<header class="page__header">
|
|
<p class="page__type"><?= t('news.type') ?></p>
|
|
<?php
|
|
$categories = $page->category()->split();
|
|
$category = $categories[0] ?? '';
|
|
?>
|
|
<?php if ($category): ?>
|
|
<p class="page__category"><?= esc($category) ?></p>
|
|
<?php endif ?>
|
|
<h2 class="page__title"><?= $page->title()->esc() ?></h2>
|
|
<?php if ($page->created()->isNotEmpty()): ?>
|
|
<time class="date" datetime="<?= $page->created()->toDate('yyyy-MM-dd') ?>"><?= $page->created()->toDate('d MMMM yyyy', $dateLocale) ?></time>
|
|
<?php endif ?>
|
|
<?php if ($page->chapo()->isNotEmpty()): ?>
|
|
<p class="page__description"><?= $page->chapo()->inline() ?></p>
|
|
<?php endif ?>
|
|
|
|
<?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 ?>
|
|
|
|
</header>
|
|
|
|
|
|
<?php if ($page->body()->isNotEmpty()): ?>
|
|
<div class="page__content">
|
|
<?= $page->body()->toBlocks() ?>
|
|
</div>
|
|
<?php endif ?>
|
|
|
|
|
|
|
|
<?php $investigations = $page->linkedInvestigations()->toPages() ?>
|
|
<?php if ($investigations->isNotEmpty()): ?>
|
|
<aside class="page__aside" id="related-investigations">
|
|
<h3 class="aside__title"><?= t('investigations.related') ?></h3>
|
|
|
|
<?php foreach ($investigations as $investigation): ?>
|
|
<article class="card--article-small">
|
|
<?php if ($cover = $investigation->cover()->toFile()): ?>
|
|
<figure>
|
|
<img src="<?= $cover->url() ?>" alt="<?= $investigation->title()->esc() ?>">
|
|
</figure>
|
|
<?php endif ?>
|
|
<div class="content">
|
|
<p class="type"><?= t('investigation.type') ?></p>
|
|
<h4 class="title"><a href="<?= $investigation->url() ?>"><?= $investigation->title()->esc() ?></a></h4>
|
|
<?php if ($investigation->incidentDate()->isNotEmpty()): ?>
|
|
<time class="date" datetime="<?= $investigation->incidentDate()->toDate('yyyy-MM-dd') ?>"><?= $investigation->incidentDate()->toDate('d MMMM yyyy', $dateLocale) ?></time>
|
|
<?php endif ?>
|
|
</div>
|
|
<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>
|
|
</article>
|
|
<?php endforeach ?>
|
|
|
|
<div class="see-more">
|
|
<button class="btn--bold-inline">
|
|
<a href="/enquetes">
|
|
<span class="text"><?= t('investigations.see_all') ?></span>
|
|
<span class="icon"><?= svg('assets/icons/arrow-left.svg') ?></span>
|
|
</a>
|
|
</button>
|
|
</div>
|
|
</aside>
|
|
<?php endif ?>
|
|
|
|
<?php
|
|
$latestNews = site()->find('news')
|
|
->children()->listed()->not($page)
|
|
->sortBy('created', 'desc')
|
|
->limit(5);
|
|
?>
|
|
|
|
<?php if ($latestNews->isNotEmpty()): ?>
|
|
<aside class="page__aside" id="latest-news">
|
|
<h3 class="aside__title">Voir aussi</h3>
|
|
|
|
<?php foreach ($latestNews as $newsItem): ?>
|
|
<div class="card--block-small has-link">
|
|
<div class="group-top">
|
|
<p class="type"><?= t('news.type') ?></p>
|
|
<?php if ($newsItem->category()->isNotEmpty()): ?>
|
|
<p class="category"><?= $newsItem->category()->esc() ?></p>
|
|
<?php endif ?>
|
|
</div>
|
|
|
|
<h4 class="title"><?= $newsItem->title()->esc() ?></h4>
|
|
|
|
<?php if ($newsItem->created()->isNotEmpty()): ?>
|
|
<p class="date">
|
|
<time datetime="<?= $newsItem->created()->toDate('yyyy-MM-dd') ?>"><?= $newsItem->created()->toDate('d MMMM yyyy', $dateLocale) ?></time>
|
|
</p>
|
|
<?php endif ?>
|
|
|
|
<button class="btn--go-to">
|
|
<a href="<?= $newsItem->url() ?>"><?= svg('assets/icons/arrow-left.svg') ?></a>
|
|
</button>
|
|
<a class="link-block" href="<?= $newsItem->url() ?>" aria-hidden="true"></a>
|
|
</div>
|
|
<?php endforeach ?>
|
|
</aside>
|
|
<?php endif ?>
|
|
|
|
|
|
</main>
|
|
|
|
<?php snippet('bottom-bar') ?>
|
|
<?php snippet('footer') ?>
|