Compare commits
7 commits
main
...
ajout_disc
| Author | SHA1 | Date | |
|---|---|---|---|
| 3f5595144d | |||
| d4b7a3f3fb | |||
| 9789b645ff | |||
| 7501e2cbb7 | |||
| d91455a0b4 | |||
| dee8f94182 | |||
| 344af4c0fe |
15 changed files with 82 additions and 31 deletions
|
|
@ -9,10 +9,10 @@
|
||||||
color: #000;
|
color: #000;
|
||||||
}
|
}
|
||||||
|
|
||||||
.k-panel[data-template="year"] .k-list-items .k-item:first-child {
|
.k-panel[data-template="year"] .k-section-name-texts .k-list-items .k-item:first-child {
|
||||||
margin-bottom: 2rem;
|
margin-bottom: 2rem;
|
||||||
}
|
}
|
||||||
.k-panel[data-template="year"] .k-list-items::before {
|
.k-panel[data-template="year"] .k-section-name-texts .k-list-items::before {
|
||||||
content: "Texte princeps";
|
content: "Texte princeps";
|
||||||
display: block;
|
display: block;
|
||||||
padding: 0.5rem;
|
padding: 0.5rem;
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ tabs:
|
||||||
type: pages
|
type: pages
|
||||||
template: year
|
template: year
|
||||||
sortBy: title desc
|
sortBy: title desc
|
||||||
- width: 1/1
|
- width: 1/2
|
||||||
sections:
|
sections:
|
||||||
allTextsSection:
|
allTextsSection:
|
||||||
label: Tous les textes
|
label: Tous les textes
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,14 @@ tabs:
|
||||||
templates:
|
templates:
|
||||||
- linear
|
- linear
|
||||||
- grid
|
- grid
|
||||||
|
linkedTextsSection:
|
||||||
|
type: fields
|
||||||
|
fields:
|
||||||
|
linkedTexts:
|
||||||
|
label: Textes liés
|
||||||
|
type: pages
|
||||||
|
query : site.find('textes').grandChildren.not(page.children)
|
||||||
|
help: textes enregistrés à une autre année à inclure aussi dans celle-ci.
|
||||||
- width: 2/3
|
- width: 2/3
|
||||||
fields:
|
fields:
|
||||||
edito:
|
edito:
|
||||||
|
|
|
||||||
8
site/models/year.php
Normal file
8
site/models/year.php
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?php
|
||||||
|
class YearPage extends Page{
|
||||||
|
public function allTexts(){
|
||||||
|
$texts = $this->children()->listed();
|
||||||
|
$linked = $this->linkedTexts()->toPages();
|
||||||
|
return $texts->merge($linked);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
Kirby::plugin('sylvainjule/code-editor', [
|
Kirby::plugin('sylvainjule/code-editor', [
|
||||||
'options' => [
|
'options' => array(
|
||||||
'language' => 'css',
|
'language' => 'css',
|
||||||
'size' => 'small',
|
'size' => 'small',
|
||||||
'lineNumbers' => true,
|
'lineNumbers' => true,
|
||||||
'tabSize' => 4,
|
'tabSize' => 4,
|
||||||
'insertSpaces' => true,
|
'insertSpaces' => true,
|
||||||
'ignoreTabKey' => false,
|
'ignoreTabKey' => false,
|
||||||
],
|
),
|
||||||
'fields' => [
|
'fields' => array(
|
||||||
'code-editor' => require_once __DIR__ . '/lib/fields/code-editor.php',
|
'code-editor' => require_once __DIR__ . '/lib/fields/code-editor.php',
|
||||||
],
|
),
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,17 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
function allYears ($article) {
|
||||||
|
$years = new Pages([$article->parent()]);
|
||||||
|
|
||||||
|
foreach (site()->find('textes')->children() as $year) {
|
||||||
|
if ($year->linkedTexts()->toPages()->has($article)) {
|
||||||
|
$years = $years->add($year);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $years;
|
||||||
|
}
|
||||||
|
|
||||||
function setTitleFontSizeClass($title, $level = 'h1')
|
function setTitleFontSizeClass($title, $level = 'h1')
|
||||||
{
|
{
|
||||||
$length = strlen($title);
|
$length = strlen($title);
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ $entryTopPos ??= 20;
|
||||||
"name": "<?= $page->author() ?>"
|
"name": "<?= $page->author() ?>"
|
||||||
}],
|
}],
|
||||||
"image": "<?= url('assets/images/logo.png') ?>",
|
"image": "<?= url('assets/images/logo.png') ?>",
|
||||||
"description": "<?= $page->title() ?>, par <?= $page->author()->toPage()->title() ?>. Publié le <?= $page->published()->toDate('d/m/Y') ?> dans <?= $page->parent()->title() ?>/<?= $page->category() ?>",
|
"description": "<?= $page->title() ?>, par <?= $page->author()->toPage()->title() ?>. Publié le <?= $page->published()->toDate('d/m/Y') ?> dans <?= implode(', ', allYears($page)->pluck('title')) ?>/<?= $page->category() ?>",
|
||||||
"datePublished": "<?= $page->published()->toDate('Y-m-d') ?>",
|
"datePublished": "<?= $page->published()->toDate('Y-m-d') ?>",
|
||||||
"dateModified": "<?= $page->modified('Y-m-d') ?>",
|
"dateModified": "<?= $page->modified('Y-m-d') ?>",
|
||||||
"url": "<?= $page->url() ?>",
|
"url": "<?= $page->url() ?>",
|
||||||
|
|
|
||||||
|
|
@ -29,9 +29,12 @@
|
||||||
|
|
||||||
<span class="light">publié le </span><?php echo $article->published()->toDate('d/m/Y') ?><br>
|
<span class="light">publié le </span><?php echo $article->published()->toDate('d/m/Y') ?><br>
|
||||||
|
|
||||||
<span class="light">dans</span> <a
|
<span class="light">dans</span>
|
||||||
href="<?= $article->parent()->url() ?>"><?= $article->parent()->title() ?></a>
|
<?php foreach(allYears($article) as $year):?>
|
||||||
/ <a
|
<a href="<?= $year->url() ?>"><?= $year->title()?></a>/
|
||||||
|
<?php endforeach ?>
|
||||||
|
|
||||||
|
<a
|
||||||
href="/categories/<?= Str::slug($article->category()) ?>"><?= $article->category() ?></a>
|
href="/categories/<?= Str::slug($article->category()) ?>"><?= $article->category() ?></a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@
|
||||||
class="see-more toggle-btn toggle-btn--left" @click="edito = !edito">Lire</button>
|
class="see-more toggle-btn toggle-btn--left" @click="edito = !edito">Lire</button>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<ul class="panel-item-content__texts texts">
|
<ul class="panel-item-content__texts texts">
|
||||||
<?php foreach($section->children() as $article): ?>
|
<?php $articles = method_exists($section, 'allTexts') ? $section->allTexts() : $section->children(); ?>
|
||||||
|
<?php foreach($articles as $article): ?>
|
||||||
<?php
|
<?php
|
||||||
$author = $article->author()->toPage() == null ? 'inconnu' : $article->author()->toPage()->title();
|
$author = $article->author()->toPage() == null ? 'inconnu' : $article->author()->toPage()->title();
|
||||||
?>
|
?>
|
||||||
|
|
@ -48,9 +49,11 @@
|
||||||
|
|
||||||
<span class="light">publié le </span><?php echo $article->published()->toDate('d/m/Y') ?><br>
|
<span class="light">publié le </span><?php echo $article->published()->toDate('d/m/Y') ?><br>
|
||||||
|
|
||||||
<span class="light">dans</span> <a
|
<span class="light">dans</span>
|
||||||
href="<?= $article->parent()->url() ?>"><?= $article->parent()->title() ?></a>
|
<?php foreach(allYears($article) as $year): ?>
|
||||||
/ <a
|
<a href="<?= $year->url() ?>"><?= $year->title() ?></a> /
|
||||||
|
<?php endforeach ?>
|
||||||
|
<a
|
||||||
href="/categories/<?= Str::slug($article->category()) ?>"><?= $article->category() ?></a>
|
href="/categories/<?= Str::slug($article->category()) ?>"><?= $article->category() ?></a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,11 @@
|
||||||
<span class="light">par</span>
|
<span class="light">par</span>
|
||||||
<a class="author" href="/auteurs/<?= Str::slug($article->author()->toPage()->title()) ?>"><?= $article->author()->toPage()->title() ?></a><br>
|
<a class="author" href="/auteurs/<?= Str::slug($article->author()->toPage()->title()) ?>"><?= $article->author()->toPage()->title() ?></a><br>
|
||||||
<span class="light">publié le </span><?= $article->published()->toDate('d/m/Y') ?><br>
|
<span class="light">publié le </span><?= $article->published()->toDate('d/m/Y') ?><br>
|
||||||
<span class="light">dans</span> <a href="<?= $article->parent()->url() ?>"><?= $article->parent()->title() ?></a> / <a href="/categories/<?= $article->category() ?>"><?= $article->category() ?></a>
|
<span class="light">dans</span>
|
||||||
|
<?php foreach(allYears($article) as $year): ?>
|
||||||
|
<a href="<?= $year->url() ?>"><?= $year->title() ?></a> /
|
||||||
|
<?php endforeach ?>
|
||||||
|
<a href="/categories/<?= $article->category() ?>"><?= $article->category() ?></a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
@ -23,7 +23,11 @@
|
||||||
<div class="text__infos">
|
<div class="text__infos">
|
||||||
<p>
|
<p>
|
||||||
<span class="light">publié le </span><?= $article->published()->toDate('d/m/Y') ?><br>
|
<span class="light">publié le </span><?= $article->published()->toDate('d/m/Y') ?><br>
|
||||||
<span class="light">dans</span> <a href="<?= $article->parent()->url() ?>"><?= $article->parent()->title() ?></a> / <a href="/categories/<?= $article->category() ?>"><?= $article->category() ?></a>
|
<span class="light">dans</span>
|
||||||
|
<?php foreach(allYears($article) as $year): ?>
|
||||||
|
<a href="<?= $year->url() ?>"><?= $year->title() ?></a> /
|
||||||
|
<?php endforeach ?>
|
||||||
|
<a href="/categories/<?= $article->category() ?>"><?= $article->category() ?></a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
||||||
|
|
@ -27,9 +27,11 @@
|
||||||
href="/auteurs/<?= Str::slug($article->author()->toPage()->title()) ?>"><?= $article->author()->toPage()->title() ?></a><br>
|
href="/auteurs/<?= Str::slug($article->author()->toPage()->title()) ?>"><?= $article->author()->toPage()->title() ?></a><br>
|
||||||
<span class="light">publié le
|
<span class="light">publié le
|
||||||
</span><?= $article->published()->toDate('d/m/Y') ?><br>
|
</span><?= $article->published()->toDate('d/m/Y') ?><br>
|
||||||
<span class="light">dans</span> <a
|
<span class="light">dans</span>
|
||||||
href="<?= $article->parent()->url() ?>"><?= $article->parent()->title() ?></a>
|
<?php foreach(allYears($article) as $year): ?>
|
||||||
/ <a
|
<a href="<?= $year->url() ?>"><?= $year->title() ?></a> /
|
||||||
|
<?php endforeach ?>
|
||||||
|
<a
|
||||||
href="/categories/<?= $article->category() ?>"><?= $article->category() ?></a>
|
href="/categories/<?= $article->category() ?>"><?= $article->category() ?></a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,11 @@
|
||||||
href="/auteurs/<?= Str::slug($page->author()->toPage()->title()) ?>"><?= $page->author()->toPage()->title() ?></a><br>
|
href="/auteurs/<?= Str::slug($page->author()->toPage()->title()) ?>"><?= $page->author()->toPage()->title() ?></a><br>
|
||||||
<span class="light">publié le
|
<span class="light">publié le
|
||||||
</span><?= $page->published()->toDate('d/m/Y') ?><br>
|
</span><?= $page->published()->toDate('d/m/Y') ?><br>
|
||||||
<span class="light">dans</span> <a
|
<span class="light">dans</span>
|
||||||
href="<?= $page->parent()->url() ?>"><?= $page->parent()->title() ?></a>
|
<?php foreach(allYears($page) as $year): ?>
|
||||||
/ <a
|
<a href="<?= $year->url() ?>"><?= $year->title() ?></a> /
|
||||||
|
<?php endforeach ?>
|
||||||
|
<a
|
||||||
href="/categories/<?= $page->category() ?>"><?= $page->category() ?></a>
|
href="/categories/<?= $page->category() ?>"><?= $page->category() ?></a>
|
||||||
</p>
|
</p>
|
||||||
<?php endslot() ?>
|
<?php endslot() ?>
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,11 @@
|
||||||
href="/auteurs/<?= Str::slug($page->author()->toPage()->title()) ?>"><?= $page->author()->toPage()->title() ?></a><br>
|
href="/auteurs/<?= Str::slug($page->author()->toPage()->title()) ?>"><?= $page->author()->toPage()->title() ?></a><br>
|
||||||
<span class="light">publié le
|
<span class="light">publié le
|
||||||
</span><?= $page->published()->toDate('d/m/Y') ?><br>
|
</span><?= $page->published()->toDate('d/m/Y') ?><br>
|
||||||
<span class="light">dans</span> <a
|
<span class="light">dans</span>
|
||||||
href="<?= $page->parent()->url() ?>"
|
<?php foreach(allYears($page) as $year): ?>
|
||||||
title="voir les textes liés à l'année <?= $page->parent()->title() ?>"><?= $page->parent()->title() ?></a>
|
<a href="<?= $year->url() ?>" title="voir les textes liés à l'année <?= $year->title() ?>"><?= $year->title() ?></a> /
|
||||||
/ <a href="/categories/<?= Str::slug($page->category()) ?>"
|
<?php endforeach ?>
|
||||||
|
<a href="/categories/<?= Str::slug($page->category()) ?>"
|
||||||
title="voir les textes de la catégorie <?= $page->category() ?>"><?= $page->category() ?></a>
|
title="voir les textes de la catégorie <?= $page->category() ?>"><?= $page->category() ?></a>
|
||||||
</p>
|
</p>
|
||||||
<?php endslot() ?>
|
<?php endslot() ?>
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
>Lire</button>
|
>Lire</button>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<ul class="texts">
|
<ul class="texts">
|
||||||
<?php foreach($page->children() as $article): ?>
|
<?php foreach($page->allTexts() as $article): ?>
|
||||||
<li
|
<li
|
||||||
class="text"
|
class="text"
|
||||||
>
|
>
|
||||||
|
|
@ -40,7 +40,11 @@
|
||||||
<span class="light">par</span>
|
<span class="light">par</span>
|
||||||
<a class="author" href="/auteurs/<?= Str::slug($article->author()->toPage()->title()) ?>"><?= $article->author()->toPage()->title() ?></a><br>
|
<a class="author" href="/auteurs/<?= Str::slug($article->author()->toPage()->title()) ?>"><?= $article->author()->toPage()->title() ?></a><br>
|
||||||
<span class="light">publié le </span><?= $article->published()->toDate('d/m/Y') ?><br>
|
<span class="light">publié le </span><?= $article->published()->toDate('d/m/Y') ?><br>
|
||||||
<span class="light">dans</span> <a href="<?= $article->parent()->url() ?>"><?= $article->parent()->title() ?></a> / <a href="/categories/<?= $article->category() ?>"><?= $article->category() ?></a>
|
<span class="light">dans</span>
|
||||||
|
<?php foreach(allYears($article) as $year):?>
|
||||||
|
<a href="<?= $year->url() ?>"><?= $year->title() ?></a> /
|
||||||
|
<?php endforeach ?>
|
||||||
|
<a href="/categories/<?= $article->category() ?>"><?= $article->category() ?></a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue