mirror of
https://github.com/Theodor-Springmann-Stiftung/musenalm.git
synced 2026-02-04 18:45:31 +00:00
BIGFIX: checkboxes
This commit is contained in:
@@ -778,7 +778,7 @@ class nt extends HTMLElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
F = new WeakMap();
|
F = new WeakMap();
|
||||||
const at = "msr-component-wrapper", ae = "msr-selected-items-container", re = "msr-placeholder-no-selection-text", rt = "msr-selected-item-pill", lt = "msr-selected-item-text", ot = "msr-item-name", dt = "msr-item-additional-data", ht = "msr-selected-item-role", le = "msr-selected-item-delete-btn", ct = "msr-controls-area", oe = "msr-pre-add-button", de = "msr-input-area-wrapper", P = "msr-input-area-default-border", j = "msr-input-area-staged", he = "msr-staging-area-container", ut = "msr-staged-item-pill", mt = "msr-staged-item-text", W = "msr-staged-role-select", ce = "msr-staged-cancel-btn", ue = "msr-text-input", me = "msr-add-button", _e = "msr-options-list", pe = "msr-option-item", _t = "msr-option-item-name", pt = "msr-option-item-detail", fe = "msr-option-item-highlighted", G = "msr-hidden-select", ft = "msr-state-no-selection", gt = "msr-state-has-selection", bt = "msr-state-list-open", Et = "msr-state-item-staged";
|
const at = "msr-component-wrapper", ae = "msr-selected-items-container", re = "msr-placeholder-no-selection-text", rt = "msr-selected-item-pill", lt = "msr-selected-item-text", ot = "msr-item-name", dt = "msr-item-additional-data", ht = "msr-selected-item-role", le = "msr-selected-item-delete-btn", ct = "msr-controls-area", oe = "msr-pre-add-button", de = "msr-input-area-wrapper", q = "msr-input-area-default-border", j = "msr-input-area-staged", he = "msr-staging-area-container", ut = "msr-staged-item-pill", mt = "msr-staged-item-text", W = "msr-staged-role-select", ce = "msr-staged-cancel-btn", ue = "msr-text-input", me = "msr-add-button", _e = "msr-options-list", pe = "msr-option-item", _t = "msr-option-item-name", pt = "msr-option-item-detail", fe = "msr-option-item-highlighted", G = "msr-hidden-select", ft = "msr-state-no-selection", gt = "msr-state-has-selection", bt = "msr-state-list-open", Et = "msr-state-item-staged";
|
||||||
class Ne extends HTMLElement {
|
class Ne extends HTMLElement {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
@@ -1003,7 +1003,7 @@ class Ne extends HTMLElement {
|
|||||||
${this._value.length === 0 ? `<span class="${re}">${this.placeholderNoSelection}</span>` : ""}
|
${this._value.length === 0 ? `<span class="${re}">${this.placeholderNoSelection}</span>` : ""}
|
||||||
</div>
|
</div>
|
||||||
<div class="${ct} flex items-center">
|
<div class="${ct} flex items-center">
|
||||||
<div class="${de} ${P} flex-grow min-h-[42px] flex items-center flex-wrap gap-1" tabindex="-1">
|
<div class="${de} ${q} flex-grow min-h-[42px] flex items-center flex-wrap gap-1" tabindex="-1">
|
||||||
<span class="${he} flex items-center gap-2"></span>
|
<span class="${he} flex items-center gap-2"></span>
|
||||||
<input type="text"
|
<input type="text"
|
||||||
class="${ue} flex-1 min-w-[100px] outline-none"
|
class="${ue} flex-1 min-w-[100px] outline-none"
|
||||||
@@ -1041,7 +1041,7 @@ class Ne extends HTMLElement {
|
|||||||
_renderStagedPillOrInput() {
|
_renderStagedPillOrInput() {
|
||||||
if (!(!this.stagedItemPillContainer || !this.inputElement || !this.inputAreaWrapper)) {
|
if (!(!this.stagedItemPillContainer || !this.inputElement || !this.inputAreaWrapper)) {
|
||||||
if (this.stagedItemPillContainer.innerHTML = "", this._stagedItem && this._stagedItem.item) {
|
if (this.stagedItemPillContainer.innerHTML = "", this._stagedItem && this._stagedItem.item) {
|
||||||
this.inputAreaWrapper.classList.remove(P), this.inputAreaWrapper.classList.add(j);
|
this.inputAreaWrapper.classList.remove(q), this.inputAreaWrapper.classList.add(j);
|
||||||
const e = this._createStagedItemPillElement(this._stagedItem.item);
|
const e = this._createStagedItemPillElement(this._stagedItem.item);
|
||||||
this.stagedItemPillContainer.appendChild(e);
|
this.stagedItemPillContainer.appendChild(e);
|
||||||
const i = this._getAvailableRolesForItem(this._stagedItem.item.id), s = this._createStagedRoleSelectElement(
|
const i = this._getAvailableRolesForItem(this._stagedItem.item.id), s = this._createStagedRoleSelectElement(
|
||||||
@@ -1052,7 +1052,7 @@ class Ne extends HTMLElement {
|
|||||||
const n = this._createStagedCancelButtonElement(this._stagedItem.item.name);
|
const n = this._createStagedCancelButtonElement(this._stagedItem.item.name);
|
||||||
this.stagedItemPillContainer.appendChild(n), this.inputElement.classList.add("hidden"), this.inputElement.value = "", this.inputElement.removeAttribute("aria-activedescendant"), this.inputElement.setAttribute("aria-expanded", "false");
|
this.stagedItemPillContainer.appendChild(n), this.inputElement.classList.add("hidden"), this.inputElement.value = "", this.inputElement.removeAttribute("aria-activedescendant"), this.inputElement.setAttribute("aria-expanded", "false");
|
||||||
} else
|
} else
|
||||||
this.inputAreaWrapper.classList.add(P), this.inputAreaWrapper.classList.remove(j), this.inputElement.classList.remove("hidden");
|
this.inputAreaWrapper.classList.add(q), this.inputAreaWrapper.classList.remove(j), this.inputElement.classList.remove("hidden");
|
||||||
this._updateAddButtonState(), this._updatePreAddButtonVisibility(), this._updateRootElementStateClasses();
|
this._updateAddButtonState(), this._updatePreAddButtonVisibility(), this._updateRootElementStateClasses();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1191,7 +1191,7 @@ class Ne extends HTMLElement {
|
|||||||
}
|
}
|
||||||
_handleFocus() {
|
_handleFocus() {
|
||||||
if (!(this.hasAttribute("disabled") || this.inputElement && this.inputElement.disabled || this._stagedItem)) {
|
if (!(this.hasAttribute("disabled") || this.inputElement && this.inputElement.disabled || this._stagedItem)) {
|
||||||
if (!this._stagedItem && this.inputAreaWrapper && (this.inputAreaWrapper.classList.add(P), this.inputAreaWrapper.classList.remove(j)), this.inputElement && this.inputElement.value.length > 0) {
|
if (!this._stagedItem && this.inputAreaWrapper && (this.inputAreaWrapper.classList.add(q), this.inputAreaWrapper.classList.remove(j)), this.inputElement && this.inputElement.value.length > 0) {
|
||||||
const e = this.inputElement.value.toLowerCase();
|
const e = this.inputElement.value.toLowerCase();
|
||||||
this._filteredOptions = this._options.filter((i) => this._getAvailableRolesForItem(i.id).length === 0 ? !1 : i.name.toLowerCase().includes(e) || i.additional_data && i.additional_data.toLowerCase().includes(e)), this._filteredOptions.length > 0 ? (this._isOptionsListVisible = !0, this._highlightedIndex = 0, this._renderOptionsList()) : this._hideOptionsList();
|
this._filteredOptions = this._options.filter((i) => this._getAvailableRolesForItem(i.id).length === 0 ? !1 : i.name.toLowerCase().includes(e) || i.additional_data && i.additional_data.toLowerCase().includes(e)), this._filteredOptions.length > 0 ? (this._isOptionsListVisible = !0, this._highlightedIndex = 0, this._renderOptionsList()) : this._hideOptionsList();
|
||||||
} else
|
} else
|
||||||
@@ -1981,13 +1981,13 @@ class $t extends HTMLElement {
|
|||||||
this.button.setAttribute("aria-label", t);
|
this.button.setAttribute("aria-label", t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const g = "hidden", we = "dm-stay", q = "dm-title", Te = "dm-menu-button", Nt = "dm-target", Dt = "data-dm-target", ke = "dm-menu", Re = "dm-menu-item", Pt = "dm-close-button";
|
const g = "hidden", we = "dm-stay", P = "dm-title", Te = "dm-menu-button", Nt = "dm-target", Dt = "data-dm-target", ke = "dm-menu", Re = "dm-menu-item", qt = "dm-close-button";
|
||||||
var V, Pe;
|
var V, qe;
|
||||||
class qt extends HTMLElement {
|
class Pt extends HTMLElement {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
w(this, V);
|
w(this, V);
|
||||||
N(this, V, Pe).call(this), this.boundHandleClickOutside = this.handleClickOutside.bind(this);
|
N(this, V, qe).call(this), this.boundHandleClickOutside = this.handleClickOutside.bind(this);
|
||||||
}
|
}
|
||||||
connectedCallback() {
|
connectedCallback() {
|
||||||
if (this._target = document.getElementById(this.getAttribute(Nt)), this._target || (this._target = this), this._cildren = Array.from(this.children).filter((e) => e.nodeType === Node.ELEMENT_NODE && !e.classList.contains(Te)).map((e) => ({
|
if (this._target = document.getElementById(this.getAttribute(Nt)), this._target || (this._target = this), this._cildren = Array.from(this.children).filter((e) => e.nodeType === Node.ELEMENT_NODE && !e.classList.contains(Te)).map((e) => ({
|
||||||
@@ -2000,11 +2000,11 @@ class qt extends HTMLElement {
|
|||||||
hidden: () => e.classList.contains(g),
|
hidden: () => e.classList.contains(g),
|
||||||
name: () => {
|
name: () => {
|
||||||
const i = e.querySelector("label");
|
const i = e.querySelector("label");
|
||||||
return i ? i.innerHTML : e.hasAttribute(q) ? e.getAttribute(q) : "";
|
return i ? i.innerHTML : e.hasAttribute(P) ? e.getAttribute(P) : "";
|
||||||
},
|
},
|
||||||
nameText: () => {
|
nameText: () => {
|
||||||
const i = e.querySelector("label");
|
const i = e.querySelector("label");
|
||||||
return i ? i.textContent.trim() : e.hasAttribute(q) ? e.getAttribute(q) : "";
|
return i ? i.textContent.trim() : e.hasAttribute(P) ? e.getAttribute(P) : "";
|
||||||
}
|
}
|
||||||
})), this._button = this.querySelector(`.${Te}`), !this._button) {
|
})), this._button = this.querySelector(`.${Te}`), !this._button) {
|
||||||
console.error("DivManagerMenu needs a button element.");
|
console.error("DivManagerMenu needs a button element.");
|
||||||
@@ -2015,7 +2015,7 @@ class qt extends HTMLElement {
|
|||||||
this.removeChild(e.node);
|
this.removeChild(e.node);
|
||||||
this._button.addEventListener("click", this._toggleMenu.bind(this)), this._button.classList.add("relative");
|
this._button.addEventListener("click", this._toggleMenu.bind(this)), this._button.classList.add("relative");
|
||||||
for (const e of this._cildren)
|
for (const e of this._cildren)
|
||||||
e.node.querySelectorAll(`.${Pt}`).forEach((s) => {
|
e.node.querySelectorAll(`.${qt}`).forEach((s) => {
|
||||||
s.addEventListener("click", (n) => {
|
s.addEventListener("click", (n) => {
|
||||||
this.hideDiv(n, e.node);
|
this.hideDiv(n, e.node);
|
||||||
});
|
});
|
||||||
@@ -2134,7 +2134,7 @@ ${e[0].nameText()} hinzufügen`, this._menu = null, this.hideMenu();
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
V = new WeakSet(), Pe = function() {
|
V = new WeakSet(), qe = function() {
|
||||||
this._cildren = [], this._rendered = [], this._target = null, this._button = null, this._menu = null, this._originalButtonText = null;
|
this._cildren = [], this._rendered = [], this._target = null, this._button = null, this._menu = null, this._originalButtonText = null;
|
||||||
};
|
};
|
||||||
const b = "items-row", Ht = "items-list", Ft = "items-template", Vt = "items-add-button", Ut = "items-cancel-button", H = "items-remove-button", zt = "items-edit-button", Kt = "items-close-button", jt = "items-summary", Wt = "items-edit-panel", Z = "items_removed[]", T = "data-items-removed";
|
const b = "items-row", Ht = "items-list", Ft = "items-template", Vt = "items-add-button", Ut = "items-cancel-button", H = "items-remove-button", zt = "items-edit-button", Kt = "items-close-button", jt = "items-summary", Wt = "items-edit-panel", Z = "items_removed[]", T = "data-items-removed";
|
||||||
@@ -3333,7 +3333,7 @@ class gi extends HTMLElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const bi = "filter-list", Ei = "fab-menu", vi = "scroll-button", Si = "tool-tip", yi = "abbrev-tooltips", Li = "int-link", xi = "popup-image", Ai = "tab-list", Ci = "filter-pill", Ii = "image-reel", wi = "multi-select-places", Ti = "multi-select-simple", ki = "single-select-remote", qe = "reset-button", Ri = "div-manager", Oi = "items-editor", Bi = "almanach-edit-page", Mi = "relations-editor", $i = "edit-page";
|
const bi = "filter-list", Ei = "fab-menu", vi = "scroll-button", Si = "tool-tip", yi = "abbrev-tooltips", Li = "int-link", xi = "popup-image", Ai = "tab-list", Ci = "filter-pill", Ii = "image-reel", wi = "multi-select-places", Ti = "multi-select-simple", ki = "single-select-remote", Pe = "reset-button", Ri = "div-manager", Oi = "items-editor", Bi = "almanach-edit-page", Mi = "relations-editor", $i = "edit-page";
|
||||||
customElements.define(Li, st);
|
customElements.define(Li, st);
|
||||||
customElements.define(yi, R);
|
customElements.define(yi, R);
|
||||||
customElements.define(bi, Xe);
|
customElements.define(bi, Xe);
|
||||||
@@ -3346,8 +3346,8 @@ customElements.define(Ii, nt);
|
|||||||
customElements.define(wi, Ne);
|
customElements.define(wi, Ne);
|
||||||
customElements.define(Ti, De);
|
customElements.define(Ti, De);
|
||||||
customElements.define(ki, ti);
|
customElements.define(ki, ti);
|
||||||
customElements.define(qe, $t);
|
customElements.define(Pe, $t);
|
||||||
customElements.define(Ri, qt);
|
customElements.define(Ri, Pt);
|
||||||
customElements.define(Oi, Gt);
|
customElements.define(Oi, Gt);
|
||||||
customElements.define(Bi, si);
|
customElements.define(Bi, si);
|
||||||
customElements.define(Mi, pi);
|
customElements.define(Mi, pi);
|
||||||
@@ -3365,7 +3365,7 @@ function Di(r = 5e3, t = 100) {
|
|||||||
}, t);
|
}, t);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
async function Pi(r) {
|
async function qi(r) {
|
||||||
const t = await Di(), e = document.getElementById("qr");
|
const t = await Di(), e = document.getElementById("qr");
|
||||||
e && (e.innerHTML = "", e.classList.add("hidden"), new t(e, {
|
e && (e.innerHTML = "", e.classList.add("hidden"), new t(e, {
|
||||||
text: r,
|
text: r,
|
||||||
@@ -3378,7 +3378,7 @@ async function Pi(r) {
|
|||||||
e.classList.remove("hidden");
|
e.classList.remove("hidden");
|
||||||
}, 20));
|
}, 20));
|
||||||
}
|
}
|
||||||
function qi(r) {
|
function Pi(r) {
|
||||||
r && (r.addEventListener("focus", (t) => {
|
r && (r.addEventListener("focus", (t) => {
|
||||||
t.preventDefault(), r.select();
|
t.preventDefault(), r.select();
|
||||||
}), r.addEventListener("mousedown", (t) => {
|
}), r.addEventListener("mousedown", (t) => {
|
||||||
@@ -3410,7 +3410,7 @@ function Fi(r, t) {
|
|||||||
console.warn("Action must be a function.");
|
console.warn("Action must be a function.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const e = r.querySelectorAll(qe);
|
const e = r.querySelectorAll(Pe);
|
||||||
r.addEventListener("rbichange", (i) => {
|
r.addEventListener("rbichange", (i) => {
|
||||||
for (const s of e)
|
for (const s of e)
|
||||||
if (s.isCurrentlyModified()) {
|
if (s.isCurrentlyModified()) {
|
||||||
@@ -3487,35 +3487,45 @@ function Wi(r) {
|
|||||||
}
|
}
|
||||||
const t = document.querySelectorAll("textarea");
|
const t = document.querySelectorAll("textarea");
|
||||||
console.log("Found", t.length, "textareas");
|
console.log("Found", t.length, "textareas");
|
||||||
for (const n of t)
|
for (const a of t)
|
||||||
console.log("Attaching input listener to:", n.name || n.id), n.addEventListener("input", function() {
|
console.log("Attaching input listener to:", a.name || a.id), a.addEventListener("input", function() {
|
||||||
console.log("Input event on textarea:", this.name || this.id), x(this);
|
console.log("Input event on textarea:", this.name || this.id), x(this);
|
||||||
});
|
});
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
console.log("Running initial textarea resize on", t.length, "textareas");
|
console.log("Running initial textarea resize on", t.length, "textareas");
|
||||||
for (const n of t)
|
for (const a of t)
|
||||||
x(n);
|
x(a);
|
||||||
}, 200);
|
}, 200);
|
||||||
const e = document.querySelectorAll("textarea.no-enter");
|
const e = document.querySelectorAll("textarea.no-enter");
|
||||||
for (const n of e)
|
for (const a of e)
|
||||||
zi(n);
|
zi(a);
|
||||||
new MutationObserver(ji).observe(r, {
|
new MutationObserver(ji).observe(r, {
|
||||||
childList: !0,
|
childList: !0,
|
||||||
subtree: !0
|
subtree: !0
|
||||||
}), new MutationObserver((n) => {
|
}), new MutationObserver((a) => {
|
||||||
for (const a of n)
|
for (const l of a)
|
||||||
if (a.type === "attributes" && a.attributeName === "class") {
|
if (l.type === "attributes" && l.attributeName === "class") {
|
||||||
const l = a.target;
|
const o = l.target;
|
||||||
if (l instanceof HTMLElement) {
|
if (o instanceof HTMLElement) {
|
||||||
const o = l.matches("textarea") ? [l] : Array.from(l.querySelectorAll("textarea"));
|
const d = o.matches("textarea") ? [o] : Array.from(o.querySelectorAll("textarea"));
|
||||||
for (const d of o)
|
for (const c of d)
|
||||||
d.offsetParent !== null && x(d);
|
c.offsetParent !== null && x(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).observe(r, {
|
}).observe(r, {
|
||||||
attributes: !0,
|
attributes: !0,
|
||||||
attributeFilter: ["class"],
|
attributeFilter: ["class"],
|
||||||
subtree: !0
|
subtree: !0
|
||||||
|
}), r.querySelectorAll('input[type="checkbox"][data-boolean-checkbox]').forEach((a) => {
|
||||||
|
a.value = "true";
|
||||||
|
const l = () => {
|
||||||
|
const o = r.querySelector(`input[type="hidden"][name="${a.name}"]`);
|
||||||
|
if (o && o.remove(), !a.checked) {
|
||||||
|
const d = document.createElement("input");
|
||||||
|
d.type = "hidden", d.name = a.name, d.value = "false", a.parentNode.insertBefore(d, a);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
l(), a.addEventListener("change", l);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
document.addEventListener("keydown", (r) => {
|
document.addEventListener("keydown", (r) => {
|
||||||
@@ -3525,8 +3535,8 @@ document.addEventListener("keydown", (r) => {
|
|||||||
t instanceof HTMLElement && t.matches("textarea.no-enter") && r.preventDefault();
|
t instanceof HTMLElement && t.matches("textarea.no-enter") && r.preventDefault();
|
||||||
});
|
});
|
||||||
window.ShowBoostedErrors = Hi;
|
window.ShowBoostedErrors = Hi;
|
||||||
window.GenQRCode = Pi;
|
window.GenQRCode = qi;
|
||||||
window.SelectableInput = qi;
|
window.SelectableInput = Pi;
|
||||||
window.PathPlusQuery = Ni;
|
window.PathPlusQuery = Ni;
|
||||||
window.HookupRBChange = Fi;
|
window.HookupRBChange = Fi;
|
||||||
window.FormLoad = Wi;
|
window.FormLoad = Wi;
|
||||||
|
|||||||
@@ -126,7 +126,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="inputwrapper">
|
<div class="inputwrapper">
|
||||||
<div class="px-3 py-2 flex flex-row gap-2 font-bold">
|
<div class="px-3 py-2 flex flex-row gap-2 font-bold">
|
||||||
<input type="checkbox" name="fictional" id="fictional" {{ if $place.Fictional }}checked{{ end }} />
|
<input type="checkbox" name="fictional" id="fictional" {{ if $place.Fictional }}checked{{ end }} data-boolean-checkbox />
|
||||||
<label class="flex items-center gap-2 text-gray-700"
|
<label class="flex items-center gap-2 text-gray-700"
|
||||||
for="fictional">Fiktional</label>
|
for="fictional">Fiktional</label>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -115,6 +115,14 @@
|
|||||||
<label for="pseudonyms" class="inputlabel">Pseudonyme</label>
|
<label for="pseudonyms" class="inputlabel">Pseudonyme</label>
|
||||||
<textarea name="pseudonyms" id="pseudonyms" class="inputinput" autocomplete="off" rows="1">{{- $agent.Pseudonyms -}}</textarea>
|
<textarea name="pseudonyms" id="pseudonyms" class="inputinput" autocomplete="off" rows="1">{{- $agent.Pseudonyms -}}</textarea>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="inputwrapper">
|
||||||
|
<div class="px-3 py-2 flex flex-row gap-2 font-bold">
|
||||||
|
<input type="checkbox" name="corporate_body" id="corporate_body" {{ if
|
||||||
|
$agent.CorporateBody }}checked{{ end }} data-boolean-checkbox />
|
||||||
|
<label class="flex items-center gap-2 text-gray-700"
|
||||||
|
for="corporate_body">Körperschaft (Verlag/Vertrieb)</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="inputwrapper">
|
<div class="inputwrapper">
|
||||||
<label for="biographical_data" class="inputlabel">Biografische Angaben</label>
|
<label for="biographical_data" class="inputlabel">Biografische Angaben</label>
|
||||||
<textarea name="biographical_data" id="biographical_data" class="inputinput" autocomplete="off" rows="2">{{- $agent.BiographicalData -}}</textarea>
|
<textarea name="biographical_data" id="biographical_data" class="inputinput" autocomplete="off" rows="2">{{- $agent.BiographicalData -}}</textarea>
|
||||||
@@ -137,19 +145,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="inputwrapper">
|
<div class="inputwrapper">
|
||||||
<div class="px-3 py-2 flex flex-row gap-2 font-bold">
|
<div class="px-3 py-2 flex flex-row gap-2 font-bold">
|
||||||
<input type="checkbox" name="fictional" id="fictional" {{ if $agent.Fictional }}checked{{ end }} />
|
<input type="checkbox" name="fictional" id="fictional" {{ if $agent.Fictional }}checked{{ end }} data-boolean-checkbox />
|
||||||
<label class="flex items-center gap-2 text-gray-700"
|
<label class="flex items-center gap-2 text-gray-700"
|
||||||
for="fictional">Fiktional</label>
|
for="fictional">Fiktional</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="inputwrapper">
|
|
||||||
<div class="px-3 py-2 flex flex-row gap-2 font-bold">
|
|
||||||
<input type="checkbox" name="corporate_body" id="corporate_body" {{ if
|
|
||||||
$agent.CorporateBody }}checked{{ end }} />
|
|
||||||
<label class="flex items-center gap-2 text-gray-700"
|
|
||||||
for="corporate_body">Körperschaft (Verlag/Vertrieb)</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="w-[28rem] shrink-0 flex flex-col gap-3">
|
<div class="w-[28rem] shrink-0 flex flex-col gap-3">
|
||||||
|
|||||||
@@ -389,6 +389,37 @@ function FormLoad(form) {
|
|||||||
attributeFilter: ["class"],
|
attributeFilter: ["class"],
|
||||||
subtree: true,
|
subtree: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Handle boolean checkboxes
|
||||||
|
const booleanCheckboxes = form.querySelectorAll('input[type="checkbox"][data-boolean-checkbox]');
|
||||||
|
booleanCheckboxes.forEach(checkbox => {
|
||||||
|
// Ensure each boolean checkbox has proper value handling
|
||||||
|
checkbox.value = 'true';
|
||||||
|
|
||||||
|
// Add change handler to manage hidden input
|
||||||
|
const updateHiddenInput = () => {
|
||||||
|
// Remove any existing hidden input for this checkbox
|
||||||
|
const existingHidden = form.querySelector(`input[type="hidden"][name="${checkbox.name}"]`);
|
||||||
|
if (existingHidden) {
|
||||||
|
existingHidden.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
// If checkbox is unchecked, add hidden input with false value
|
||||||
|
if (!checkbox.checked) {
|
||||||
|
const hidden = document.createElement('input');
|
||||||
|
hidden.type = 'hidden';
|
||||||
|
hidden.name = checkbox.name;
|
||||||
|
hidden.value = 'false';
|
||||||
|
checkbox.parentNode.insertBefore(hidden, checkbox);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Initial setup
|
||||||
|
updateHiddenInput();
|
||||||
|
|
||||||
|
// Update on change
|
||||||
|
checkbox.addEventListener('change', updateHiddenInput);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener("keydown", (event) => {
|
document.addEventListener("keydown", (event) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user