Cover pages

This commit is contained in:
echarp 2022-12-29 22:01:40 +01:00
parent a69e6c702f
commit 816e74b35f
6 changed files with 14 additions and 4 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

View File

@ -6,6 +6,7 @@ ac_choices:
- "[Un crin de la licorne retrouvée morte dans la forêt interdite plus loin dans l'histoire](/pages/1er-quiz/erreur)"
- "[Une plume d'un phénix dont on ne connait pas le nom ni l'histoire](/pages/1er-quiz/erreur)"
- "[Une écaille de Nagini, le serpent de Voldemort](/pages/1er-quiz/erreur)"
featured_image: ../../../../assets/pages/11c02a40-6caf-4b8f-8fea-115299695929.png
---
Qu'y a-t-il à l'intérieur de la baguette d'Harry?

View File

@ -29,8 +29,8 @@ document.querySelectorAll('aside#actions #delete')
document.querySelectorAll('aside#actions input#cover')
.forEach(elt => elt.onchange = () => {
const header = document.querySelector('body > header')
const url = `/assets/users/${uuid()}.${elt.files[0].name.split('.').reverse()[0]}`
const body = `featured_image: ../..${url}`
const url = `/assets/${elt.dataset.section}/${uuid()}.${elt.files[0].name.split('.').reverse()[0]}`
const body = `featured_image: ../../../..${url}`
fetch(`/edit${url}`, { method: 'PUT', body: elt.files[0] })
.then(() => fetch(`${document.body.dataset.editUrl}.prop`, { method: 'PUT', body: body }))

View File

@ -4,6 +4,7 @@ delete: 🗑 Supprimer
pages:
create: 📝 Créer un nouveau quiz
cover: 🖼️ Couverture
delete: 🗑 Supprimer quiz
users:
create: 👤 Créer un nouveau joueur

View File

@ -9,8 +9,16 @@
{{- partial "tags.html" . -}}
</div>
<aside class="w-30-l mt6-l">
<aside id="actions" class="w-30-l mt6-l">
{{- partial "menu-contextual.html" . -}}
{{ $user := eq .Section "users" }}
{{ if not $user }}
<button class="br-pill f6 link dim pa3 mb2 dib white bg-dark-gray pointer">
<label for="cover">{{ T (print .Section ".cover") }}</label>
</button>
<input id="cover" name="cover" type="file" data-section="{{ .Section }}"/>
{{ end }}
</aside>
</article>
{{ end }}

View File

@ -12,7 +12,7 @@
<button class="br-pill f6 link dim pa3 mb2 dib white bg-dark-gray pointer">
<label for="cover">{{ T (print .Section ".cover") }}</label>
</button>
<input id="cover" name="cover" type="file"/>
<input id="cover" name="cover" type="file" data-section="{{ .Section }}"/>
<button id="delete"
class="br-pill f6 link dim pa3 mb2 dib white bg-dark-gray pointer"