category.php : don't show year if no article
This commit is contained in:
parent
3804d13cb6
commit
b0fb0b101d
8 changed files with 50 additions and 35 deletions
|
|
@ -3,10 +3,14 @@ $isOpen = isset($isOpen) ? $isOpen : false;
|
|||
?>
|
||||
|
||||
<header
|
||||
x-data="{
|
||||
activeTab: ''
|
||||
}"
|
||||
:class="activeTab.length > 0 ? 'open' : 'close'"
|
||||
class="page-cover"
|
||||
>
|
||||
<div class="title-wrapper">
|
||||
<?= $slots->title() ?>
|
||||
</div>
|
||||
</header>
|
||||
<?= $slots->tabs() ?>
|
||||
<?= $slots->tabs() ?>
|
||||
</header>
|
||||
|
|
@ -8,10 +8,7 @@ $authorFilter = isset($authorFilter) ? $authorFilter : false;
|
|||
$activeTab = isset($activeTab) ? Str::slug($activeTab) : '';
|
||||
?>
|
||||
|
||||
<nav id="tabs" x-data="{
|
||||
activeTab: '<?= $activeTab ?>'
|
||||
}"
|
||||
:class="activeTab.length > 0 ? 'open' : 'close'">
|
||||
<nav id="tabs" :class="activeTab.length > 0 ? 'open' : 'close'">
|
||||
<div class="toggle-btns | flex space-between" style="
|
||||
--content:space-between;
|
||||
">
|
||||
|
|
@ -68,8 +65,8 @@ $activeTab = isset($activeTab) ? Str::slug($activeTab) : '';
|
|||
<?php snippet(
|
||||
'text-item',
|
||||
[
|
||||
'article' => $article
|
||||
]
|
||||
'article' => $article
|
||||
]
|
||||
) ?>
|
||||
<?php endif ?>
|
||||
<?php endforeach ?>
|
||||
|
|
|
|||
|
|
@ -13,8 +13,10 @@
|
|||
>
|
||||
<ul>
|
||||
<?php foreach($kirby->collection('years') as $year): ?>
|
||||
<?php if ($year) : ?>
|
||||
<?php endif ?>
|
||||
<?php if (A::some($year->children()->toArray(), function ($text) use ($page) {
|
||||
return $text['content']['category'] == $page->title()->value();
|
||||
})): ?>
|
||||
<li>
|
||||
<div
|
||||
x-data='{
|
||||
isOpen: false
|
||||
|
|
@ -35,13 +37,20 @@
|
|||
</div>
|
||||
<button
|
||||
:class="isOpen ? 'open' : 'close'"
|
||||
class="see-more toggle left" @click="isOpen = !isOpen">Lire</button>
|
||||
class="see-more toggle left" @click="isOpen = !isOpen"
|
||||
>
|
||||
Lire
|
||||
</button>
|
||||
</div>
|
||||
<?php foreach($year->children() as $article): ?>
|
||||
<?php if ($article->category() == $page->title()) : ?>
|
||||
<?php snippet('text-item', ['article' => $article]) ?>
|
||||
<?php endif ?>
|
||||
<?php endforeach ?>
|
||||
<ul>
|
||||
<?php foreach($year->children() as $article): ?>
|
||||
<?php if ($article->category() == $page->title()->value()) : ?>
|
||||
<?php snippet('text-item', ['article' => $article]) ?>
|
||||
<?php endif ?>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</li>
|
||||
<?php endif ?>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue