form for dashboard

This commit is contained in:
Benjamin Dalsass
2025-12-17 16:36:05 +01:00
parent c898df461f
commit fb3cbcd779
10 changed files with 48 additions and 14 deletions

View File

@@ -14,6 +14,7 @@ class ChoicesElement extends HTMLSelectElement {
plugins: this.plugins,
wrapperClass: 'ts-wrapper ibo-input-wrapper ibo-input-select-wrapper--with-buttons ibo-input-select-autocomplete-wrapper',
controlClass: 'ts-control ibo-input ibo-input-select ibo-input-select-autocomplete',
dropdownParent: 'body',
render: {
dropdown: function (data, escape) {
return `<div class="selectize-dropdown"></div>`;

View File

@@ -41,19 +41,22 @@ class CollectionEntryElement extends HTMLElement {
*/
updateButtonStates() {
if(this.previousElementSibling === null) {
this.#eBtnMoveUp.setAttribute('disabled', 'disabled');
}
else{
this.#eBtnMoveUp.removeAttribute('disabled');
if (this.dataset.allowOrdering) {
if (this.previousElementSibling === null) {
this.#eBtnMoveUp.setAttribute('disabled', 'disabled');
} else {
this.#eBtnMoveUp.removeAttribute('disabled');
}
if (this.nextElementSibling === null) {
this.#eBtnMoveDown.setAttribute('disabled', 'disabled');
} else {
this.#eBtnMoveDown.removeAttribute('disabled');
}
}
if(this.nextElementSibling === null) {
this.#eBtnMoveDown.setAttribute('disabled', 'disabled');
}
else{
this.#eBtnMoveDown.removeAttribute('disabled');
}
}
/**

View File

@@ -0,0 +1,25 @@
class TurboStreamEvent extends HTMLElement {
// register the custom element
static {
customElements.define('turbo-stream-event', TurboStreamEvent);
}
constructor() {
super();
this.style.display = 'none';
const event = new CustomEvent("itop:TurboStreamEvent", {
detail: {
id: this.getAttribute('id'),
block_class: this.dataset.formBlockClass,
view_data: this.dataset.viewData,
valid: this.dataset.valid,
},
});
document.dispatchEvent(event);
}
}