mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 19:36:12 +01:00
option tabs refactored
This commit is contained in:
@@ -5,14 +5,33 @@ import toastService from "../../../services/toast.js";
|
||||
export default class OptionsTab extends BasicWidget {
|
||||
async updateOption(name, value) {
|
||||
const opts = { [name]: value };
|
||||
server.put('options', opts).then(() => {
|
||||
toastService.showPersistent({
|
||||
id: "options-change-saved",
|
||||
title: "Options status",
|
||||
message: "Options change have been saved.",
|
||||
icon: "slider",
|
||||
closeAfter: 2000
|
||||
})
|
||||
|
||||
await this.updateMultipleOptions(opts);
|
||||
}
|
||||
|
||||
async updateMultipleOptions(opts) {
|
||||
await server.put('options', opts);
|
||||
|
||||
this.showUpdateNotification();
|
||||
}
|
||||
|
||||
showUpdateNotification() {
|
||||
toastService.showPersistent({
|
||||
id: "options-change-saved",
|
||||
title: "Options status",
|
||||
message: "Options change have been saved.",
|
||||
icon: "slider",
|
||||
closeAfter: 2000
|
||||
});
|
||||
}
|
||||
|
||||
async updateCheckboxOption(name, $checkbox) {
|
||||
const isChecked = $checkbox.prop("checked");
|
||||
|
||||
return await this.updateOption(name, isChecked ? 'true' : 'false');
|
||||
}
|
||||
|
||||
setCheckboxState($checkbox, optionValue) {
|
||||
$checkbox.prop('checked', optionValue === 'true');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user