mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 12:39:20 +03:00
Code refactoring (4) (es5 -> es2015)
This commit is contained in:
parent
e8df1cdb57
commit
d7ab67a460
30 changed files with 164 additions and 173 deletions
|
|
@ -1,6 +1,4 @@
|
|||
|
||||
/* global RL_COMMUNITY */
|
||||
|
||||
var
|
||||
ko = require('ko'),
|
||||
|
||||
|
|
@ -91,4 +89,4 @@ AboutAdminSettings.prototype.updateCoreData = function()
|
|||
}
|
||||
};
|
||||
|
||||
module.exports = AboutAdminSettings;
|
||||
export {AboutAdminSettings, AboutAdminSettings as default};
|
||||
|
|
@ -1,113 +0,0 @@
|
|||
|
||||
/* global RL_COMMUNITY */
|
||||
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
Utils = require('Common/Utils'),
|
||||
Translator = require('Common/Translator');
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function BrandingAdminSettings()
|
||||
{
|
||||
var
|
||||
Enums = require('Common/Enums'),
|
||||
Settings = require('Storage/Settings'),
|
||||
AppStore = require('Stores/Admin/App');
|
||||
|
||||
this.capa = AppStore.prem;
|
||||
|
||||
this.title = ko.observable(Settings.settingsGet('Title'));
|
||||
this.title.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.loadingDesc = ko.observable(Settings.settingsGet('LoadingDescription'));
|
||||
this.loadingDesc.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.faviconUrl = ko.observable(Settings.settingsGet('FaviconUrl'));
|
||||
this.faviconUrl.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.loginLogo = ko.observable(Settings.settingsGet('LoginLogo') || '');
|
||||
this.loginLogo.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.loginBackground = ko.observable(Settings.settingsGet('LoginBackground') || '');
|
||||
this.loginBackground.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.userLogo = ko.observable(Settings.settingsGet('UserLogo') || '');
|
||||
this.userLogo.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.userLogoMessage = ko.observable(Settings.settingsGet('UserLogoMessage') || '');
|
||||
this.userLogoMessage.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.userIframeMessage = ko.observable(Settings.settingsGet('UserIframeMessage') || '');
|
||||
this.userIframeMessage.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.userLogoTitle = ko.observable(Settings.settingsGet('UserLogoTitle') || '');
|
||||
this.userLogoTitle.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.loginDescription = ko.observable(Settings.settingsGet('LoginDescription'));
|
||||
this.loginDescription.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.loginCss = ko.observable(Settings.settingsGet('LoginCss'));
|
||||
this.loginCss.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.userCss = ko.observable(Settings.settingsGet('UserCss'));
|
||||
this.userCss.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.welcomePageUrl = ko.observable(Settings.settingsGet('WelcomePageUrl'));
|
||||
this.welcomePageUrl.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.welcomePageDisplay = ko.observable(Settings.settingsGet('WelcomePageDisplay'));
|
||||
this.welcomePageDisplay.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.welcomePageDisplay.options = ko.computed(function() {
|
||||
Translator.trigger();
|
||||
return [
|
||||
{'optValue': 'none', 'optText': Translator.i18n('TAB_BRANDING/OPTION_WELCOME_PAGE_DISPLAY_NONE')},
|
||||
{'optValue': 'once', 'optText': Translator.i18n('TAB_BRANDING/OPTION_WELCOME_PAGE_DISPLAY_ONCE')},
|
||||
{'optValue': 'always', 'optText': Translator.i18n('TAB_BRANDING/OPTION_WELCOME_PAGE_DISPLAY_ALWAYS')}
|
||||
];
|
||||
});
|
||||
|
||||
this.loginPowered = ko.observable(!!Settings.settingsGet('LoginPowered'));
|
||||
|
||||
this.community = RL_COMMUNITY || AppStore.community();
|
||||
}
|
||||
|
||||
BrandingAdminSettings.prototype.onBuild = function()
|
||||
{
|
||||
var
|
||||
self = this,
|
||||
Remote = require('Remote/Admin/Ajax');
|
||||
|
||||
_.delay(function() {
|
||||
|
||||
var
|
||||
f1 = Utils.settingsSaveHelperSimpleFunction(self.title.trigger, self),
|
||||
f2 = Utils.settingsSaveHelperSimpleFunction(self.loadingDesc.trigger, self),
|
||||
f3 = Utils.settingsSaveHelperSimpleFunction(self.faviconUrl.trigger, self);
|
||||
|
||||
self.title.subscribe(function(sValue) {
|
||||
Remote.saveAdminConfig(f1, {
|
||||
'Title': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.loadingDesc.subscribe(function(sValue) {
|
||||
Remote.saveAdminConfig(f2, {
|
||||
'LoadingDescription': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.faviconUrl.subscribe(function(sValue) {
|
||||
Remote.saveAdminConfig(f3, {
|
||||
'FaviconUrl': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
}, 50);
|
||||
};
|
||||
|
||||
module.exports = BrandingAdminSettings;
|
||||
74
dev/Settings/Admin/Branding.jsx
Normal file
74
dev/Settings/Admin/Branding.jsx
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
|
||||
import _ from '_';
|
||||
import ko from 'ko';
|
||||
|
||||
import {settingsSaveHelperSimpleFunction, trim} from 'Common/Utils';
|
||||
import {i18n, trigger as translatorTrigger} from 'Common/Translator';
|
||||
|
||||
import {settingsGet} from 'Storage/Settings';
|
||||
|
||||
class BrandingAdminSettings
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
const AppStore = require('Stores/Admin/App');
|
||||
|
||||
this.capa = AppStore.prem;
|
||||
|
||||
this.title = ko.observable(settingsGet('Title')).extend({idleTrigger: true});
|
||||
this.loadingDesc = ko.observable(settingsGet('LoadingDescription')).extend({idleTrigger: true});
|
||||
this.faviconUrl = ko.observable(settingsGet('FaviconUrl')).extend({idleTrigger: true});
|
||||
this.loginLogo = ko.observable(settingsGet('LoginLogo') || '').extend({idleTrigger: true});
|
||||
this.loginBackground = ko.observable(settingsGet('LoginBackground') || '').extend({idleTrigger: true});
|
||||
this.userLogo = ko.observable(settingsGet('UserLogo') || '').extend({idleTrigger: true});
|
||||
this.userLogoMessage = ko.observable(settingsGet('UserLogoMessage') || '').extend({idleTrigger: true});
|
||||
this.userIframeMessage = ko.observable(settingsGet('UserIframeMessage') || '').extend({idleTrigger: true});
|
||||
this.userLogoTitle = ko.observable(settingsGet('UserLogoTitle') || '').extend({idleTrigger: true});
|
||||
this.loginDescription = ko.observable(settingsGet('LoginDescription')).extend({idleTrigger: true});
|
||||
this.loginCss = ko.observable(settingsGet('LoginCss')).extend({idleTrigger: true});
|
||||
this.userCss = ko.observable(settingsGet('UserCss')).extend({idleTrigger: true});
|
||||
this.welcomePageUrl = ko.observable(settingsGet('WelcomePageUrl')).extend({idleTrigger: true});
|
||||
this.welcomePageDisplay = ko.observable(settingsGet('WelcomePageDisplay')).extend({idleTrigger: true});
|
||||
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')}
|
||||
];
|
||||
});
|
||||
|
||||
this.loginPowered = ko.observable(!!settingsGet('LoginPowered'));
|
||||
this.community = RL_COMMUNITY || AppStore.community();
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
this.title.subscribe((value) => {
|
||||
Remote.saveAdminConfig(f1, {
|
||||
'Title': trim(value)
|
||||
});
|
||||
});
|
||||
|
||||
this.loadingDesc.subscribe((value) => {
|
||||
Remote.saveAdminConfig(f2, {
|
||||
'LoadingDescription': trim(value)
|
||||
});
|
||||
});
|
||||
|
||||
this.faviconUrl.subscribe((value) => {
|
||||
Remote.saveAdminConfig(f3, {
|
||||
'FaviconUrl': trim(value)
|
||||
});
|
||||
});
|
||||
}, 50);
|
||||
}
|
||||
}
|
||||
|
||||
export {BrandingAdminSettings, BrandingAdminSettings as default};
|
||||
|
|
@ -231,4 +231,4 @@ ContactsAdminSettings.prototype.onBuild = function()
|
|||
}, 50);
|
||||
};
|
||||
|
||||
module.exports = ContactsAdminSettings;
|
||||
export {ContactsAdminSettings, ContactsAdminSettings as default};
|
||||
|
|
@ -75,4 +75,4 @@ DomainsAdminSettings.prototype.onDomainListChangeRequest = function()
|
|||
require('App/Admin').default.reloadDomainList();
|
||||
};
|
||||
|
||||
module.exports = DomainsAdminSettings;
|
||||
export {DomainsAdminSettings, DomainsAdminSettings as default};
|
||||
|
|
@ -199,4 +199,4 @@ GeneralAdminSettings.prototype.phpInfoLink = function()
|
|||
return Links.phpInfo();
|
||||
};
|
||||
|
||||
module.exports = GeneralAdminSettings;
|
||||
export {GeneralAdminSettings, GeneralAdminSettings as default};
|
||||
|
|
@ -63,4 +63,4 @@ LoginAdminSettings.prototype.onBuild = function()
|
|||
}, 50);
|
||||
};
|
||||
|
||||
module.exports = LoginAdminSettings;
|
||||
export {LoginAdminSettings, LoginAdminSettings as default};
|
||||
|
|
@ -103,4 +103,4 @@ PackagesAdminSettings.prototype.installPackage = function(oPackage)
|
|||
}
|
||||
};
|
||||
|
||||
module.exports = PackagesAdminSettings;
|
||||
export {PackagesAdminSettings, PackagesAdminSettings as default};
|
||||
|
|
@ -1,6 +1,4 @@
|
|||
|
||||
/* global RL_COMMUNITY */
|
||||
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
|
@ -108,4 +106,4 @@ PluginsAdminSettings.prototype.onPluginDisableRequest = function(sResult, oData)
|
|||
require('App/Admin').default.reloadPluginList();
|
||||
};
|
||||
|
||||
module.exports = PluginsAdminSettings;
|
||||
export {PluginsAdminSettings, PluginsAdminSettings as default};
|
||||
|
|
@ -179,4 +179,4 @@ SecurityAdminSettings.prototype.phpInfoLink = function()
|
|||
return Links.phpInfo();
|
||||
};
|
||||
|
||||
module.exports = SecurityAdminSettings;
|
||||
export {SecurityAdminSettings, SecurityAdminSettings as default};
|
||||
|
|
@ -171,4 +171,4 @@ SocialAdminSettings.prototype.onBuild = function()
|
|||
}, 50);
|
||||
};
|
||||
|
||||
module.exports = SocialAdminSettings;
|
||||
export {SocialAdminSettings, SocialAdminSettings as default};
|
||||
Loading…
Add table
Add a link
Reference in a new issue