mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-23 18:28:49 +02:00
Allow to configure sidebar menu via the new settings system
This commit is contained in:
parent
5e512f8935
commit
79da0518c2
15 changed files with 320 additions and 55 deletions
|
@ -40,6 +40,7 @@ export default class extends Controller {
|
|||
|
||||
|
||||
let settings = {
|
||||
plugins: [],
|
||||
allowEmptyOption: true,
|
||||
selectOnTab: true,
|
||||
maxOptions: null,
|
||||
|
@ -50,7 +51,18 @@ export default class extends Controller {
|
|||
}
|
||||
};
|
||||
|
||||
//Load the drag_drop plugin if the select is ordered
|
||||
if (this.element.dataset.orderedValue) {
|
||||
settings.plugins.push('drag_drop');
|
||||
}
|
||||
|
||||
this._tomSelect = new TomSelect(this.element, settings);
|
||||
|
||||
//If the select is ordered, we need to update the value field (with the decoded value from the orderedValue field)
|
||||
if (this.element.dataset.orderedValue) {
|
||||
const data = JSON.parse(this.element.dataset.orderedValue);
|
||||
this._tomSelect.setValue(data);
|
||||
}
|
||||
}
|
||||
|
||||
getTomSelect() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue