snappymail/dev/Settings/Admin/Branding.js

33 lines
970 B
JavaScript
Raw Normal View History

2016-07-16 03:54:37 +08:00
import ko from 'ko';
2021-03-10 18:44:48 +08:00
import { SettingsGet } from 'Common/Globals';
import { settingsSaveHelperSimpleFunction } from 'Common/Utils';
2016-07-16 03:54:37 +08:00
import Remote from 'Remote/Admin/Fetch';
2016-08-24 06:17:50 +08:00
2021-01-22 23:32:08 +08:00
export class BrandingAdminSettings {
2016-07-16 05:29:42 +08:00
constructor() {
2021-03-10 18:44:48 +08:00
this.title = ko.observable(SettingsGet('Title')).idleTrigger();
this.loadingDesc = ko.observable(SettingsGet('LoadingDescription')).idleTrigger();
this.faviconUrl = ko.observable(SettingsGet('FaviconUrl')).idleTrigger();
2016-07-16 03:54:37 +08:00
2021-03-18 21:48:21 +08:00
this.title.subscribe(value =>
Remote.saveAdminConfig(settingsSaveHelperSimpleFunction(this.title.trigger, this), {
Title: value.trim()
2021-03-18 21:48:21 +08:00
})
);
2016-07-16 03:54:37 +08:00
2021-03-18 21:48:21 +08:00
this.loadingDesc.subscribe(value =>
Remote.saveAdminConfig(settingsSaveHelperSimpleFunction(this.loadingDesc.trigger, this), {
LoadingDescription: value.trim()
2021-03-18 21:48:21 +08:00
})
);
2016-07-16 03:54:37 +08:00
2021-03-18 21:48:21 +08:00
this.faviconUrl.subscribe(value =>
Remote.saveAdminConfig(settingsSaveHelperSimpleFunction(this.faviconUrl.trigger, this), {
FaviconUrl: value.trim()
2021-03-18 21:48:21 +08:00
})
);
2016-07-16 03:54:37 +08:00
}
}