Ajout de la description et author

This commit is contained in:
EpicKiwi 2026-07-03 16:07:06 +02:00
parent f90559a543
commit d071ebbb1b
Signed by: epickiwi
GPG key ID: C4B28FD2729941CE
4 changed files with 47 additions and 0 deletions

View file

@ -415,6 +415,18 @@ camp-feature .feature-widgets > * {
margin-bottom: 2em;
}
camp-feature .feature-widgets > p:first-child {
margin-top: 0;
}
camp-feature .feature-widgets > p + p {
margin-top: -1em;
}
camp-feature .feature-widgets .author-widget {
text-align: right;
}
camp-feature .widget > :first-child {
margin-top: 0;
}

View file

@ -0,0 +1,13 @@
export function authorWidget(feature){
if(feature.properties["village"] && feature.properties["author"]){
let content = document.createElement("p")
content.classList.add("widget")
content.classList.add("author-widget")
let em = document.createElement("em")
em.textContent = "— " + feature.properties["author"]
content.append(em)
return content
}
}

View file

@ -0,0 +1,17 @@
export function descriptionWiget(feature){
if(feature.properties["description"]){
let content = document.createElement("p")
content.classList.add("widget")
content.classList.add("description-widget")
let lines = feature.properties["description"].split(/\r?\n/)
.flatMap((it, i, arr) => i < arr.length-1 ?
[document.createTextNode(it), document.createElement("br")] :
[document.createTextNode(it)]
);
content.replaceChildren(...lines)
return content
}
}

View file

@ -1,8 +1,10 @@
import { authorWidget } from "./author.js"
import { campingCarsWidget } from "./camping-cars.js"
import { capaciteDortoirWidget } from "./capacite-dortoir.js"
import { capaciteEspaceWidget } from "./capacite-espace.js"
import { capaciteParkingWidget } from "./capacite-parking.js"
import { deposeMinuteWidget } from "./depose-minute.js"
import { descriptionWiget } from "./description.js"
import { mixiteChoisieWidget } from "./mixite-choisie.js"
import { upcomingTalksWidget } from "./upcoming-talks.js"
import { zoneInterditeWidget } from "./zone-interdite.js"
@ -11,6 +13,9 @@ export const FEATURE_WIDGETS = [
// Boxes
mixiteChoisieWidget,
zoneInterditeWidget,
// Description
descriptionWiget,
authorWidget,
// Other
deposeMinuteWidget,
campingCarsWidget,