fix #14
This commit is contained in:
parent
6801286c5f
commit
aea050f6cc
8 changed files with 36 additions and 73 deletions
|
|
@ -10,7 +10,10 @@ tabs:
|
||||||
fields:
|
fields:
|
||||||
presentation:
|
presentation:
|
||||||
extends: fields/body
|
extends: fields/body
|
||||||
help: Optionnelle
|
label: Présentation
|
||||||
|
help: |
|
||||||
|
Optionnelle, sans mention du poste. Peut inclure un lien.
|
||||||
|
Exemple : "Co-fondateur des éditions [Athom](http://www.athom.xyz/)."
|
||||||
texts:
|
texts:
|
||||||
label: Textes
|
label: Textes
|
||||||
type: pages
|
type: pages
|
||||||
|
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
title: Auteur
|
|
||||||
description: Droits de lecture et écriture de certaines pages.
|
|
||||||
image:
|
|
||||||
icon: pen
|
|
||||||
color: "#FFF"
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
access:
|
|
||||||
*: false
|
|
||||||
files:
|
|
||||||
*: false
|
|
||||||
languages:
|
|
||||||
*: false
|
|
||||||
pages:
|
|
||||||
*: false
|
|
||||||
site:
|
|
||||||
*: false
|
|
||||||
user:
|
|
||||||
*: false
|
|
||||||
users:
|
|
||||||
*: false
|
|
||||||
|
|
||||||
fields:
|
|
||||||
presentation:
|
|
||||||
type: writer
|
|
||||||
|
|
@ -18,7 +18,6 @@ return array(
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'routes' => array(
|
'routes' => array(
|
||||||
require __DIR__ . '/routes/virtual-author.php',
|
|
||||||
require __DIR__ . '/routes/virtual-category.php',
|
require __DIR__ . '/routes/virtual-category.php',
|
||||||
require __DIR__ . '/routes/send-newsletter.php',
|
require __DIR__ . '/routes/send-newsletter.php',
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
use Kirby\Uuid\Uuid;
|
|
||||||
|
|
||||||
return [
|
|
||||||
'pattern' => 'auteurs/(:any)',
|
|
||||||
'action' => function ($slug) {
|
|
||||||
$kirby = kirby();
|
|
||||||
$author = getAuthorBySlug($slug);
|
|
||||||
|
|
||||||
return Page::factory(
|
|
||||||
[
|
|
||||||
'slug' => '',
|
|
||||||
'template' => 'author',
|
|
||||||
'model' => 'authors',
|
|
||||||
'content' => [
|
|
||||||
'title' => $author->name(),
|
|
||||||
'presentation' => $author->presentation(),
|
|
||||||
'author' => $author->name(),
|
|
||||||
'uuid' => Uuid::generate(),
|
|
||||||
]
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
@ -23,15 +23,9 @@ function setTitleFontSizeClass($title, $level = 'h1')
|
||||||
|
|
||||||
function getAuthorBySlug($slug)
|
function getAuthorBySlug($slug)
|
||||||
{
|
{
|
||||||
$kirby = kirby();
|
$site = site();
|
||||||
$author = '';
|
$authors = page("auteurs")->children();
|
||||||
foreach ($kirby->users() as $user) {
|
$author = $authors->find($slug);
|
||||||
|
|
||||||
if (Str::slug($user->name()) === $slug) {
|
|
||||||
|
|
||||||
$author = $user;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $author;
|
return $author;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,16 @@
|
||||||
<?php snippet('header'); ?>
|
<?php snippet('header'); ?>
|
||||||
|
|
||||||
<main id="<?= $page->template() ?>">
|
<main id="<?= $page->template() ?>">
|
||||||
<article>
|
<article>
|
||||||
<?php snippet('cover', slots: true) ?>
|
<?php snippet('cover', slots: true) ?>
|
||||||
<?php slot('text') ?>
|
<?php slot('title') ?>
|
||||||
<h2 class="main-title <?= setTitleFontSizeClass($page->title()) ?>"><?= $page->title() ?></h2>
|
<h2 class="main-title <?= setTitleFontSizeClass($page->title()) ?>"><?= $page->title() ?></h2>
|
||||||
<?= $page->presentation() ?>
|
<?= $page->presentation() ?>
|
||||||
|
<?php endslot() ?>
|
||||||
|
<?php endsnippet() ?>
|
||||||
|
<div id="main-content">
|
||||||
<p class="h3">textes :</p>
|
<p class="h3">textes :</p>
|
||||||
<ul class="texts">
|
<ul class="texts">
|
||||||
<?php foreach(page('textes')->grandChildren() as $article): ?>
|
<?php foreach(page('textes')->grandChildren() as $article): ?>
|
||||||
<?php
|
<?php
|
||||||
if ($article->author()->toPage()->title()->value() == $page->title()->value()): ?>
|
if ($article->author()->toPage()->title()->value() == $page->title()->value()): ?>
|
||||||
|
|
@ -19,17 +22,14 @@
|
||||||
</a>
|
</a>
|
||||||
<div class="text__infos">
|
<div class="text__infos">
|
||||||
<p>
|
<p>
|
||||||
<span class="light">par</span>
|
|
||||||
<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> <a href="<?= $article->parent()->url() ?>"><?= $article->parent()->title() ?></a> / <a href="/categories/<?= $article->category() ?>"><?= $article->category() ?></a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
</ul>
|
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
<?php endslot() ?>
|
</ul>
|
||||||
<?php endsnippet() ?>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
</main>
|
</main>
|
||||||
16
site/templates/error.php
Normal file
16
site/templates/error.php
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?php snippet('header') ?>
|
||||||
|
<main id="<?= $page->template() ?>">
|
||||||
|
<article>
|
||||||
|
<?php snippet('cover', array('isOpen' => true), slots: true) ?>
|
||||||
|
<?php slot('title') ?>
|
||||||
|
<h2 class="main-title <?= setTitleFontSizeClass("Page introuvable") ?>">Page introuvable</h2>
|
||||||
|
<p><a href="/">Retour à l'accueil</a></p>
|
||||||
|
<?php endslot() ?>
|
||||||
|
<?php endsnippet() ?>
|
||||||
|
<div id="main-content">
|
||||||
|
<?= $page->body() ?>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<?php snippet('footer') ?>
|
||||||
|
|
@ -12,6 +12,7 @@
|
||||||
</p>
|
</p>
|
||||||
<?php endslot() ?>
|
<?php endslot() ?>
|
||||||
<?php endsnippet() ?>
|
<?php endsnippet() ?>
|
||||||
|
|
||||||
<div id="main-content">
|
<div id="main-content">
|
||||||
<?= $page->body() ?>
|
<?= $page->body() ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue