snappymail/dev/Settings/Admin/Branding.js

41 lines
1.1 KiB
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
}
onBuild() {
setTimeout(() => {
2019-07-05 03:19:24 +08:00
const f1 = settingsSaveHelperSimpleFunction(this.title.trigger, this),
2016-07-16 03:54:37 +08:00
f2 = settingsSaveHelperSimpleFunction(this.loadingDesc.trigger, this),
f3 = settingsSaveHelperSimpleFunction(this.faviconUrl.trigger, this);
this.title.subscribe((value) => {
Remote.saveAdminConfig(f1, {
'Title': value.trim()
2016-07-16 03:54:37 +08:00
});
});
this.loadingDesc.subscribe((value) => {
Remote.saveAdminConfig(f2, {
'LoadingDescription': value.trim()
2016-07-16 03:54:37 +08:00
});
});
this.faviconUrl.subscribe((value) => {
Remote.saveAdminConfig(f3, {
'FaviconUrl': value.trim()
2016-07-16 03:54:37 +08:00
});
});
2020-08-14 04:58:41 +08:00
}, 50);
2016-07-16 03:54:37 +08:00
}
}