Proper breadcrumb with last modified datetime

This commit is contained in:
echarp 2022-11-21 11:34:14 +01:00
parent f1dd0bac0f
commit 9bc86f5217
19 changed files with 106 additions and 38 deletions

View File

@ -18,5 +18,5 @@ esac
case $2 in case $2 in
*.md|*.result|*.jpg|*.png|*.gif) ;; *.md|*.result|*.jpg|*.png|*.gif) ;;
*.*) echo "Deleting $1/$2" && rm "$1/$2";; *.*) rm "$1/$2";;
esac esac

View File

@ -21,10 +21,6 @@ ServerSignature Off
ServerName edit.acoeur ServerName edit.acoeur
Protocols h2 h2c http/1.1 Protocols h2 h2c http/1.1
Header add Access-Control-Allow-Origin "*"
Header add Access-Control-Allow-Methods "HEAD, GET, POST, PUT, OPTIONS, DELETE"
Header add Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept, API-Key, Authorization, X-Test"
DocumentRoot /var/simpleWeb/apps/acoeur/content DocumentRoot /var/simpleWeb/apps/acoeur/content
<Directory /var/simpleWeb/apps/acoeur/content> <Directory /var/simpleWeb/apps/acoeur/content>
# This is special, anybody can see and edit it! # This is special, anybody can see and edit it!
@ -35,4 +31,8 @@ ServerSignature Off
# So that simple web editor can display eventual errors # So that simple web editor can display eventual errors
Alias /app.log /var/simpleWeb/apps/acoeur/public/app.log Alias /app.log /var/simpleWeb/apps/acoeur/public/app.log
Header set Access-Control-Allow-Origin acoeur
Header set Access-Control-Allow-Methods "HEAD, GET, POST, PUT, OPTIONS, DELETE"
Header set Access-Control-Allow-Headers *
</VirtualHost> </VirtualHost>

View File

@ -1,7 +1,6 @@
title: moteur acoeur title: moteur acoeur
languageCode: fr languageCode: fr
theme: [acoeur, ananke] theme: [acoeur, ananke]
baseURL: http://acoeur
DefaultContentLanguage: fr DefaultContentLanguage: fr
enableRobotsTXT: true enableRobotsTXT: true
@ -12,6 +11,14 @@ params:
custom_css: [custom.css] custom_css: [custom.css]
description: Votre outil d'écriture description: Votre outil d'écriture
recent_posts_number: 50 recent_posts_number: 50
site_logo: date_format: 02/01/2006 15:04:05
frontmatter:
date:
- date
- publishDate
- lastmod
- :fileModTime
- :default
markup.goldmark.renderer.unsafe: true markup.goldmark.renderer.unsafe: true

View File

@ -1,5 +1,5 @@
--- ---
title: Ressources title: Ressources
description: Images et autres éléments pour agrémenter vos pages description: Images et autres éléments pour agrémenter vos pages
featured_image: /penguins.jpg featured_image: penguins.jpg
--- ---

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

5
content/pages/_index.md Normal file
View File

@ -0,0 +1,5 @@
---
title: Quiz
---
Ici vous trouverez vos différents quiz, qui contiennent questions et badges qui seront transmis aux joueurs.

View File

@ -1,3 +1,3 @@
--- ---
title: Utilisateurs title: Joueurs
--- ---

View File

@ -3,18 +3,22 @@
} }
.breadcrumb { .breadcrumb {
display: none;
}
body.author .breadcrumb {
display: initial;
}
.breadcrumb ol {
padding: 0; padding: 0;
margin-top: 0; margin-top: 0;
list-style: none;
} }
.breadcrumb li { .breadcrumb li {
display: inline; display: inline;
} }
.breadcrumb li + li:before { .breadcrumb li + li:before {
content: ">"; content: ">";
padding-left: 0.3rem; padding-left: 0.3rem;
padding-right: 0.5rem;
} }
dl { dl {
@ -36,7 +40,7 @@ dd {
font-weight: bold; font-weight: bold;
} }
body.choosing { body.sleeping {
background-color: black; background-color: black;
} }

View File

@ -2,7 +2,7 @@ document.querySelectorAll('aside#actions #create')
.forEach(elt => elt.onclick = () => { .forEach(elt => elt.onclick = () => {
const url = `${topSection}/${uuid()}` const url = `${topSection}/${uuid()}`
fetch(`${document.body.dataset.editHost}${url}.create`, { method: 'PUT', body: topSection }) fetch(`${document.body.dataset.editHost}/${url}.create`, { method: 'PUT', body: topSection })
.then(() => sleep(1)) .then(() => sleep(1))
.then(() => window.location.assign('/' + url)) .then(() => window.location.assign('/' + url))
.catch(error => console.error(`Error creating #{topSection}`, error)) .catch(error => console.error(`Error creating #{topSection}`, error))
@ -24,10 +24,12 @@ document.querySelectorAll('aside#actions input#file')
fetch(document.body.dataset.editUrl.replace('_index', file.name), { method: 'PUT', body: file }) fetch(document.body.dataset.editUrl.replace('_index', file.name), { method: 'PUT', body: file })
.then(() => sleep(1)) .then(() => sleep(1))
.then(() => window.location.reload()) .then(() => window.location.reload())
.catch(error => console.error(`Error uploading #{elt.files[0].name}`, error)))) .catch(error => console.error(`Error uploading ${elt.files[0].name}`, error))))
document.querySelectorAll('.delete_image') document.querySelectorAll('.delete_image')
.forEach(elt => elt.onclick = () => .forEach(elt => elt.onclick = () => {
fetch(document.body.dataset.editHost + elt.dataset.target, { method: 'DELETE' }) if (confirm(elt.dataset.confirm))
.finally(() => elt.parentNode.remove()) fetch(document.body.dataset.editHost + elt.dataset.target, { method: 'DELETE' })
.catch(error => console.error(`Error deleting file`, error))) .catch(error => console.error(error))
.finally(() => elt.parentNode.remove())
})

View File

@ -4,7 +4,6 @@ document.querySelectorAll('body.users .ac_choice input[type=radio]')
method: 'PUT', method: 'PUT',
body: new URLSearchParams(new FormData(elt.form)) body: new URLSearchParams(new FormData(elt.form))
}) })
.then(() => document.body.classList.add('choosing'))
.then(() => sleep(1)) .then(() => sleep(1))
.then(() => fetch(document.body.dataset.editUrl + '.result')) .then(() => fetch(document.body.dataset.editUrl + '.result'))
.then(response => response.text()) .then(response => response.text())

View File

@ -1 +1,7 @@
const sleep = (seconds) => new Promise(resolve => setTimeout(() => resolve(), seconds * 1000)) const sleep = (seconds) => new Promise(resolve => {
document.body.classList.add('sleeping')
setTimeout(() => {
document.body.classList.remove('sleeping')
resolve()
}, seconds * 1000)
})

View File

@ -18,7 +18,7 @@ const pages = document.getElementById('pages')
prepareChoiceEdition = (node) => { prepareChoiceEdition = (node) => {
// Load list of pages from which authors can select results' page // Load list of pages from which authors can select results' page
if (node.list && !node.dataset.old && !pages.children.length) if (node.list && !node.dataset.old && !pages.children.length)
fetch(`${editHost}pages.txt`, { cache: 'no-store' }) fetch(`${editHost}/pages.txt`, { cache: 'no-store' })
.then(pages => pages.text()) .then(pages => pages.text())
.then(pages => pages.split('\n') .then(pages => pages.split('\n')
.filter(line => line) .filter(line => line)

View File

@ -1,8 +1,8 @@
document.body.dataset.editHost = window.location.protocol document.body.dataset.editHost = window.location.protocol
+ '//edit.' + '//edit.'
+ window.location.host + window.location.host
+ '/'
document.body.dataset.editUrl = document.body.dataset.editHost document.body.dataset.editUrl = document.body.dataset.editHost
+ '/'
+ file.replace('.md', '') + file.replace('.md', '')
const topSection = window.location.pathname.split('/')[1] const topSection = window.location.pathname.split('/')[1]

View File

@ -3,11 +3,11 @@ update: Modifier
delete: Supprimer delete: Supprimer
pages: pages:
create: Créer un nouveau chapitre create: Créer un nouveau quiz
delete: Supprimer chapitre delete: Supprimer quiz
users: users:
create: Créer un nouvel utilisateur create: Créer un nouveau joueur
delete: Supprimer utilisateur delete: Supprimer joueur
send: Envoyer invitation send: Envoyer invitation
assets: assets:
create: Transmettre une image create: Transmettre une image

View File

@ -17,7 +17,9 @@
<div class="relative w-100 w-30-l mb4 bg-white"> <div class="relative w-100 w-30-l mb4 bg-white">
<img src="{{ .RelPermalink }}" title="{{.}}" alt="{{.}}" /> <img src="{{ .RelPermalink }}" title="{{.}}" alt="{{.}}" />
{{ . }} {{ . }}
<button class="delete_image br-pill pa3 pointer" data-target="{{.RelPermalink}}"> <button class="delete_image br-pill pa3 pointer"
data-confirm="?"
data-target="{{.RelPermalink}}">
{{ T (print $.Section ".delete") }} {{ T (print $.Section ".delete") }}
</button> </button>
</div> </div>

View File

@ -0,0 +1,45 @@
{{ define "main" }}
<article class="pa3 pa4-ns nested-copy-line-height">
<aside id="actions" class="w-30-l mt4-l fr tc">
{{ if .Parent.IsHome }}
<button id="create"
class="br-pill f6 link dim br3 ph3 pv2 mb2 dib white bg-dark-gray pointer">
{{ T (print .Section ".create") }}
</button>
{{ else if .Parent.Parent.IsHome }}
<button id="delete"
class="br-pill f6 link dim br3 ph3 pv2 mb2 dib white bg-dark-gray pointer author-only"
data-confirm="{{ T (print .Section ".delete") }}?">
{{ T (print .Section ".delete") }}
</button>
{{ end }}
</aside>
{{ with .Content }}
<section id="content"
class="cf ph3 ph5-l pv3 pv4-l f4 tc-l center measure-wide lh-copy {{ $.Param "text_color" | default "mid-gray" }}">
{{- . -}}
</section>
{{ end }}
<section class="flex-ns flex-wrap justify-around">
{{ if .Parent.IsHome }}
{{ range .Sections }}
<div class="relative w-100 w-30-l mb4 bg-white">
{{ .Render "summary-with-image" }}
</div>
{{ end }}
{{ else }}
{{ range (.Paginate .RegularPagesRecursive).Pages }}
<div class="relative w-100 mb4 bg-white">
{{ .Render "summary-with-image" }}
</div>
{{ end }}
{{- template "_internal/pagination.html" . -}}
{{ end }}
</section>
</article>
{{ end }}

View File

@ -12,14 +12,8 @@
</div> </div>
{{ end }} {{ end }}
<div class="blah w-100{{ if $featured_image }} w-60-ns{{ end }}"> <div class="blah w-100{{ if $featured_image }} w-60-ns{{ end }}">
{{ if .IsPage }} {{ if and (eq .Section "users") (.IsPage) }}
{{ partial "breadcrumb" . }} <div class="breadcrumb">{{- partial "breadcrumb" . -}}</div>
{{ end }}
{{ if .Date }}
<div class="f6">
{{ .Date | time.Format (default "Monday 2 January 2006" .Site.Params.date_format) }}
</div>
{{ end }} {{ end }}
<h1 class="f3 fw1 athelas mt0 lh-title"> <h1 class="f3 fw1 athelas mt0 lh-title">

View File

@ -1,4 +1,8 @@
<ol class="nav navbar-nav breadcrumb"> <time class="db f6 fr" datetime="{{ .Date }}">
{{ .Date | time.Format .Site.Params.date_format }}
</time>
<ol class="nav navbar-nav">
{{ template "breadcrumbnav" (dict "p1" . "p2" .) }} {{ template "breadcrumbnav" (dict "p1" . "p2" .) }}
</ol> </ol>
{{ define "breadcrumbnav" }} {{ define "breadcrumbnav" }}