add lab/projects
All checks were successful
Deploy / Deploy to Production (push) Successful in 12s

This commit is contained in:
Julie Blanc 2026-02-25 18:51:58 +01:00
parent e36eae0b6f
commit c34384adab
12 changed files with 319 additions and 12 deletions

81
site/templates/lab.php Normal file
View file

@ -0,0 +1,81 @@
<?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>
<div class="page__sort">
<button class="sort btn--small no-link" data-sort-type="down"><p>Trier par date</p> <span class="arrow"><?= svg('assets/icons/arrow-left.svg') ?></span></button>
<div class="dropdown">
<button class="dropdown__trigger sort btn--small no-link"><span class="icon"><?= svg('assets/icons/filter.svg') ?></span><p>Catégories</p></button>
<div class="dropdown__content">
<ul>
<?php foreach (page('database')->projectCategories()->split() as $cat): ?>
<li><button type="button" data-filter="<?= esc(Str::slug($cat)) ?>"><?= esc($cat) ?></button></li>
<?php endforeach ?>
<li><button type="button" data-filter=""><?= t('filter.all') ?></button></li>
</ul>
</div>
</div>
</div>
<div class="page__content grid-masonry" data-sort-container>
<div class="grid-sizer"></div>
<?php foreach ($page->children()->listed()->sortBy('created', 'desc') as $project): ?>
<?php
$categories = $project->category()->split();
$category = $categories[0] ?? '';
$cover = $project->cover()->toFile();
$investigations = $project->linkedInvestigations()->toPages();
?>
<div class="card--block has-link"
data-filter="<?= esc(Str::slug($category)) ?>"
data-date="<?= $project->created()->isNotEmpty() ? $project->created()->toDate('yyyy-MM-dd') : '' ?>">
<?php if ($cover): ?>
<figure><?php snippet('picture', ['file' => $cover]) ?></figure>
<?php endif ?>
<div class="group-top">
<p class="type"><?= t('project.type') ?></p>
<?php if ($category): ?>
<p class="category"><?= esc($category) ?></p>
<?php endif ?>
</div>
<h3 class="title"><?= $project->title()->esc() ?></h3>
<?php if ($project->created()->isNotEmpty()): ?>
<p class="date"><?= $project->created()->toDate('d MMMM yyyy', 'fr_FR') ?></p>
<?php endif ?>
<?php if ($investigations->isNotEmpty()): ?>
<ul class="investigations">
<?php foreach ($investigations as $investigation): ?>
<li><a href="<?= $investigation->url() ?>"><?= $investigation->title()->esc() ?></a></li>
<?php endforeach ?>
</ul>
<?php endif ?>
<a class="link-block" href="<?= $project->url() ?>"></a>
</div>
<?php endforeach ?>
</div>
</main>
<?php snippet('footer') ?>

120
site/templates/project.php Normal file
View file

@ -0,0 +1,120 @@
<?php snippet('header') ?>
<main class="main__single">
<header class="page__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);
$categories = $page->category()->split();
$category = $categories[0] ?? '';
?>
<p class="page__type"><?= t('project.type') ?></p>
<?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 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
$latestProjects = site()->find('laboratoire')
->children()->listed()->not($page)
->sortBy('created', 'desc')
->limit(5);
?>
<?php if ($latestProjects->isNotEmpty()): ?>
<aside class="page__aside" id="latest-projects">
<h3 class="aside__title">Voir aussi</h3>
<?php foreach ($latestProjects as $project): ?>
<div class="card--block-small has-link">
<div class="group-top">
<p class="type"><?= t('project.type') ?></p>
<?php if ($project->category()->isNotEmpty()): ?>
<p class="category"><?= $project->category()->esc() ?></p>
<?php endif ?>
</div>
<h4 class="title"><?= $project->title()->esc() ?></h4>
<?php if ($project->created()->isNotEmpty()): ?>
<p class="date">
<time datetime="<?= $project->created()->toDate('yyyy-MM-dd') ?>"><?= $project->created()->toDate('d MMMM yyyy', $dateLocale) ?></time>
</p>
<?php endif ?>
<button class="btn--go-to">
<a href="<?= $project->url() ?>"><?= svg('assets/icons/arrow-left.svg') ?></a>
</button>
<a class="link-block" href="<?= $project->url() ?>" aria-hidden="true"></a>
</div>
<?php endforeach ?>
</aside>
<?php endif ?>
</main>
<?php snippet('bottom-bar') ?>
<?php snippet('footer') ?>

View file

@ -1,4 +0,0 @@
<?php snippet('header') ?>
<main>
</main>
<?php snippet('footer') ?>