From ec32aca0bba068eaa3b49bd8bd6c45d3be11c20b Mon Sep 17 00:00:00 2001 From: Simon Martens Date: Fri, 7 Mar 2025 12:44:53 +0100 Subject: [PATCH] BUGFIX: lots of small things --- migrations/seed/entries.go | 2 +- pagemodels/pagedata.go | 4 +- .../1739446703_insert_data_dokumentation.go | 4 +- .../1739446703_insert_data_einfuehrung.go | 2 +- pages/static.go | 4 +- views/assets/scripts.js | 129 +++++++++++------- views/layouts/components/_menu.gohtml | 12 +- views/routes/person/body.gohtml | 7 +- .../body.gohtml | 0 .../head.gohtml | 0 .../{einfuehrung => einleitung}/body.gohtml | 0 .../{einfuehrung => einleitung}/head.gohtml | 0 .../suche/components/_infotextsimple.gohtml | 6 +- .../suche/components/_musenalmidbox.gohtml | 6 +- views/transform/main.js | 91 +++++++++++- 15 files changed, 199 insertions(+), 68 deletions(-) rename views/routes/redaktion/{dokumentation => benutzerhinweise}/body.gohtml (100%) rename views/routes/redaktion/{dokumentation => benutzerhinweise}/head.gohtml (100%) rename views/routes/redaktion/{einfuehrung => einleitung}/body.gohtml (100%) rename views/routes/redaktion/{einfuehrung => einleitung}/head.gohtml (100%) diff --git a/migrations/seed/entries.go b/migrations/seed/entries.go index 6457448..dac3f8a 100644 --- a/migrations/seed/entries.go +++ b/migrations/seed/entries.go @@ -101,7 +101,7 @@ func handlePreferredTitleEntry( if band.Jahr == 0 { jahr = "[o. J.]" } else { - jahr = "(" + jahr + ")" + jahr = jahr } bevti := slices.IndexFunc(rels, func(r xmlmodels.Relation_Band_Reihe) bool { return r.Relation == "1" }) diff --git a/pagemodels/pagedata.go b/pagemodels/pagedata.go index 1647412..11ecd86 100644 --- a/pagemodels/pagedata.go +++ b/pagemodels/pagedata.go @@ -15,9 +15,9 @@ const ( P_DANK_NAME = "danksagungen" P_KONTAKT_NAME = "kontakt" P_LIT_NAME = "literatur" - P_EINFUEHRUNG_NAME = "einfuehrung" + P_EINFUEHRUNG_NAME = "einleitung" - P_DOK_NAME = "dokumentation" + P_DOK_NAME = "benutzerhinweise" T_ABK_NAME = "abkuerzungen" F_ABK = "Abkuerzung" diff --git a/pages/migrations_dokumentation/1739446703_insert_data_dokumentation.go b/pages/migrations_dokumentation/1739446703_insert_data_dokumentation.go index 6d1dc45..fa4be5f 100644 --- a/pages/migrations_dokumentation/1739446703_insert_data_dokumentation.go +++ b/pages/migrations_dokumentation/1739446703_insert_data_dokumentation.go @@ -12,7 +12,7 @@ import ( m "github.com/pocketbase/pocketbase/migrations" ) -const BESCHREIBUNG = "Musenalm: Verzeichnis deutschsprachiger Almanache des 18. und 19. Jahrhunderts. Dokumentation zur Sortierung und Struktur der Almanache." +const BESCHREIBUNG = "Musenalm: Verzeichnis deutschsprachiger Almanache des 18. und 19. Jahrhunderts. Dokumentation der Sortierung und Struktur der Almanache." const START = `

Sortierung der Reihentitel

Wir sortieren die Reihentitel nach dem Kopf der Nominalphrase, den wir zu diesem Zweck ggf. an den Anfang stellen und mit Kommas abtrennen.

@@ -494,7 +494,7 @@ func init() { } record := pagemodels.NewTextPage(core.NewRecord(collection)) - record.SetTitle("Dokumentation") + record.SetTitle("Benutzerhinweise") record.SetText(START) record.SetDescription(BESCHREIBUNG) diff --git a/pages/migrations_einfuehrung/1739446703_insert_data_einfuehrung.go b/pages/migrations_einfuehrung/1739446703_insert_data_einfuehrung.go index 0c3d36c..eb6743e 100644 --- a/pages/migrations_einfuehrung/1739446703_insert_data_einfuehrung.go +++ b/pages/migrations_einfuehrung/1739446703_insert_data_einfuehrung.go @@ -42,7 +42,7 @@ func init() { } record := pagemodels.NewTextPage(core.NewRecord(collection)) - record.SetTitle("Einführung") + record.SetTitle("Einleitung") record.SetText(START) record.SetDescription(BESCHREIBUNG) diff --git a/pages/static.go b/pages/static.go index 12fc5f0..87db337 100644 --- a/pages/static.go +++ b/pages/static.go @@ -11,8 +11,8 @@ func init() { RegisterTextPage("/redaktion/kontakt/", pagemodels.P_KONTAKT_NAME) RegisterTextPage("/redaktion/danksagungen/", pagemodels.P_DANK_NAME) RegisterTextPage("/redaktion/literatur/", pagemodels.P_LIT_NAME) - RegisterTextPage("/redaktion/einfuehrung/", pagemodels.P_EINFUEHRUNG_NAME) - RegisterTextPage("/redaktion/dokumentation/", pagemodels.P_DOK_NAME) + RegisterTextPage("/redaktion/einleitung/", pagemodels.P_EINFUEHRUNG_NAME) + RegisterTextPage("/redaktion/benutzerhinweise/", pagemodels.P_DOK_NAME) RegisterTextPage("/redaktion/lesekabinett/", pagemodels.P_KABINETT_NAME) } diff --git a/views/assets/scripts.js b/views/assets/scripts.js index 76bf5c0..429803f 100644 --- a/views/assets/scripts.js +++ b/views/assets/scripts.js @@ -1,18 +1,18 @@ -var x = (r) => { +var T = (r) => { throw TypeError(r); }; -var _ = (r, t, e) => t.has(r) || x("Cannot " + e); -var c = (r, t, e) => (_(r, t, "read from private field"), e ? e.call(r) : t.get(r)), n = (r, t, e) => t.has(r) ? x("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(r) : t.set(r, e), u = (r, t, e, i) => (_(r, t, "write to private field"), i ? i.call(r, e) : t.set(r, e), e), g = (r, t, e) => (_(r, t, "access private method"), e); -const S = "script[xslt-onload]", w = "xslt-template", k = "xslt-transformed", M = "filter-list", m = "filter-list-list", C = "filter-list-item", I = "filter-list-input", y = "filter-list-searchable", B = "scroll-button", q = "tool-tip", P = "abbrev-tooltips", H = "int-link", R = "popup-image", $ = "tab-list", N = "filter-pill", F = "image-reel"; +var _ = (r, t, e) => t.has(r) || T("Cannot " + e); +var c = (r, t, e) => (_(r, t, "read from private field"), e ? e.call(r) : t.get(r)), l = (r, t, e) => t.has(r) ? T("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(r) : t.set(r, e), u = (r, t, e, i) => (_(r, t, "write to private field"), i ? i.call(r, e) : t.set(r, e), e), g = (r, t, e) => (_(r, t, "access private method"), e); +const k = "script[xslt-onload]", y = "xslt-template", S = "xslt-transformed", M = "filter-list", m = "filter-list-list", B = "filter-list-item", C = "filter-list-input", w = "filter-list-searchable", I = "scroll-button", q = "tool-tip", P = "abbrev-tooltips", R = "int-link", H = "popup-image", $ = "tab-list", O = "filter-pill", N = "image-reel"; var d, b, E; class V { constructor() { - n(this, b); - n(this, d); + l(this, b); + l(this, d); u(this, d, /* @__PURE__ */ new Map()); } setup() { - let t = htmx.findAll(S); + let t = htmx.findAll(k); for (let e of t) g(this, b, E).call(this, e); } @@ -23,9 +23,9 @@ class V { } } d = new WeakMap(), b = new WeakSet(), E = function(t) { - if (t.getAttribute(k) === "true" || !t.hasAttribute(w)) + if (t.getAttribute(S) === "true" || !t.hasAttribute(y)) return; - let e = "#" + t.getAttribute(w), i = c(this, d).get(e); + let e = "#" + t.getAttribute(y), i = c(this, d).get(e); if (!i) { let h = htmx.find(e); if (h) { @@ -34,10 +34,10 @@ d = new WeakMap(), b = new WeakSet(), E = function(t) { } else throw new Error("Unknown XSLT template: " + e); } - let s = new DOMParser().parseFromString(t.innerHTML, "application/xml"), a = i.transformToFragment(s, document), l = new XMLSerializer().serializeToString(a); - t.outerHTML = l; + let s = new DOMParser().parseFromString(t.innerHTML, "application/xml"), a = i.transformToFragment(s, document), n = new XMLSerializer().serializeToString(a); + t.outerHTML = n; }; -class O extends HTMLElement { +class F extends HTMLElement { constructor() { super(), this._value = "", this.render(); } @@ -106,13 +106,13 @@ class O extends HTMLElement { `; } } -var o, T, f, L; +var o, x, f, L; class U extends HTMLElement { constructor() { super(); - n(this, f); - n(this, o, !1); - n(this, T, ""); + l(this, f); + l(this, o, !1); + l(this, x, ""); this._items = [], this._url = "", this._filterstart = !1, this._placeholder = "Liste filtern...", this._queryparam = "", this._startparams = null, this.render(); } static get observedAttributes() { @@ -157,7 +157,7 @@ class U extends HTMLElement { let e = this.querySelector("#" + m); if (!e) return; - let i = new Mark(e.querySelectorAll("." + y)); + let i = new Mark(e.querySelectorAll("." + w)); this._filter && i.mark(this._filter, { separateWordSearch: !0 }); @@ -197,7 +197,7 @@ class U extends HTMLElement { } getLinkText(e) { let i = this.getSearchText(e); - return i === "" ? "" : `${i}`; + return i === "" ? "" : `${i}`; } getURL(e) { if (this._queryparam) { @@ -232,7 +232,7 @@ class U extends HTMLElement { + class="${C} w-full placeholder:italic px-2 py-0.5" /> `; @@ -256,7 +256,7 @@ class U extends HTMLElement { hx-swap="outerHTML show:none" hx-select="main" hx-target="main" - class="${C} block px-2.5 py-0.5 hover:bg-slate-200 no-underline ${s % 2 === 0 ? "bg-stone-100" : "bg-stone-50"}" + class="${B} block px-2.5 py-0.5 hover:bg-slate-200 no-underline ${s % 2 === 0 ? "bg-stone-100" : "bg-stone-50"}" ${g(this, f, L).call(this, i) ? 'aria-current="page"' : ""}> ${this.ActiveDot(i)} ${this.getLinkText(i)} @@ -268,7 +268,7 @@ class U extends HTMLElement { `; } } -o = new WeakMap(), T = new WeakMap(), f = new WeakSet(), L = function(e) { +o = new WeakMap(), x = new WeakMap(), f = new WeakSet(), L = function(e) { if (!e) return !1; let i = this.getHREF(e); @@ -420,16 +420,27 @@ class z extends HTMLElement { } class G extends HTMLElement { constructor() { - super(), this.overlay = null, this._preview = null, this._description = null, this._imageURL = "", this._hideDLButton = !1; + super(), this.overlay = null, this._others = null, this._thisindex = -1, this._preview = null, this._description = null, this._imageURL = "", this._hideDLButton = !1; } connectedCallback() { this.classList.add("cursor-pointer"), this.classList.add("select-none"), this._imageURL = this.getAttribute("data-image-url") || "", this._hideDLButton = this.getAttribute("data-hide-dl-button") || !1, this._preview = this.querySelector("img"), this._description = this.querySelector(".image-description"), this._preview && this._preview.addEventListener("click", () => { this.showOverlay(); }); + let t = this.closest("image-reel, .image-reel"); + t || (t = document), this._others = Array.from(t.querySelectorAll("popup-image:not(.hidden)")), this._thisindex = this._others.indexOf(this); } disconnectedCallback() { this.overlay && this.overlay.parentNode && this.overlay.parentNode.removeChild(this.overlay); } + Keys(t) { + t.repeat || (t.preventDefault(), t.key === "ArrowRight" ? this.next() : t.key === "ArrowLeft" ? this.prev() : t.key === "Escape" && this.hideOverlay()); + } + next() { + this._others[this._thisindex + 1] ? (this.hideOverlay(), this._others[this._thisindex + 1].showOverlay()) : document.addEventListener("keydown", this.Keys.bind(this), { once: !0 }); + } + prev() { + this._others[this._thisindex - 1] ? (this.hideOverlay(), this._others[this._thisindex - 1].showOverlay()) : document.addEventListener("keydown", this.Keys.bind(this), { once: !0 }); + } showOverlay() { this.overlay = document.createElement("div"), this.overlay.classList.add( "fixed", @@ -444,10 +455,12 @@ class G extends HTMLElement {
- - ${this.downloadButton()} + ${this.downloadButton()} + ${this.nextButton()} + ${this.prevButton()}
`; - const t = this.overlay.querySelector("button"); + const t = this.overlay.querySelector("#closebutton"); t && t.addEventListener("click", () => { this.hideOverlay(); - }), this.overlay.addEventListener("click", (e) => { - e.target === this.overlay && this.hideOverlay(); - }), document.body.appendChild(this.overlay); + }); + const e = this.overlay.querySelector("#nextbtn"); + e && e.addEventListener("click", this.next.bind(this)); + const i = this.overlay.querySelector("#prevbtn"); + i && i.addEventListener("click", this.prev.bind(this)), this.overlay.addEventListener("click", (s) => { + s.target === this.overlay && this.hideOverlay(); + }), document.addEventListener("keydown", this.Keys.bind(this), { once: !0 }), document.body.appendChild(this.overlay); } descriptionImgClass() { return this.description ? "" : "0"; } + nextButton() { + return this._others[this._thisindex + 1] ? ` + + +
Nächstes Bild
+
+ ` : ""; + } + prevButton() { + return this._others[this._thisindex - 1] ? ` + + +
Vorheriges Bild
+
+ ` : ""; + } description() { return this._description ? `
@@ -489,7 +526,7 @@ class G extends HTMLElement { this.overlay.parentNode.removeChild(this.overlay), this.overlay = null; } } -class j extends HTMLElement { +class K extends HTMLElement { static get observedAttributes() { } constructor() { @@ -523,11 +560,11 @@ class j extends HTMLElement { this._showall = !0, this.shown = -1, this.disable(), this._contents.forEach((t, e) => { t.classList.remove("hidden"); let i = this._headings[e], s = i.querySelectorAll(".show-opened"); - for (let l of s) - l.classList.add("hidden"); + for (let n of s) + n.classList.add("hidden"); let a = i.querySelectorAll(".show-closed"); - for (let l of a) - l.classList.add("hidden"); + for (let n of a) + n.classList.add("hidden"); }); } default() { @@ -675,17 +712,17 @@ class p extends HTMLElement { } const a = this.findLongestAbbrevAt(t, s, e); if (a) { - const { match: l, meaning: h } = a; + const { match: n, meaning: h } = a; i += `
${h}
- ${l} + ${n}
- `, s += l.length; + `, s += n.length; } else i += t[s], s++; } @@ -693,15 +730,15 @@ class p extends HTMLElement { } findLongestAbbrevAt(t, e, i) { let s = null, a = 0; - for (const l of Object.keys(i)) - t.startsWith(l, e) && l.length > a && (s = l, a = l.length); + for (const n of Object.keys(i)) + t.startsWith(n, e) && n.length > a && (s = n, a = n.length); return s ? { match: s, meaning: i[s] } : null; } isSpaceOrPunct(t) { return /\s|[.,;:!?]/.test(t); } } -class K extends HTMLElement { +class j extends HTMLElement { constructor() { super(); } @@ -723,7 +760,7 @@ var v; class X extends HTMLElement { constructor() { super(); - n(this, v, 176); + l(this, v, 176); this._images = []; } connectedCallback() { @@ -745,15 +782,15 @@ class X extends HTMLElement { } } v = new WeakMap(); -customElements.define(H, K); +customElements.define(R, j); customElements.define(P, p); customElements.define(M, U); -customElements.define(B, D); +customElements.define(I, D); customElements.define(q, z); -customElements.define(R, G); -customElements.define($, j); -customElements.define(N, O); -customElements.define(F, X); +customElements.define(H, G); +customElements.define($, K); +customElements.define(O, F); +customElements.define(N, X); export { p as AbbreviationTooltips, U as FilterList, diff --git a/views/layouts/components/_menu.gohtml b/views/layouts/components/_menu.gohtml index 94a253f..bad9e73 100644 --- a/views/layouts/components/_menu.gohtml +++ b/views/layouts/components/_menu.gohtml @@ -63,18 +63,18 @@ class="submenu flex flex-row justify-end pt-3.5 gap-x-4 font-bold font-serif [&>a]:no-underline [&>*]:-mb-1.5 w-full pr-2.5 [&>*]:px-1.5"> EinführungEinleitung DokumentationBenutzerhinweise {{ $model.result.Agent.BiographicalData }} + {{- if $model.result.Agent.References }} + + {{ $model.result.Agent.References }} + + {{ end }} {{- $arr := $model.result.Agent.ProfessionArray -}} {{- if $arr -}} {{- range $i, $p := $arr -}} {{- $p -}} diff --git a/views/routes/redaktion/dokumentation/body.gohtml b/views/routes/redaktion/benutzerhinweise/body.gohtml similarity index 100% rename from views/routes/redaktion/dokumentation/body.gohtml rename to views/routes/redaktion/benutzerhinweise/body.gohtml diff --git a/views/routes/redaktion/dokumentation/head.gohtml b/views/routes/redaktion/benutzerhinweise/head.gohtml similarity index 100% rename from views/routes/redaktion/dokumentation/head.gohtml rename to views/routes/redaktion/benutzerhinweise/head.gohtml diff --git a/views/routes/redaktion/einfuehrung/body.gohtml b/views/routes/redaktion/einleitung/body.gohtml similarity index 100% rename from views/routes/redaktion/einfuehrung/body.gohtml rename to views/routes/redaktion/einleitung/body.gohtml diff --git a/views/routes/redaktion/einfuehrung/head.gohtml b/views/routes/redaktion/einleitung/head.gohtml similarity index 100% rename from views/routes/redaktion/einfuehrung/head.gohtml rename to views/routes/redaktion/einleitung/head.gohtml diff --git a/views/routes/suche/components/_infotextsimple.gohtml b/views/routes/suche/components/_infotextsimple.gohtml index 6bc8c6b..9cfa086 100644 --- a/views/routes/suche/components/_infotextsimple.gohtml +++ b/views/routes/suche/components/_infotextsimple.gohtml @@ -9,10 +9,10 @@ Die Suche durchsucht ganze Datensätze nach dem Vorkommen aller eingegebenen Suchbegriffe. Felder können oben einzeln aus der Suche ausgeschlossen werden. Auch partielle Treffer in Worten werden angezeigt. Wörter mit weniger als drei Zeichen, Sonderzeichen – auch Satzzeichen – - sowie Groß- und Kleinschreibung werden dabei ignoriert. Mit einem Minus [-] können Begiffe - ausgeschlossen, mit Anfühungsstrichen [""] zusammenhängende Phrasen gesucht werden + sowie Groß- und Kleinschreibung werden dabei ignoriert. Mit einem Minus [-] können Begriffe + ausgeschlossen, mit Anführungsstrichen [""] zusammenhängende Phrasen gesucht werden {{- if $extendable }} - (für eine genaue Eingenzung von Feldern s. die → + (für eine genaue Eingrenzung von Feldern s. die → erweiterte Suche) {{- end -}}.
diff --git a/views/routes/suche/components/_musenalmidbox.gohtml b/views/routes/suche/components/_musenalmidbox.gohtml index 3c0c46a..5973d59 100644 --- a/views/routes/suche/components/_musenalmidbox.gohtml +++ b/views/routes/suche/components/_musenalmidbox.gohtml @@ -16,7 +16,11 @@ name="almstring" id="almstring" value="{{ $p }}" - placeholder="Alm-Nummer" + placeholder="{{- if eq $t "baende" -}} + Alm-Nummer + {{- else -}} + Inhalts-Nummer + {{- end -}}" class="w-full col-span-3 placeholder:italic placeholder:font-sans" /> diff --git a/views/transform/main.js b/views/transform/main.js index 164327d..19edb47 100644 --- a/views/transform/main.js +++ b/views/transform/main.js @@ -730,6 +730,8 @@ class PopupImage extends HTMLElement { constructor() { super(); this.overlay = null; + this._others = null; + this._thisindex = -1; this._preview = null; this._description = null; this._imageURL = ""; @@ -749,6 +751,14 @@ class PopupImage extends HTMLElement { this.showOverlay(); }); } + + let enclosing = this.closest("image-reel, .image-reel"); + if (!enclosing) { + enclosing = document; + } + + this._others = Array.from(enclosing.querySelectorAll("popup-image:not(.hidden)")); + this._thisindex = this._others.indexOf(this); } disconnectedCallback() { @@ -758,6 +768,38 @@ class PopupImage extends HTMLElement { } } + Keys(evt) { + if (evt.repeat) { + return; + } + evt.preventDefault(); + if (evt.key === "ArrowRight") { + this.next(); + } else if (evt.key === "ArrowLeft") { + this.prev(); + } else if (evt.key === "Escape") { + this.hideOverlay(); + } + } + + next() { + if (this._others[this._thisindex + 1]) { + this.hideOverlay(); + this._others[this._thisindex + 1].showOverlay(); + } else { + document.addEventListener("keydown", this.Keys.bind(this), { once: true }); + } + } + + prev() { + if (this._others[this._thisindex - 1]) { + this.hideOverlay(); + this._others[this._thisindex - 1].showOverlay(); + } else { + document.addEventListener("keydown", this.Keys.bind(this), { once: true }); + } + } + showOverlay() { this.overlay = document.createElement("div"); this.overlay.classList.add( @@ -775,10 +817,12 @@ class PopupImage extends HTMLElement {
- - ${this.downloadButton()} + ${this.downloadButton()} + ${this.nextButton()} + ${this.prevButton()}
`; - const closeButton = this.overlay.querySelector("button"); + const closeButton = this.overlay.querySelector("#closebutton"); if (closeButton) { closeButton.addEventListener("click", () => { this.hideOverlay(); }); } + const nextButton = this.overlay.querySelector("#nextbtn"); + if (nextButton) { + nextButton.addEventListener("click", this.next.bind(this)); + } + + const prevButton = this.overlay.querySelector("#prevbtn"); + if (prevButton) { + prevButton.addEventListener("click", this.prev.bind(this)); + } + this.overlay.addEventListener("click", (evt) => { if (evt.target === this.overlay) { this.hideOverlay(); } }); + document.addEventListener("keydown", this.Keys.bind(this), { once: true }); document.body.appendChild(this.overlay); } @@ -813,6 +868,36 @@ class PopupImage extends HTMLElement { return ""; } + nextButton() { + if (!this._others[this._thisindex + 1]) { + return ""; + } + + return ` + + +
Nächstes Bild
+
+ `; + } + + prevButton() { + if (!this._others[this._thisindex - 1]) { + return ""; + } + + return ` + + +
Vorheriges Bild
+
+ `; + } + description() { if (!this._description) { return "";