snappymail/dev/Settings/Admin/Branding.js

41 lines
1.2 KiB
JavaScript
Raw Normal View History

import { SaveSettingsStep } from 'Common/Enums';
2021-03-10 18:44:48 +08:00
import { SettingsGet } from 'Common/Globals';
2022-02-17 16:36:29 +08:00
import { settingsSaveHelperSimpleFunction } from 'Common/Utils';
import { addObservablesTo, addSubscribablesTo } from 'External/ko';
2016-07-16 03:54:37 +08:00
import Remote from 'Remote/Admin/Fetch';
2016-08-24 06:17:50 +08:00
export class BrandingAdminSettings /*extends AbstractViewSettings*/ {
2016-07-16 05:29:42 +08:00
constructor() {
addObservablesTo(this, {
title: SettingsGet('Title'),
loadingDesc: SettingsGet('LoadingDescription'),
faviconUrl: SettingsGet('FaviconUrl'),
titleTrigger: SaveSettingsStep.Idle,
loadingDescTrigger: SaveSettingsStep.Idle,
faviconUrlTrigger: SaveSettingsStep.Idle
});
2016-07-16 03:54:37 +08:00
addSubscribablesTo(this, {
title: (value =>
Remote.saveConfig({
Title: value.trim()
}, settingsSaveHelperSimpleFunction(this.titleTrigger, this))
).debounce(999),
2016-07-16 03:54:37 +08:00
loadingDesc: (value =>
Remote.saveConfig({
LoadingDescription: value.trim()
}, settingsSaveHelperSimpleFunction(this.loadingDescTrigger, this))
).debounce(999),
2016-07-16 03:54:37 +08:00
faviconUrl: (value =>
Remote.saveConfig({
FaviconUrl: value.trim()
}, settingsSaveHelperSimpleFunction(this.faviconUrlTrigger, this))
).debounce(999)
});
2016-07-16 03:54:37 +08:00
}
}