From ea35cc1e2206cd04df1796ba3fc398b06dce8fa9 Mon Sep 17 00:00:00 2001 From: Julie Blanc Date: Wed, 25 Feb 2026 15:22:34 +0100 Subject: [PATCH] template + blueprint news --- assets/css/components/_bottom-bar.scss | 2 +- assets/css/style.css | 4 +- site/blueprints/pages/database.yml | 3 + site/blueprints/pages/news-item.yml | 64 ++++++++++++++++++++ site/blueprints/pages/news.yml | 27 +++++++++ site/config/menu.php | 9 +++ site/languages/en.php | 9 ++- site/languages/fr.php | 9 ++- site/templates/investigation.php | 2 +- site/templates/news-item.php | 84 ++++++++++++++++++++++++++ site/templates/news.php | 81 +++++++++++++++++++++++++ 11 files changed, 286 insertions(+), 8 deletions(-) create mode 100644 site/blueprints/pages/news-item.yml create mode 100644 site/blueprints/pages/news.yml create mode 100644 site/templates/news-item.php create mode 100644 site/templates/news.php diff --git a/assets/css/components/_bottom-bar.scss b/assets/css/components/_bottom-bar.scss index 86adeaf..b2215f6 100644 --- a/assets/css/components/_bottom-bar.scss +++ b/assets/css/components/_bottom-bar.scss @@ -68,7 +68,7 @@ min-width: 0; - .type{ + .title-type{ text-transform: uppercase; &::after{ content: "/"; diff --git a/assets/css/style.css b/assets/css/style.css index 5e1cccc..1b68589 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -2442,10 +2442,10 @@ button.sort[data-sort-type=up] .arrow { padding-top: 5px; min-width: 0; } -#bottom-bar .title-group .type { +#bottom-bar .title-group .title-type { text-transform: uppercase; } -#bottom-bar .title-group .type::after { +#bottom-bar .title-group .title-type::after { content: "/"; padding-left: 1ch; padding-right: 1ch; diff --git a/site/blueprints/pages/database.yml b/site/blueprints/pages/database.yml index 355bc34..a8e9f3a 100644 --- a/site/blueprints/pages/database.yml +++ b/site/blueprints/pages/database.yml @@ -27,6 +27,9 @@ columns: impactCategories: label: Catégories des impacts type: tags + newsCategories: + label: Catégories des brèves + type: tags robots: type: hidden default: noindex, nofollow diff --git a/site/blueprints/pages/news-item.yml b/site/blueprints/pages/news-item.yml new file mode 100644 index 0000000..2ec503e --- /dev/null +++ b/site/blueprints/pages/news-item.yml @@ -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 diff --git a/site/blueprints/pages/news.yml b/site/blueprints/pages/news.yml new file mode 100644 index 0000000..c576d55 --- /dev/null +++ b/site/blueprints/pages/news.yml @@ -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 diff --git a/site/config/menu.php b/site/config/menu.php index d557ec6..f48ebcc 100644 --- a/site/config/menu.php +++ b/site/config/menu.php @@ -38,6 +38,15 @@ return [ 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' => [ 'label' => 'Dossiers', 'icon' => 'folder', diff --git a/site/languages/en.php b/site/languages/en.php index 634fb15..c4ab623 100644 --- a/site/languages/en.php +++ b/site/languages/en.php @@ -7,7 +7,12 @@ return [ 'name' => 'English', 'url' => '/en', 'translations' => [ - 'impact.type' => 'Impact', - 'impacts.title' => 'Impacts', + 'impact.type' => 'Impact', + 'impacts.title' => 'Impacts', + 'news.type' => 'News', + 'news.title' => 'News', + 'investigation.type' => 'Investigation', + 'investigations.related' => 'Related investigations', + 'investigations.see_all' => 'See all investigations', ], ]; \ No newline at end of file diff --git a/site/languages/fr.php b/site/languages/fr.php index 902960e..d64c8ee 100644 --- a/site/languages/fr.php +++ b/site/languages/fr.php @@ -8,7 +8,12 @@ return [ 'name' => 'Français', 'url' => '/', 'translations' => [ - 'impact.type' => 'Impact', - 'impacts.title' => 'Impacts', + 'impact.type' => 'Impact', + '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', ], ]; \ No newline at end of file diff --git a/site/templates/investigation.php b/site/templates/investigation.php index bbd6867..301afc8 100644 --- a/site/templates/investigation.php +++ b/site/templates/investigation.php @@ -454,7 +454,7 @@ if ($package):
-

Enquête

+

Enquête

title()->esc() ?>

diff --git a/site/templates/news-item.php b/site/templates/news-item.php new file mode 100644 index 0000000..bc36796 --- /dev/null +++ b/site/templates/news-item.php @@ -0,0 +1,84 @@ + +language(); +$locale = $lang ? $lang->locale(LC_ALL) : 'fr_FR.UTF-8'; +$dateLocale = substr(is_array($locale) ? reset($locale) : $locale, 0, 5); +?> + +
+ + + + +
+ + body()->isNotEmpty()): ?> + body()->toBlocks() ?> + + +
+ + linkedInvestigations()->toPages() ?> + isNotEmpty()): ?> + + + + +
+ diff --git a/site/templates/news.php b/site/templates/news.php new file mode 100644 index 0000000..8bd1703 --- /dev/null +++ b/site/templates/news.php @@ -0,0 +1,81 @@ + +language(); +$locale = $lang ? $lang->locale(LC_ALL) : 'fr_FR.UTF-8'; +$dateLocale = substr(is_array($locale) ? reset($locale) : $locale, 0, 5); +?> +
+ + + + +
+ + +
+ +
+ +
+ + children()->listed()->sortBy('created', 'desc') as $newsItem): ?> + + category()->split(); + $category = $categories[0] ?? ''; + $cover = $newsItem->cover()->toFile(); + $investigations = $newsItem->linkedInvestigations()->toPages(); + ?> + + + + + +
+ +
+