template + blueprint news
All checks were successful
Deploy / Deploy to Production (push) Successful in 5m16s
All checks were successful
Deploy / Deploy to Production (push) Successful in 5m16s
This commit is contained in:
parent
224ddedc93
commit
ea35cc1e22
11 changed files with 286 additions and 8 deletions
|
|
@ -68,7 +68,7 @@
|
||||||
|
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
|
|
||||||
.type{
|
.title-type{
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
&::after{
|
&::after{
|
||||||
content: "/";
|
content: "/";
|
||||||
|
|
|
||||||
|
|
@ -2442,10 +2442,10 @@ button.sort[data-sort-type=up] .arrow {
|
||||||
padding-top: 5px;
|
padding-top: 5px;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
#bottom-bar .title-group .type {
|
#bottom-bar .title-group .title-type {
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
#bottom-bar .title-group .type::after {
|
#bottom-bar .title-group .title-type::after {
|
||||||
content: "/";
|
content: "/";
|
||||||
padding-left: 1ch;
|
padding-left: 1ch;
|
||||||
padding-right: 1ch;
|
padding-right: 1ch;
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,9 @@ columns:
|
||||||
impactCategories:
|
impactCategories:
|
||||||
label: Catégories des impacts
|
label: Catégories des impacts
|
||||||
type: tags
|
type: tags
|
||||||
|
newsCategories:
|
||||||
|
label: Catégories des brèves
|
||||||
|
type: tags
|
||||||
robots:
|
robots:
|
||||||
type: hidden
|
type: hidden
|
||||||
default: noindex, nofollow
|
default: noindex, nofollow
|
||||||
|
|
|
||||||
64
site/blueprints/pages/news-item.yml
Normal file
64
site/blueprints/pages/news-item.yml
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
title: Brève
|
||||||
|
|
||||||
|
tabs:
|
||||||
|
contentTab:
|
||||||
|
label: Contenu
|
||||||
|
icon: page
|
||||||
|
columns:
|
||||||
|
- width: 2/6
|
||||||
|
sections:
|
||||||
|
createdSection:
|
||||||
|
type: fields
|
||||||
|
fields:
|
||||||
|
created:
|
||||||
|
label: Date de publication
|
||||||
|
type: date
|
||||||
|
display: DD / MM / YYYY
|
||||||
|
default: today
|
||||||
|
width: 1/2
|
||||||
|
category:
|
||||||
|
label: Catégorie
|
||||||
|
type: tags
|
||||||
|
max: 1
|
||||||
|
options: query
|
||||||
|
query: page('database').newsCategories.split
|
||||||
|
cover:
|
||||||
|
label: Image de couverture
|
||||||
|
type: files
|
||||||
|
multiple: false
|
||||||
|
layout: cards
|
||||||
|
image:
|
||||||
|
ratio: 12/7
|
||||||
|
cover: true
|
||||||
|
help: Optionnelle — utilisée dans la liste des brèves
|
||||||
|
|
||||||
|
- width: 4/6
|
||||||
|
fields:
|
||||||
|
chapo:
|
||||||
|
label: Chapeau
|
||||||
|
type: writer
|
||||||
|
nodes: false
|
||||||
|
marks:
|
||||||
|
- bold
|
||||||
|
- italic
|
||||||
|
linkedInvestigations:
|
||||||
|
label: Enquêtes liées
|
||||||
|
type: pages
|
||||||
|
query: page('enquetes').children.listed
|
||||||
|
multiple: true
|
||||||
|
layout: list
|
||||||
|
text: "{{ page.title }}"
|
||||||
|
info: "{{ page.created }}"
|
||||||
|
body:
|
||||||
|
label: Corps
|
||||||
|
type: blocks
|
||||||
|
fieldsets:
|
||||||
|
- heading
|
||||||
|
- text
|
||||||
|
- image
|
||||||
|
- beforeafter
|
||||||
|
- video
|
||||||
|
- gallery
|
||||||
|
- insert
|
||||||
|
|
||||||
|
seo: seo/page
|
||||||
27
site/blueprints/pages/news.yml
Normal file
27
site/blueprints/pages/news.yml
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
title: Brèves
|
||||||
|
|
||||||
|
tabs:
|
||||||
|
contentTab:
|
||||||
|
label: Contenu
|
||||||
|
icon: page
|
||||||
|
columns:
|
||||||
|
- width: 1/3
|
||||||
|
fields:
|
||||||
|
chapo:
|
||||||
|
label: Introduction
|
||||||
|
type: writer
|
||||||
|
nodes: false
|
||||||
|
buttons: false
|
||||||
|
- width: 2/3
|
||||||
|
sections:
|
||||||
|
newsSection:
|
||||||
|
type: pages
|
||||||
|
label: Liste des brèves
|
||||||
|
template: news-item
|
||||||
|
create: news-item
|
||||||
|
layout: list
|
||||||
|
text: "{{ page.title }}"
|
||||||
|
info: "{{ page.category }} — {{ page.created.toDate('d/m/Y') }}"
|
||||||
|
sortBy: created desc
|
||||||
|
|
||||||
|
seo: seo/page
|
||||||
|
|
@ -38,6 +38,15 @@ return [
|
||||||
return Str::contains($path, 'pages/impacts');
|
return Str::contains($path, 'pages/impacts');
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
'news' => [
|
||||||
|
'label' => 'Brèves',
|
||||||
|
'icon' => 'newspaper',
|
||||||
|
'link' => 'pages/news',
|
||||||
|
'current' => function (string $current): bool {
|
||||||
|
$path = Kirby\Cms\App::instance()->path();
|
||||||
|
return Str::contains($path, 'pages/news');
|
||||||
|
}
|
||||||
|
],
|
||||||
'dossiers' => [
|
'dossiers' => [
|
||||||
'label' => 'Dossiers',
|
'label' => 'Dossiers',
|
||||||
'icon' => 'folder',
|
'icon' => 'folder',
|
||||||
|
|
|
||||||
|
|
@ -9,5 +9,10 @@ return [
|
||||||
'translations' => [
|
'translations' => [
|
||||||
'impact.type' => 'Impact',
|
'impact.type' => 'Impact',
|
||||||
'impacts.title' => 'Impacts',
|
'impacts.title' => 'Impacts',
|
||||||
|
'news.type' => 'News',
|
||||||
|
'news.title' => 'News',
|
||||||
|
'investigation.type' => 'Investigation',
|
||||||
|
'investigations.related' => 'Related investigations',
|
||||||
|
'investigations.see_all' => 'See all investigations',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
@ -10,5 +10,10 @@ return [
|
||||||
'translations' => [
|
'translations' => [
|
||||||
'impact.type' => 'Impact',
|
'impact.type' => 'Impact',
|
||||||
'impacts.title' => 'Impacts',
|
'impacts.title' => 'Impacts',
|
||||||
|
'news.type' => 'Brève',
|
||||||
|
'news.title' => 'Brèves',
|
||||||
|
'investigation.type' => 'Enquête',
|
||||||
|
'investigations.related' => 'Enquêtes liées',
|
||||||
|
'investigations.see_all' => 'Voir toutes les enquêtes',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
@ -454,7 +454,7 @@ if ($package):
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="title-group">
|
<div class="title-group">
|
||||||
<p class="type">Enquête</p>
|
<p class="title-type">Enquête</p>
|
||||||
<p class="title"><?= $page->title()->esc() ?></p>
|
<p class="title"><?= $page->title()->esc() ?></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
84
site/templates/news-item.php
Normal file
84
site/templates/news-item.php
Normal file
|
|
@ -0,0 +1,84 @@
|
||||||
|
<?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 endif ?>
|
||||||
|
|
||||||
|
</header>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="page__content">
|
||||||
|
|
||||||
|
<?php if ($page->body()->isNotEmpty()): ?>
|
||||||
|
<?= $page->body()->toBlocks() ?>
|
||||||
|
<?php endif ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?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 ?>
|
||||||
|
<?php if ($investigation->chapo()->isNotEmpty()): ?>
|
||||||
|
<p class="description"><?= $investigation->chapo()->excerpt(200) ?></p>
|
||||||
|
<?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 ?>
|
||||||
|
|
||||||
|
|
||||||
|
</main>
|
||||||
|
<?php snippet('footer') ?>
|
||||||
81
site/templates/news.php
Normal file
81
site/templates/news.php
Normal file
|
|
@ -0,0 +1,81 @@
|
||||||
|
<?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>
|
||||||
|
|
||||||
|
<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>Filtrer par type</p></button>
|
||||||
|
<div class="dropdown__content">
|
||||||
|
<ul>
|
||||||
|
<?php foreach (page('database')->newsCategories()->split() as $cat): ?>
|
||||||
|
<li><button type="button" data-filter="<?= esc(Str::slug($cat)) ?>"><?= esc($cat) ?></button></li>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="page__content grid-masonry">
|
||||||
|
|
||||||
|
<div class="grid-sizer"></div>
|
||||||
|
|
||||||
|
<?php foreach ($page->children()->listed()->sortBy('created', 'desc') as $newsItem): ?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$categories = $newsItem->category()->split();
|
||||||
|
$category = $categories[0] ?? '';
|
||||||
|
$cover = $newsItem->cover()->toFile();
|
||||||
|
$investigations = $newsItem->linkedInvestigations()->toPages();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="card--block has-link" data-news-type="<?= esc(Str::slug($category)) ?>">
|
||||||
|
|
||||||
|
<?php if ($cover): ?>
|
||||||
|
<figure><?php snippet('picture', ['file' => $cover]) ?></figure>
|
||||||
|
<?php endif ?>
|
||||||
|
|
||||||
|
<div class="group-top">
|
||||||
|
<p class="type"><?= t('news.type') ?></p>
|
||||||
|
<?php if ($category): ?>
|
||||||
|
<p class="category"><?= esc($category) ?></p>
|
||||||
|
<?php endif ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h3 class="title"><?= $newsItem->title()->esc() ?></h3>
|
||||||
|
|
||||||
|
<?php if ($newsItem->created()->isNotEmpty()): ?>
|
||||||
|
<p class="date"><?= $newsItem->created()->toDate('d MMMM yyyy', $dateLocale) ?></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="<?= $newsItem->url() ?>"></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php endforeach ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</main>
|
||||||
|
<?php snippet('footer') ?>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue