actuel-inactuel/site/snippets/nav__texts--collection.php

64 lines
2.9 KiB
PHP
Raw Normal View History

2025-02-06 13:03:33 +01:00
<ul
class="panel__collection panel__collection--<?= $collection ?><?= e($collection == 'categories', ' hidden') ?>">
2024-11-26 09:53:05 +01:00
<?php foreach($kirby->collection($collection) as $section): ?>
2025-02-06 13:03:33 +01:00
<li class="panel__item " x-data='{ isOpen: false }'>
<a class="no-underline" href="#<?= $section->slug() ?>"
id="<?= $section->slug() ?>">
2025-02-21 16:05:25 +01:00
<button class="panel__toggle-btn" @click="isOpen = !isOpen">
2024-11-26 09:53:05 +01:00
<h3><?= $section->title() ?></h3>
2025-02-06 13:03:33 +01:00
<div class="panel__toggle-icon" x-text="isOpen || search.length > 0 ? '-' : '+'"></div>
2024-11-26 09:53:05 +01:00
</button>
</a>
2025-02-06 13:03:33 +01:00
<div class="panel-item-content" x-show="isOpen || search.length > 0" x-data='{ edito: false }'>
<?php if ($collection === 'years'): ?>
<div class="panel-item-content__edito" :class="edito ? '' : 'short'" x-show="search.length === 0">
<?= $section->edito() ?>
</div>
<button :class="edito ? 'open' : 'close'" x-show="search.length === 0"
class="see-more toggle-btn toggle-btn--left" @click="edito = !edito">Lire</button>
2024-11-26 09:53:05 +01:00
<?php endif ?>
2025-02-03 16:43:24 +01:00
<ul class="panel-item-content__texts texts">
2024-11-26 09:53:05 +01:00
<?php foreach($section->children() as $article): ?>
2025-02-06 13:03:33 +01:00
<?php
$author = $article->author()->toPage() == null ? 'inconnu' : $article->author()->toPage()->title();
?>
<li class="text" x-data="{
2024-11-26 09:53:05 +01:00
title: '<?= str_replace("'", "\'", $article->title()->value()) ?>',
author: '<?= $author ?>',
category: '<?= $article->category() ?>',
2025-02-03 12:01:13 +01:00
keywords: '<?= $article->keywords() ?>',
2025-02-06 13:03:33 +01:00
}" x-show="
2024-11-26 09:53:05 +01:00
slugify(title).includes(slugify(search))
|| slugify(author).includes(slugify(search))
|| slugify(category).includes(slugify(search))
2025-02-03 12:01:13 +01:00
|| slugify(keywords).includes(slugify(search))
2025-02-06 13:03:33 +01:00
">
<a href="<?= $article->url() ?>"
class="text__title no-underline">
<h4><?= $article->title() ?></h4>
<?php if ($article->subtitle()->isNotEmpty()): ?>
2025-02-07 10:46:52 +01:00
<p class="text__subtitle"><?= $article->subtitle()->inline() ?></p>
2025-02-06 13:03:33 +01:00
<?php endif ?>
</a>
<div class="text__infos">
<p>
<span class="light">par</span>
<a class="author"
href="/auteurs/<?= Str::slug($author) ?>"><?= $author ?></a><br>
<!-- <span class="light">publié le
</span><?php // echo $article->published()->toDate('d/m/Y')?><br>
-->
2025-02-06 13:28:38 +01:00
<span class="light">publication prévue le</span> 21/02/25<br>
2025-02-06 13:03:33 +01:00
<span class="light">dans</span> <a
href="<?= $article->parent()->url() ?>"><?= $article->parent()->title() ?></a>
/ <a
2025-02-21 13:24:06 +01:00
href="/categories/<?= Str::slug($article->category()) ?>"><?= $article->category() ?></a>
2025-02-06 13:03:33 +01:00
</p>
</div>
</li>
2024-11-26 09:53:05 +01:00
<?php endforeach ?>
</ul>
</div>
</li>
<?php endforeach ?>
</ul>