This commit is contained in:
parent
50f4836be1
commit
849b506c50
5 changed files with 183 additions and 20 deletions
21
site/blueprints/pages/folder.yml
Normal file
21
site/blueprints/pages/folder.yml
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
title: Dossier
|
||||
|
||||
tabs:
|
||||
contentTab:
|
||||
label: Contenu
|
||||
icon: page
|
||||
fields:
|
||||
description:
|
||||
label: Description
|
||||
type: textarea
|
||||
size: medium
|
||||
buttons: false
|
||||
cover:
|
||||
label: Visuel de couverture
|
||||
type: files
|
||||
multiple: false
|
||||
layout: cards
|
||||
image:
|
||||
ratio: 12/7
|
||||
cover: true
|
||||
help: Image utilisée dans la liste des dossiers
|
||||
17
site/blueprints/pages/folders.yml
Normal file
17
site/blueprints/pages/folders.yml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
title: Dossiers
|
||||
|
||||
tabs:
|
||||
contentTab:
|
||||
label: Contenu
|
||||
sections:
|
||||
folders:
|
||||
type: pages
|
||||
text: "{{ page.title }}"
|
||||
info: "{{ page.description }}"
|
||||
layout: cards
|
||||
size: huge
|
||||
search: true
|
||||
image:
|
||||
cover: true
|
||||
ratio: 12/7
|
||||
template: folder
|
||||
|
|
@ -74,6 +74,16 @@ tabs:
|
|||
label: Métadonnées
|
||||
icon: table
|
||||
fields:
|
||||
folder:
|
||||
label: Dossier
|
||||
type: select
|
||||
options: query
|
||||
query:
|
||||
fetch: site.find('dossiers').children
|
||||
text: "{{ page.title }}"
|
||||
value: "{{ page.slug }}"
|
||||
empty: Aucun dossier
|
||||
width: 1/3
|
||||
incidentDate:
|
||||
label: Date de l'incident
|
||||
type: date
|
||||
|
|
|
|||
97
site/templates/folder.php
Normal file
97
site/templates/folder.php
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
<?php snippet('header') ?>
|
||||
<main>
|
||||
|
||||
<header class="page__header">
|
||||
<p class="tag-inline">Dossier</p>
|
||||
<h2 class="page__title"><?= $page->title() ?></h2>
|
||||
|
||||
<?php if ($page->description()->isNotEmpty()): ?>
|
||||
<div class="page__description">
|
||||
<p><?= $page->description() ?></p>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
</header>
|
||||
|
||||
<?php
|
||||
// Récupérer les enquêtes associées à ce dossier
|
||||
$investigations = site()->find('enquetes')->children()->listed()->filter(function($investigation) use ($page) {
|
||||
return $investigation->folder()->value() === $page->slug();
|
||||
});
|
||||
?>
|
||||
|
||||
<?php if ($investigations->isNotEmpty()): ?>
|
||||
<section id="container-cards">
|
||||
|
||||
<?php foreach ($investigations as $investigation): ?>
|
||||
<article class="card--article">
|
||||
|
||||
<?php if ($cover = $investigation->cover()->toFile()): ?>
|
||||
<figure>
|
||||
<img src="<?= $cover->url() ?>" alt="<?= $investigation->title()->esc() ?>">
|
||||
</figure>
|
||||
<?php endif ?>
|
||||
|
||||
<div class="content">
|
||||
|
||||
<h4 class="title"><a href="<?= $investigation->url() ?>"><?= $investigation->title()->esc() ?></a></h4>
|
||||
|
||||
<?php if ($investigation->chapo()->isNotEmpty()): ?>
|
||||
<p class="description"><?= $investigation->chapo()->excerpt(200) ?></p>
|
||||
<?php endif ?>
|
||||
|
||||
<dl class="dl">
|
||||
<?php if ($investigation->incidentDate()->isNotEmpty()): ?>
|
||||
<div class="dl__group">
|
||||
<dt>Date de l'incident</dt>
|
||||
<dd><time datetime="<?= $investigation->incidentDate()->toDate('yyyy-MM-dd') ?>"><?= $investigation->incidentDate()->toDate('d MMMM yyyy', 'fr_FR') ?></time></dd>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if ($partners = $investigation->partners()->toStructure()): ?>
|
||||
<?php if ($partners->isNotEmpty()): ?>
|
||||
<div class="dl__group">
|
||||
<dt>Partenaire(s)</dt>
|
||||
<dd>
|
||||
<?php $partnerNames = [] ?>
|
||||
<?php foreach ($partners as $partner): ?>
|
||||
<?php $partnerNames[] = $partner->name()->value() ?>
|
||||
<?php endforeach ?>
|
||||
<?= implode(', ', $partnerNames) ?>
|
||||
</dd>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if ($investigation->incidentLocation()->isNotEmpty()): ?>
|
||||
<div class="dl__group">
|
||||
<dt>Lieu de l'incident</dt>
|
||||
<dd><?= $investigation->incidentLocation()->esc() ?></dd>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
</dl>
|
||||
|
||||
</div>
|
||||
|
||||
<?php if ($keywords = $investigation->keywords()->split()): ?>
|
||||
<?php if (count($keywords) > 0): ?>
|
||||
<div class="keywords-wrapper">
|
||||
<ul class="keywords">
|
||||
<?php foreach ($keywords as $keyword): ?>
|
||||
<li><a href="#keyword" target="_blank"><?= esc($keyword) ?></a></li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<?php endif ?>
|
||||
|
||||
<a class="link-block" href="<?= $investigation->url() ?>"></a>
|
||||
</article>
|
||||
<?php endforeach ?>
|
||||
|
||||
</section>
|
||||
<?php else: ?>
|
||||
<p>Aucune enquête associée à ce dossier pour le moment.</p>
|
||||
<?php endif ?>
|
||||
|
||||
</main>
|
||||
<?php snippet('footer') ?>
|
||||
|
|
@ -4,33 +4,51 @@
|
|||
<header class="page__header">
|
||||
<h2 class="page__title"><?= $page->title() ?></h2>
|
||||
|
||||
<?php if ($page->chapo()->isNotEmpty()): ?>
|
||||
<div class="page__description">
|
||||
<p>
|
||||
<?= $page->chapo() ?>
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iusto dignissimos, sit dolorum minima vel illo aliquam veniam eos assumenda cum quaerat error consequuntur laborum ipsum.
|
||||
</p>
|
||||
<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>Lieux</p></button>
|
||||
<div class="dropdown__content">
|
||||
<ul>
|
||||
<li><button type="button" data-filter="france">France</button></li>
|
||||
<li><button type="button" data-filter="cisjordanie">Cisjordanie</button></li>
|
||||
<li><button type="button" data-filter="etats-unis">États-Unis</button></li>
|
||||
<li><button type="button" data-filter="gaza">Gaza</button></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section id="container-cards">
|
||||
|
||||
<?php foreach ($page->children()->listed() as $folder): ?>
|
||||
<article class="card--article">
|
||||
|
||||
<?php if ($cover = $folder->cover()->toFile()): ?>
|
||||
<figure>
|
||||
<img src="<?= $cover->url() ?>" alt="<?= $folder->title()->esc() ?>">
|
||||
</figure>
|
||||
<?php endif ?>
|
||||
|
||||
<div class="content">
|
||||
<h4 class="title"><a href="<?= $folder->url() ?>"><?= $folder->title()->esc() ?></a></h4>
|
||||
|
||||
<?php if ($folder->description()->isNotEmpty()): ?>
|
||||
<p class="description"><?= $folder->description()->excerpt(200) ?></p>
|
||||
<?php endif ?>
|
||||
|
||||
<?php
|
||||
// Compter les enquêtes associées à ce dossier
|
||||
$investigationsCount = site()->find('enquetes')->children()->listed()->filter(function($investigation) use ($folder) {
|
||||
return $investigation->folder()->value() === $folder->slug();
|
||||
})->count();
|
||||
?>
|
||||
|
||||
<?php if ($investigationsCount > 0): ?>
|
||||
<dl class="dl">
|
||||
<div class="dl__group">
|
||||
<dt>Enquêtes</dt>
|
||||
<dd><?= $investigationsCount ?> enquête<?= $investigationsCount > 1 ? 's' : '' ?></dd>
|
||||
</div>
|
||||
</dl>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
|
||||
<a class="link-block" href="<?= $folder->url() ?>"></a>
|
||||
</article>
|
||||
<?php endforeach ?>
|
||||
|
||||
</section>
|
||||
</main>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue