mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-31 13:09:21 +03:00
Add cmd interface
Code refactoring
This commit is contained in:
parent
e6e1a19477
commit
962391e2a0
23 changed files with 180 additions and 223 deletions
|
|
@ -4,16 +4,18 @@
|
|||
import _ from '_';
|
||||
import ko from 'ko';
|
||||
|
||||
import {settingsSaveHelperSimpleFunction, trim} from 'Common/Utils';
|
||||
import {Magics} from 'Common/Enums';
|
||||
import {settingsSaveHelperSimpleFunction, trim, log} from 'Common/Utils';
|
||||
import {i18n, trigger as translatorTrigger} from 'Common/Translator';
|
||||
|
||||
import Remote from 'Remote/Admin/Ajax';
|
||||
import AppStore from 'Stores/Admin/App';
|
||||
|
||||
import {settingsGet} from 'Storage/Settings';
|
||||
|
||||
class BrandingAdminSettings
|
||||
{
|
||||
constructor() {
|
||||
const AppStore = require('Stores/Admin/App');
|
||||
|
||||
this.capa = AppStore.prem;
|
||||
|
||||
this.title = ko.observable(settingsGet('Title')).idleTrigger();
|
||||
|
|
@ -33,9 +35,9 @@ class BrandingAdminSettings
|
|||
this.welcomePageDisplay.options = ko.computed(() => {
|
||||
translatorTrigger();
|
||||
return [
|
||||
{'optValue': 'none', 'optText': i18n('TAB_BRANDING/OPTION_WELCOME_PAGE_DISPLAY_NONE')},
|
||||
{'optValue': 'once', 'optText': i18n('TAB_BRANDING/OPTION_WELCOME_PAGE_DISPLAY_ONCE')},
|
||||
{'optValue': 'always', 'optText': i18n('TAB_BRANDING/OPTION_WELCOME_PAGE_DISPLAY_ALWAYS')}
|
||||
{optValue: 'none', optText: i18n('TAB_BRANDING/OPTION_WELCOME_PAGE_DISPLAY_NONE')},
|
||||
{optValue: 'once', optText: i18n('TAB_BRANDING/OPTION_WELCOME_PAGE_DISPLAY_ONCE')},
|
||||
{optValue: 'always', optText: i18n('TAB_BRANDING/OPTION_WELCOME_PAGE_DISPLAY_ALWAYS')}
|
||||
];
|
||||
});
|
||||
|
||||
|
|
@ -46,7 +48,6 @@ class BrandingAdminSettings
|
|||
onBuild() {
|
||||
_.delay(() => {
|
||||
const
|
||||
Remote = require('Remote/Admin/Ajax'),
|
||||
f1 = settingsSaveHelperSimpleFunction(this.title.trigger, this),
|
||||
f2 = settingsSaveHelperSimpleFunction(this.loadingDesc.trigger, this),
|
||||
f3 = settingsSaveHelperSimpleFunction(this.faviconUrl.trigger, this);
|
||||
|
|
@ -68,7 +69,7 @@ class BrandingAdminSettings
|
|||
'FaviconUrl': trim(value)
|
||||
});
|
||||
});
|
||||
}, 50);
|
||||
}, Magics.Time50ms);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -71,8 +71,8 @@ class ContactsAdminSettings
|
|||
this.contactsType = ko.observable('');
|
||||
|
||||
this.mainContactsType = ko.computed({
|
||||
'read': this.contactsType,
|
||||
'write': (value) => {
|
||||
read: this.contactsType,
|
||||
write: (value) => {
|
||||
if (value !== this.contactsType())
|
||||
{
|
||||
if (-1 < inArray(value, supportedTypes))
|
||||
|
|
|
|||
|
|
@ -1,19 +1,22 @@
|
|||
|
||||
import _ from '_';
|
||||
import {settingsSaveHelperSimpleFunction, trim, boolToAjax} from 'Common/Utils';
|
||||
import {Magics} from 'Common/Enums';
|
||||
|
||||
import Remote from 'Remote/Admin/Ajax';
|
||||
|
||||
import {BrandingAdminSettings} from 'Settings/Admin/Branding';
|
||||
|
||||
class BrandingPremAdminSettings extends BrandingAdminSettings
|
||||
{
|
||||
onBuild(oDom) {
|
||||
super.onBuild(oDom);
|
||||
onBuild(dom) {
|
||||
super.onBuild(dom);
|
||||
|
||||
if (this.capa && this.capa() && !this.community)
|
||||
{
|
||||
_.delay(() => {
|
||||
|
||||
const
|
||||
Remote = require('Remote/Admin/Ajax'),
|
||||
f1 = settingsSaveHelperSimpleFunction(this.loginLogo.trigger, this),
|
||||
f2 = settingsSaveHelperSimpleFunction(this.loginDescription.trigger, this),
|
||||
f3 = settingsSaveHelperSimpleFunction(this.loginCss.trigger, this),
|
||||
|
|
@ -97,7 +100,8 @@ class BrandingPremAdminSettings extends BrandingAdminSettings
|
|||
'LoginPowered': boolToAjax(value)
|
||||
});
|
||||
});
|
||||
}, 50);
|
||||
|
||||
}, Magics.Time50ms);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,8 +44,7 @@ class FiltersUserSettings
|
|||
this.filterRaw.allow = ko.observable(false);
|
||||
this.filterRaw.error = ko.observable(false);
|
||||
|
||||
this.filterForDeletion = ko.observable(null)
|
||||
.extend({falseTimeout: 3000}).extend({toggleSubscribeProperty: [this, 'deleteAccess']});
|
||||
this.filterForDeletion = ko.observable(null).deleteAccessHelper();
|
||||
|
||||
this.saveChanges = createCommand(() => {
|
||||
if (!this.filters.saving())
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
import ko from 'ko';
|
||||
|
||||
import {ClientSideKeyName, Notification} from 'Common/Enums';
|
||||
import {ClientSideKeyName, Notification, Magics} from 'Common/Enums';
|
||||
import {trim, noop} from 'Common/Utils';
|
||||
import {getNotification, i18n} from 'Common/Translator';
|
||||
|
||||
|
|
@ -25,33 +25,21 @@ class FoldersUserSettings
|
|||
this.displaySpecSetting = FolderStore.displaySpecSetting;
|
||||
this.folderList = FolderStore.folderList;
|
||||
|
||||
this.folderListHelp = ko.observable('').extend({throttle: 100});
|
||||
this.folderListHelp = ko.observable('').extend({throttle: Magics.Time100ms});
|
||||
|
||||
this.loading = ko.computed(() => {
|
||||
const
|
||||
bLoading = FolderStore.foldersLoading(),
|
||||
bCreating = FolderStore.foldersCreating(),
|
||||
bDeleting = FolderStore.foldersDeleting(),
|
||||
bRenaming = FolderStore.foldersRenaming();
|
||||
loading = FolderStore.foldersLoading(),
|
||||
creating = FolderStore.foldersCreating(),
|
||||
deleting = FolderStore.foldersDeleting(),
|
||||
renaming = FolderStore.foldersRenaming();
|
||||
|
||||
return bLoading || bCreating || bDeleting || bRenaming;
|
||||
return loading || creating || deleting || renaming;
|
||||
});
|
||||
|
||||
this.folderForDeletion = ko.observable(null).deleteAccessHelper();
|
||||
|
||||
this.folderForEdit = ko.observable(null).extend({toggleSubscribe: [this,
|
||||
(prev) => {
|
||||
if (prev)
|
||||
{
|
||||
prev.edited(false);
|
||||
}
|
||||
}, (next) => {
|
||||
if (next && next.canBeEdited())
|
||||
{
|
||||
next.edited(true);
|
||||
}
|
||||
}
|
||||
]});
|
||||
this.folderForEdit = ko.observable(null).extend({toggleSubscribeProperty: [this, 'edited']});
|
||||
|
||||
this.useImapSubscribe = !!appSettingsGet('useImapSubscribe');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ class ThemesUserSettings
|
|||
else
|
||||
{
|
||||
$bg.attr('style', 'background-image: none !important;').backstretch(userBackground(value), {
|
||||
fade: 1000, centeredX: true, centeredY: true
|
||||
fade: Magics.Time1s, centeredX: true, centeredY: true
|
||||
}).removeAttr('style');
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue