mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 04:29:21 +03:00
Code refactoring (Translator, Stores, ko)
This commit is contained in:
parent
929bffccef
commit
b42ce01e7e
102 changed files with 6775 additions and 6511 deletions
|
|
@ -11,6 +11,8 @@
|
|||
Utils = require('Common/Utils'),
|
||||
Links = require('Common/Links'),
|
||||
|
||||
UserSettingsStore = require('Stores/UserSettings'),
|
||||
|
||||
Settings = require('Storage/Settings'),
|
||||
Data = require('Storage/Admin/Data')
|
||||
;
|
||||
|
|
@ -20,11 +22,10 @@
|
|||
*/
|
||||
function GeneralAdminSettings()
|
||||
{
|
||||
this.mainLanguage = Data.mainLanguage;
|
||||
this.mainTheme = Data.mainTheme;
|
||||
|
||||
this.language = Data.language;
|
||||
this.theme = Data.theme;
|
||||
this.language = UserSettingsStore.language;
|
||||
this.languages = UserSettingsStore.languages;
|
||||
this.theme = UserSettingsStore.theme;
|
||||
this.themes = UserSettingsStore.themes;
|
||||
|
||||
this.capaThemes = Data.capaThemes;
|
||||
this.capaUserBackground = Data.capaUserBackground;
|
||||
|
|
@ -44,16 +45,16 @@
|
|||
].join('') : '';
|
||||
|
||||
this.themesOptions = ko.computed(function () {
|
||||
return _.map(Data.themes(), function (sTheme) {
|
||||
return _.map(this.themes(), function (sTheme) {
|
||||
return {
|
||||
'optValue': sTheme,
|
||||
'optText': Utils.convertThemeName(sTheme)
|
||||
};
|
||||
});
|
||||
});
|
||||
}, this);
|
||||
|
||||
this.mainLanguageFullName = ko.computed(function () {
|
||||
return Utils.convertLangName(this.mainLanguage());
|
||||
this.languageFullName = ko.computed(function () {
|
||||
return Utils.convertLangName(this.language());
|
||||
}, this);
|
||||
|
||||
this.attachmentLimitTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
ko = require('ko'),
|
||||
|
||||
Enums = require('Common/Enums'),
|
||||
Utils = require('Common/Utils'),
|
||||
Translator = require('Common/Translator'),
|
||||
|
||||
Data = require('Storage/Admin/Data'),
|
||||
Remote = require('Storage/Admin/Remote')
|
||||
|
|
@ -61,11 +61,11 @@
|
|||
{
|
||||
if (oData && oData.ErrorCode)
|
||||
{
|
||||
self.packagesError(Utils.getNotification(oData.ErrorCode));
|
||||
self.packagesError(Translator.getNotification(oData.ErrorCode));
|
||||
}
|
||||
else
|
||||
{
|
||||
self.packagesError(Utils.getNotification(
|
||||
self.packagesError(Translator.getNotification(
|
||||
bInstall ? Enums.Notification.CantInstallPackage : Enums.Notification.CantDeletePackage));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
Enums = require('Common/Enums'),
|
||||
Utils = require('Common/Utils'),
|
||||
Translator = require('Common/Translator'),
|
||||
|
||||
Settings = require('Storage/Settings'),
|
||||
Data = require('Storage/Admin/Data'),
|
||||
|
|
@ -99,7 +100,7 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
this.pluginsError(Utils.getNotification(oData.ErrorCode));
|
||||
this.pluginsError(Translator.getNotification(oData.ErrorCode));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,32 +16,42 @@
|
|||
*/
|
||||
function SocialAdminSettings()
|
||||
{
|
||||
var Data = require('Storage/Admin/Data');
|
||||
var SocialStore = require('Stores/Social');
|
||||
|
||||
this.googleEnable = Data.googleEnable;
|
||||
this.googleClientID = Data.googleClientID;
|
||||
this.googleApiKey = Data.googleApiKey;
|
||||
this.googleClientSecret = Data.googleClientSecret;
|
||||
this.googleEnable = SocialStore.google.enabled;
|
||||
this.googleEnableAuth = SocialStore.google.capa.auth;
|
||||
this.googleEnableDrive = SocialStore.google.capa.drive;
|
||||
this.googleEnablePreview = SocialStore.google.capa.preview;
|
||||
|
||||
this.googleEnableRequireClientSettings = SocialStore.google.require.clientSettings;
|
||||
this.googleEnableRequireApiKey = SocialStore.google.require.apiKeySettings;
|
||||
|
||||
this.googleClientID = SocialStore.google.clientID;
|
||||
this.googleClientSecret = SocialStore.google.clientSecret;
|
||||
this.googleApiKey = SocialStore.google.apiKey;
|
||||
|
||||
this.googleTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.googleTrigger2 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.googleTrigger3 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.facebookSupported = Data.facebookSupported;
|
||||
this.facebookEnable = Data.facebookEnable;
|
||||
this.facebookAppID = Data.facebookAppID;
|
||||
this.facebookAppSecret = Data.facebookAppSecret;
|
||||
this.facebookSupported = SocialStore.facebook.supported;
|
||||
this.facebookEnable = SocialStore.facebook.enabled;
|
||||
this.facebookAppID = SocialStore.facebook.appID;
|
||||
this.facebookAppSecret = SocialStore.facebook.appSecret;
|
||||
|
||||
this.facebookTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.facebookTrigger2 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.twitterEnable = Data.twitterEnable;
|
||||
this.twitterConsumerKey = Data.twitterConsumerKey;
|
||||
this.twitterConsumerSecret = Data.twitterConsumerSecret;
|
||||
this.twitterEnable = SocialStore.twitter.enabled;
|
||||
this.twitterConsumerKey = SocialStore.twitter.consumerKey;
|
||||
this.twitterConsumerSecret = SocialStore.twitter.consumerSecret;
|
||||
|
||||
this.twitterTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.twitterTrigger2 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.dropboxEnable = Data.dropboxEnable;
|
||||
this.dropboxApiKey = Data.dropboxApiKey;
|
||||
this.dropboxEnable = SocialStore.dropbox.enabled;
|
||||
this.dropboxApiKey = SocialStore.dropbox.apiKey;
|
||||
|
||||
this.dropboxTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
}
|
||||
|
||||
|
|
@ -116,19 +126,19 @@
|
|||
});
|
||||
});
|
||||
|
||||
self.googleEnable.auth.subscribe(function (bValue) {
|
||||
self.googleEnableAuth.subscribe(function (bValue) {
|
||||
Remote.saveAdminConfig(Utils.emptyFunction, {
|
||||
'GoogleEnableAuth': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.googleEnable.drive.subscribe(function (bValue) {
|
||||
self.googleEnableDrive.subscribe(function (bValue) {
|
||||
Remote.saveAdminConfig(Utils.emptyFunction, {
|
||||
'GoogleEnableDrive': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.googleEnable.preview.subscribe(function (bValue) {
|
||||
self.googleEnablePreview.subscribe(function (bValue) {
|
||||
Remote.saveAdminConfig(Utils.emptyFunction, {
|
||||
'GoogleEnablePreview': bValue ? '1' : '0'
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue