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
*.md|*.result|*.jpg|*.png|*.gif) ;;
*.*) echo "Deleting $1/$2" && rm "$1/$2";;
*.*) rm "$1/$2";;
esac

View File

@ -21,10 +21,6 @@ ServerSignature Off
ServerName edit.acoeur
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
<Directory /var/simpleWeb/apps/acoeur/content>
# This is special, anybody can see and edit it!
@ -35,4 +31,8 @@ ServerSignature Off
# So that simple web editor can display eventual errors
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>

View File

@ -1,7 +1,6 @@
title: moteur acoeur
languageCode: fr
theme: [acoeur, ananke]
baseURL: http://acoeur
DefaultContentLanguage: fr
enableRobotsTXT: true
@ -12,6 +11,14 @@ params:
custom_css: [custom.css]
description: Votre outil d'écriture
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

View File

@ -1,5 +1,5 @@
---
title: Ressources
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 {
display: none;
}
body.author .breadcrumb {
display: initial;
}
.breadcrumb ol {
padding: 0;
margin-top: 0;
list-style: none;
}
.breadcrumb li {
display: inline;
}
.breadcrumb li + li:before {
content: ">";
padding-left: 0.3rem;
padding-right: 0.5rem;
}
dl {
@ -36,7 +40,7 @@ dd {
font-weight: bold;
}
body.choosing {
body.sleeping {
background-color: black;
}

View File

@ -2,7 +2,7 @@ document.querySelectorAll('aside#actions #create')
.forEach(elt => elt.onclick = () => {
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(() => window.location.assign('/' + url))
.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 })
.then(() => sleep(1))
.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')
.forEach(elt => elt.onclick = () =>
fetch(document.body.dataset.editHost + elt.dataset.target, { method: 'DELETE' })
.finally(() => elt.parentNode.remove())
.catch(error => console.error(`Error deleting file`, error)))
.forEach(elt => elt.onclick = () => {
if (confirm(elt.dataset.confirm))
fetch(document.body.dataset.editHost + elt.dataset.target, { method: 'DELETE' })
.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',
body: new URLSearchParams(new FormData(elt.form))
})
.then(() => document.body.classList.add('choosing'))
.then(() => sleep(1))
.then(() => fetch(document.body.dataset.editUrl + '.result'))
.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) => {
// Load list of pages from which authors can select results' page
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.split('\n')
.filter(line => line)

View File

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

View File

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

View File

@ -17,7 +17,9 @@
<div class="relative w-100 w-30-l mb4 bg-white">
<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") }}
</button>
</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>
{{ end }}
<div class="blah w-100{{ if $featured_image }} w-60-ns{{ end }}">
{{ if .IsPage }}
{{ partial "breadcrumb" . }}
{{ end }}
{{ if .Date }}
<div class="f6">
{{ .Date | time.Format (default "Monday 2 January 2006" .Site.Params.date_format) }}
</div>
{{ if and (eq .Section "users") (.IsPage) }}
<div class="breadcrumb">{{- partial "breadcrumb" . -}}</div>
{{ end }}
<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" .) }}
</ol>
{{ define "breadcrumbnav" }}