All checks were successful
Deploy / Build and Deploy to Production (push) Successful in 21s
151 lines
No EOL
5.6 KiB
PHP
151 lines
No EOL
5.6 KiB
PHP
<?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>
|
||
</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="<?= $narrative->url() ?>"
|
||
class="pj-btn pj-btn--ghost"
|
||
target="_blank"
|
||
rel="noopener"
|
||
title="Ouvrir la version imprimée 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">
|
||
<polyline points="6 9 6 2 18 2 18 9"/><path d="M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"/><rect x="6" y="14" width="12" height="8"/>
|
||
</svg>
|
||
Version imprimée
|
||
</a>
|
||
<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>
|
||
</footer>
|
||
|
||
</article>
|
||
<?php endforeach ?>
|
||
</div>
|
||
|
||
<?php endif ?>
|
||
</main>
|
||
|
||
<?php snippet('footer') ?>
|
||
|
||
</body>
|
||
</html>
|