geoproject-app/public/site/templates/project.php
sarahgarcin1 153e75c0a9
All checks were successful
Deploy / Build and Deploy to Production (push) Successful in 25s
merge + ajout des boutons sur les tuiles page projet + css page narrative
2026-02-27 12:24:35 +01:00

202 lines
No EOL
7.5 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* Template: projet.php
* Affichage de la liste des récits
*/
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?= e($page->isHomePage() != true, $page->title() . ' ') . $site->title() ?></title>
<!-- Styles globaux existants -->
<link rel="stylesheet" href="<?= url('assets/css/style.css') ?>">
<!-- Styles web -->
<link rel="stylesheet" href="<?= url('assets/css/web.css') ?>">
<!-- Styles projet -->
<link rel="stylesheet" href="<?= url('assets/css/projet.css') ?>">
<!-- À SUPPRIMER EN PRODUCTION -->
<meta name="robots" content="noindex, nofollow, noarchive">
<?php if ($kirby->user()): ?>
<meta name="csrf" content="<?= csrf() ?>">
<?php endif ?>
</head>
<body data-template="<?= $page->template() ?>">
<!-- ═══════════════════════════════════════════
EN-TÊTE PROJET
════════════════════════════════════════════ -->
<header class="pj-header">
<?php if ($page->cover()->isNotEmpty() && $cover = $page->cover()->toFile()): ?>
<div class="pj-header__bg" style="background-image: url('<?= $cover->url() ?>')"></div>
<div class="pj-header__overlay"></div>
<?php endif ?>
<div class="pj-header__content">
<p class="pj-header__eyebrow"><?= html($site->title()) ?></p>
<h1 class="pj-header__title"><?= html($page->title()) ?></h1>
<?php if ($page->subtitle()->isNotEmpty()): ?>
<p class="pj-header__subtitle"><?= html($page->subtitle()) ?></p>
<?php endif ?>
</div>
<div class="btn-connect">
<a
href="<?= $site->url() ?>/panel"
class=""
rel="noopener"
title="Se connecter"
target="_blank"
>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<circle cx="9.5" cy="8" r="4"/>
<path d="M16 21v-1a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v1"/>
<!-- <path d="M19 8l3 3-3 3M22 11h-7"/> -->
</svg>
</a>
</div>
</header>
<!-- ═══════════════════════════════════════════
GRILLE DES RÉCITS
════════════════════════════════════════════ -->
<main class="pj-main">
<?php $narratives = $page->children()->listed()->filterBy('intendedTemplate', 'narrative'); ?>
<?php if ($narratives->isEmpty()): ?>
<div class="pj-empty">
<p>Aucun récit publié pour l'instant.</p>
</div>
<?php else: ?>
<div class="pj-grid">
<?php foreach ($narratives as $i => $narrative): ?>
<?php
$cover = $narrative->cover()->toFile();
$intro = $narrative->introduction()->excerpt(180, true, '…');
$printUrl = $narrative->url(); // Version imprimée = URL native Kirby (narrative.php)
$webUrl = $narrative->url() . '/web'; // Version web = narrative-web.php via route ou suffix
?>
<article class="pj-card" style="--card-index: <?= $i ?>">
<!-- Cover -->
<a class="pj-card__cover-link" href="<?= $webUrl ?>" tabindex="-1" aria-hidden="true">
<div class="pj-card__cover">
<?php if ($cover): ?>
<img
src="<?= $cover->url() ?>"
alt="<?= html($narrative->title()) ?>"
loading="lazy"
>
<?php else: ?>
<div class="pj-card__cover-placeholder">
<span><?= mb_substr($narrative->title(), 0, 1) ?></span>
</div>
<?php endif ?>
</div>
</a>
<!-- Corps -->
<div class="pj-card__body">
<!-- Méta : auteur·ice -->
<?php if ($narrative->author()->isNotEmpty()): ?>
<p class="pj-card__author">
<span class="pj-card__author-label">Par</span>
<?= html($narrative->author()) ?>
</p>
<?php endif ?>
<!-- Titre -->
<h2 class="pj-card__title">
<a href="<?= $webUrl ?>"><?= html($narrative->title()) ?></a>
</h2>
<!-- Début de l'intro -->
<?php if ($intro): ?>
<p class="pj-card__intro"><?= $intro ?></p>
<?php endif ?>
<!-- Compteur sous-pages (optionnel, indicatif) -->
<?php $subCount = $narrative->children()->listed()->count(); ?>
<?php if ($subCount > 0): ?>
<p class="pj-card__meta">
<?= $subCount ?> <?= $subCount > 1 ? 'sections' : 'section' ?>
</p>
<?php endif ?>
</div>
<!-- Actions -->
<footer class="pj-card__footer">
<a
href="<?= $webUrl ?>"
class="pj-btn pj-btn--solid"
title="Lire la version web de « <?= html($narrative->title()) ?> »"
>
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/>
</svg>
Version web
</a>
<?php if($pdf = $narrative->pdf()->toFile()):?>
<a
href="<?= $pdf->url() ?>"
class="pj-btn pj-btn--ghost"
target="_blank"
rel="noopener"
title="Télécharger le PDF de « <?= html($narrative->title()) ?> »"
>
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="1.8"
stroke-linecap="round" stroke-linejoin="round">
<path d="M12 3v13"/>
<polyline points="7 11 12 16 17 11"/>
<path d="M3 21h18"/>
</svg>
</a>
<?php endif;?>
<?php if($kirby->user()):?>
<a
href="<?= $narrative->url() ?>"
class="pj-btn pj-btn--ghost"
target="_blank"
rel="noopener"
title="Éditer « <?= html($narrative->title()) ?> »"
>
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="1.8"
stroke-linecap="round" stroke-linejoin="round">
<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/>
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/>
</svg>
</a>
<?php else:?>
<div
class="pj-btn pj-btn-disable"
title="Connectez-vous pour éditer « <?= html($narrative->title()) ?> »"
data-tooltip="Connectez-vous pour éditer « <?= html($narrative->title()) ?> »"
>
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="1.8"
stroke-linecap="round" stroke-linejoin="round">
<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/>
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/>
</svg>
</div>
<?php endif;?>
</footer>
</article>
<?php endforeach ?>
</div>
<?php endif ?>
</main>
<?php snippet('footer') ?>
</body>
</html>