mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-01 05:29:20 +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
|
|
@ -13,8 +13,12 @@
|
|||
Utils = require('Common/Utils'),
|
||||
Links = require('Common/Links'),
|
||||
|
||||
Translator = require('Common/Translator'),
|
||||
|
||||
Plugins = require('Common/Plugins'),
|
||||
|
||||
UserSettingsStore = require('Stores/UserSettings'),
|
||||
|
||||
Settings = require('Storage/Settings'),
|
||||
Data = require('Storage/User/Data'),
|
||||
Remote = require('Storage/User/Remote'),
|
||||
|
|
@ -87,11 +91,12 @@
|
|||
this.allowLanguagesOnLogin = Data.allowLanguagesOnLogin;
|
||||
|
||||
this.langRequest = ko.observable(false);
|
||||
this.mainLanguage = Data.mainLanguage;
|
||||
this.language = UserSettingsStore.language;
|
||||
|
||||
this.bSendLanguage = false;
|
||||
|
||||
this.mainLanguageFullName = ko.computed(function () {
|
||||
return Utils.convertLangName(this.mainLanguage());
|
||||
this.languageFullName = ko.computed(function () {
|
||||
return Utils.convertLangName(this.language());
|
||||
}, this);
|
||||
|
||||
this.signMeType = ko.observable(Enums.LoginSignMeType.Unused);
|
||||
|
|
@ -133,7 +138,7 @@
|
|||
Plugins.runHook('user-login-submit', [fSubmitResult]);
|
||||
if (0 < iPluginResultCode)
|
||||
{
|
||||
this.submitError(Utils.getNotification(iPluginResultCode));
|
||||
this.submitError(Translator.getNotification(iPluginResultCode));
|
||||
return false;
|
||||
}
|
||||
else if ('' !== sPluginResultMessage)
|
||||
|
|
@ -180,11 +185,11 @@
|
|||
oData.ErrorCode = Enums.Notification.AuthError;
|
||||
}
|
||||
|
||||
this.submitError(Utils.getNotification(oData.ErrorCode));
|
||||
this.submitError(Translator.getNotification(oData.ErrorCode));
|
||||
|
||||
if ('' === this.submitError())
|
||||
{
|
||||
this.submitError(Utils.getNotification(Enums.Notification.UnknownError));
|
||||
this.submitError(Translator.getNotification(Enums.Notification.UnknownError));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -202,11 +207,11 @@
|
|||
else
|
||||
{
|
||||
this.submitRequest(false);
|
||||
this.submitError(Utils.getNotification(Enums.Notification.UnknownError));
|
||||
this.submitError(Translator.getNotification(Enums.Notification.UnknownError));
|
||||
}
|
||||
|
||||
}, this), this.email(), '', sPassword, !!this.signMe(),
|
||||
this.bSendLanguage ? this.mainLanguage() : '',
|
||||
this.bSendLanguage ? this.language() : '',
|
||||
this.additionalCode.visibility() ? this.additionalCode() : '',
|
||||
this.additionalCode.visibility() ? !!this.additionalCodeSignMe() : false
|
||||
);
|
||||
|
|
@ -302,7 +307,7 @@
|
|||
|
||||
if (Settings.settingsGet('UserLanguage'))
|
||||
{
|
||||
$.cookie('rllang', Data.language(), {'expires': 30});
|
||||
$.cookie('rllang', UserSettingsStore.language(), {'expires': 30});
|
||||
}
|
||||
|
||||
}, this), 100);
|
||||
|
|
@ -328,7 +333,7 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
self.submitError(Utils.getNotification(iErrorCode));
|
||||
self.submitError(Translator.getNotification(iErrorCode));
|
||||
}
|
||||
}
|
||||
;
|
||||
|
|
@ -371,11 +376,11 @@
|
|||
}
|
||||
|
||||
_.delay(function () {
|
||||
Data.language.subscribe(function (sValue) {
|
||||
UserSettingsStore.language.subscribe(function (sValue) {
|
||||
|
||||
self.langRequest(true);
|
||||
|
||||
Utils.reloadLanguage(sValue, function() {
|
||||
Translator.reload(sValue, function() {
|
||||
self.langRequest(false);
|
||||
self.bSendLanguage = true;
|
||||
$.cookie('rllang', sValue, {'expires': 30});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue