deplace corps report to investigation-summary

This commit is contained in:
Julie Blanc 2026-02-14 16:53:14 +01:00
parent 58ed1a3fb8
commit 06785d712c
8 changed files with 145 additions and 1096 deletions

View file

@ -28,60 +28,6 @@ $report = $page->children()->filterBy('intendedTemplate', 'report')->first();
<div class="panel-left" id="banner--page">
<nav id="nav--page">
<ul>
<?php if ($page->heroType()->isNotEmpty() && ($page->heroImages()->toFile() || $page->videoExtractUrl()->isNotEmpty())): ?>
<li><a href="#">Vidéo</a></li>
<?php endif ?>
<?php if ($page->synthesis()->isNotEmpty()): ?>
<li><a href="#section__synthese">Synthèse</a></li>
<?php endif ?>
<li><a href="#section__impacts">Impacts</a></li>
<?php
// Vérifier si un dossier existe pour cette investigation
$packageSlug = $page->package()->value();
$hasPackage = false;
if (!empty($packageSlug) && site()->find('dossiers')) {
$hasPackage = site()->find('dossiers')->children()->filterBy('slug', $packageSlug)->first();
}
if ($hasPackage):
?>
<li><a href="#section__package">Dossier</a></li>
<?php endif ?>
<?php
// Vérifier s'il y a des enquêtes en lien
$relatedInvestigations = $page->relatedInvestigations()->toPages();
if ($relatedInvestigations->isEmpty()) {
$relatedInvestigations = $page->parent()->children()->filterBy('intendedTemplate', 'investigation-summary')->not($page)->listed()->limit(3);
}
if ($relatedInvestigations->isNotEmpty()):
?>
<li><a href="#section__related-articles">En lien</a></li>
<?php endif ?>
</ul>
</nav>
<div class="btn--group">
<?php if ($report): ?>
<button class="btn--bold"><a href="<?= $report->url() ?>">Lire le rapport</a></button>
<?php endif ?>
<div class="dropdown dropdown--position-panel">
<button class="dropdown__trigger btn--bold-inline no-link">
<span class="icon"><?= svg('assets/icons/share.svg') ?></span>
<span class="text">Partager</span>
</button>
<div class="dropdown__content">
<?php snippet('modal-share') ?>
</div>
</div>
</div>
</div>
<header class="page__header">
<p class="page__type">Enquête</p>
<h2 class="page__title"><?= $page->title()->esc() ?></h2>
@ -218,12 +164,117 @@ $report = $page->children()->filterBy('intendedTemplate', 'report')->first();
<?php endif ?>
</dl>
<?php if ($page->synthesis()->isNotEmpty()): ?>
<div class="section__article" id="section__synthese">
<h3 class="section__title">Synthèse</h3>
<?= $page->synthesis()->kt() ?>
</div>
<?php endif ?>
<div class="investigation__content">
<?php foreach ($page->body()->toLayouts() as $layout): ?>
<?php
$columns = $layout->columns();
$columnCount = $columns->count();
?>
<?php if ($columnCount === 1): ?>
<?php
$column = $columns->first();
$blocks = $column->blocks();
$hasHeading = false;
$hasOtherContent = false;
// Check what types of content we have
foreach ($blocks as $block) {
if ($block->type() === 'heading') {
$hasHeading = true;
} else {
$hasOtherContent = true;
}
}
?>
<div class="section-content">
<?php foreach ($blocks as $block): ?>
<?php if ($block->type() === 'heading'): ?>
<<?= $block->level()->or('h3') ?> class="section-title"><?= $block->text() ?></<?= $block->level()->or('h3') ?>>
<?php elseif ($block->type() === 'text'): ?>
<div class="section-txt">
<?= $block->text() ?>
</div>
<?php elseif ($block->type() === 'image'): ?>
<div class="media container-figure fig-simple">
<?php $image = $block->image()->toFile(); ?>
<?php if ($image): ?>
<figure>
<img src="<?= $image->url() ?>" alt="<?= $image->alt()->esc() ?>">
</figure>
<?php if ($image->caption()->isNotEmpty()): ?>
<p class="caption"><?= $image->caption()->html() ?></p>
<?php endif ?>
<?php endif ?>
</div>
<?php elseif ($block->type() === 'beforeafter'): ?>
<div class="media">
<?php snippet('blocks/' . $block->type(), ['block' => $block]) ?>
</div>
<?php elseif ($block->type() === 'video'): ?>
<div class="media container-video">
<?php snippet('blocks/' . $block->type(), ['block' => $block]) ?>
</div>
<?php elseif ($block->type() === 'horizontal-gallery'): ?>
<?php snippet('blocks/' . $block->type(), ['block' => $block]) ?>
<?php endif ?>
<?php endforeach ?>
</div>
<?php elseif ($columnCount === 2): ?>
<div class="section-content">
<div class="subsection-w-media">
<?php
$firstColumn = $columns->first();
$lastColumn = $columns->last();
?>
<div class="media">
<?php foreach ($firstColumn->blocks() as $block): ?>
<?php if ($block->type() === 'image'): ?>
<div class="container-figure fig-simple">
<?php $image = $block->image()->toFile(); ?>
<?php if ($image): ?>
<figure>
<img src="<?= $image->url() ?>" alt="<?= $image->alt()->esc() ?>">
</figure>
<?php if ($image->caption()->isNotEmpty()): ?>
<p class="caption"><?= $image->caption()->html() ?></p>
<?php endif ?>
<?php endif ?>
</div>
<?php elseif ($block->type() === 'beforeafter'): ?>
<?php snippet('blocks/' . $block->type(), ['block' => $block]) ?>
<?php elseif ($block->type() === 'video'): ?>
<?php snippet('blocks/' . $block->type(), ['block' => $block]) ?>
<?php endif ?>
<?php endforeach ?>
</div>
<div class="subsection-txt">
<?php foreach ($lastColumn->blocks() as $block): ?>
<?php if ($block->type() === 'text'): ?>
<?= $block->text() ?>
<?php elseif ($block->type() === 'heading'): ?>
<<?= $block->level()->or('h3') ?>><?= $block->text() ?></<?= $block->level()->or('h3') ?>>
<?php endif ?>
<?php endforeach ?>
</div>
</div>
</div>
<?php endif ?>
<?php endforeach ?>
</div>
<div class="section__article" id="section__impacts">
<h3 class="section__title">Impacts</h3>