Ajout de la description et author
This commit is contained in:
parent
f90559a543
commit
d071ebbb1b
4 changed files with 47 additions and 0 deletions
|
|
@ -415,6 +415,18 @@ camp-feature .feature-widgets > * {
|
||||||
margin-bottom: 2em;
|
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 {
|
camp-feature .widget > :first-child {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
13
js/feature-widgets/author.js
Normal file
13
js/feature-widgets/author.js
Normal 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
|
||||||
|
}
|
||||||
|
}
|
||||||
17
js/feature-widgets/description.js
Normal file
17
js/feature-widgets/description.js
Normal 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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
|
import { authorWidget } from "./author.js"
|
||||||
import { campingCarsWidget } from "./camping-cars.js"
|
import { campingCarsWidget } from "./camping-cars.js"
|
||||||
import { capaciteDortoirWidget } from "./capacite-dortoir.js"
|
import { capaciteDortoirWidget } from "./capacite-dortoir.js"
|
||||||
import { capaciteEspaceWidget } from "./capacite-espace.js"
|
import { capaciteEspaceWidget } from "./capacite-espace.js"
|
||||||
import { capaciteParkingWidget } from "./capacite-parking.js"
|
import { capaciteParkingWidget } from "./capacite-parking.js"
|
||||||
import { deposeMinuteWidget } from "./depose-minute.js"
|
import { deposeMinuteWidget } from "./depose-minute.js"
|
||||||
|
import { descriptionWiget } from "./description.js"
|
||||||
import { mixiteChoisieWidget } from "./mixite-choisie.js"
|
import { mixiteChoisieWidget } from "./mixite-choisie.js"
|
||||||
import { upcomingTalksWidget } from "./upcoming-talks.js"
|
import { upcomingTalksWidget } from "./upcoming-talks.js"
|
||||||
import { zoneInterditeWidget } from "./zone-interdite.js"
|
import { zoneInterditeWidget } from "./zone-interdite.js"
|
||||||
|
|
@ -11,6 +13,9 @@ export const FEATURE_WIDGETS = [
|
||||||
// Boxes
|
// Boxes
|
||||||
mixiteChoisieWidget,
|
mixiteChoisieWidget,
|
||||||
zoneInterditeWidget,
|
zoneInterditeWidget,
|
||||||
|
// Description
|
||||||
|
descriptionWiget,
|
||||||
|
authorWidget,
|
||||||
// Other
|
// Other
|
||||||
deposeMinuteWidget,
|
deposeMinuteWidget,
|
||||||
campingCarsWidget,
|
campingCarsWidget,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue