es5 -> es2015 (last stage)

Signature plugin fixes
Add view decorator
A large number of fixes
This commit is contained in:
RainLoop Team 2016-08-17 01:01:20 +03:00
parent e88c193334
commit 17669b7be0
153 changed files with 21193 additions and 21115 deletions

View file

@ -8,12 +8,14 @@ import {root} from 'Common/Links';
import {capa} from 'Storage/Settings';
import {showScreenPopup, routeOff, setHash} from 'Knoin/Knoin';
import AccountStore from 'Stores/User/Account';
import IdentityStore from 'Stores/User/Identity';
import Remote from 'Remote/User/Ajax';
import {getApp} from 'Helper/Apps/User';
import {showScreenPopup, routeOff, setHash} from 'Knoin/Knoin';
class AccountsUserSettings
{
constructor() {
@ -66,7 +68,7 @@ class AccountsUserSettings
{
this.accounts.remove((account) => accountToRemove === account);
Remote.accountDelete(function(result, data) {
Remote.accountDelete((result, data) => {
if (StorageResultType.Success === result && data && data.Result && data.Reload)
{
@ -78,7 +80,7 @@ class AccountsUserSettings
}
else
{
require('App/User').default.accountsAndIdentities();
getApp().accountsAndIdentities();
}
}, accountToRemove.email);
@ -100,7 +102,7 @@ class AccountsUserSettings
IdentityStore.identities.remove((oIdentity) => identityToRemove === oIdentity);
Remote.identityDelete(() => {
require('App/User').default.accountsAndIdentities();
getApp().accountsAndIdentities();
}, identityToRemove.id);
}
}
@ -112,18 +114,19 @@ class AccountsUserSettings
}
onBuild(oDom) {
var self = this;
const self = this;
oDom
.on('click', '.accounts-list .account-item .e-action', function() {
const account = ko.dataFor(this);
.on('click', '.accounts-list .account-item .e-action', function() { // eslint-disable-line prefer-arrow-callback
const account = ko.dataFor(this); // eslint-disable-line no-invalid-this
if (account)
{
self.editAccount(account);
}
})
.on('click', '.identities-list .identity-item .e-action', function() {
const identity = ko.dataFor(this);
.on('click', '.identities-list .identity-item .e-action', function() { // eslint-disable-line prefer-arrow-callback
const identity = ko.dataFor(this); // eslint-disable-line no-invalid-this
if (identity)
{
self.editIdentity(identity);

View file

@ -8,6 +8,8 @@ import {getNotificationFromResponse, i18n} from 'Common/Translator';
import Remote from 'Remote/User/Ajax';
import {getApp} from 'Helper/Apps/User';
class ChangePasswordUserSettings
{
constructor() {
@ -41,7 +43,7 @@ class ChangePasswordUserSettings
this.passwordMismatch(false);
});
this.saveNewPasswordCommand = createCommand(this, () => {
this.saveNewPasswordCommand = createCommand(() => {
if (this.newPassword() !== this.newPassword2())
{
this.passwordMismatch(true);
@ -90,7 +92,7 @@ class ChangePasswordUserSettings
this.passwordUpdateSuccess(true);
this.currentPassword.error(false);
require('App/User').default.setClientSideToken(data.Result);
getApp().setClientSideToken(data.Result);
}
else
{

View file

@ -47,7 +47,7 @@ class FiltersUserSettings
this.filterForDeletion = ko.observable(null)
.extend({falseTimeout: 3000}).extend({toggleSubscribeProperty: [this, 'deleteAccess']});
this.saveChanges = createCommand(this, () => {
this.saveChanges = createCommand(() => {
if (!this.filters.saving())
{
if (this.filterRaw.active() && '' === trim(this.filterRaw()))
@ -187,11 +187,12 @@ class FiltersUserSettings
}
onBuild(oDom) {
const self = this;
oDom
.on('click', '.filter-item .e-action', function() {
const filter = ko.dataFor(this);
.on('click', '.filter-item .e-action', function() { // eslint-disable-line prefer-arrow-callback
const filter = ko.dataFor(this); // eslint-disable-line no-invalid-this
if (filter)
{
self.editFilter(filter);

View file

@ -10,13 +10,15 @@ import {removeFolderFromCacheList} from 'Common/Cache';
import {appSettingsGet} from 'Storage/Settings';
import * as Local from 'Storage/Client';
import {showScreenPopup} from 'Knoin/Knoin';
import FolderStore from 'Stores/User/Folder';
import Promises from 'Promises/User/Ajax';
import Remote from 'Remote/User/Ajax';
import {getApp} from 'Helper/Apps/User';
import {showScreenPopup} from 'Knoin/Knoin';
class FoldersUserSettings
{
constructor() {
@ -61,7 +63,7 @@ class FoldersUserSettings
{
Local.set(ClientSideKeyName.FoldersLashHash, '');
require('App/User').default.foldersPromisesActionHelper(
getApp().foldersPromisesActionHelper(
Promises.folderRename(folder.fullNameRaw, nameToEdit, FolderStore.foldersRenaming),
Notification.CantRenameFolder
);
@ -131,7 +133,7 @@ class FoldersUserSettings
FolderStore.folderList.remove(fRemoveFolder);
require('App/User').default.foldersPromisesActionHelper(
getApp().foldersPromisesActionHelper(
Promises.folderDelete(folderToRemove.fullNameRaw, FolderStore.foldersDeleting),
Notification.CantDeleteFolder
);

View file

@ -165,7 +165,7 @@ class GeneralUserSettings
});
});
this.layout.subscribe(function(value) {
this.layout.subscribe((value) => {
MessageStore.messageList([]);
Remote.saveSettings(f2, {
'Layout': value

View file

@ -5,10 +5,12 @@ import ko from 'ko';
import {delegateRunOnDestroy} from 'Common/Utils';
import {bIsHttps} from 'Common/Globals';
import {showScreenPopup} from 'Knoin/Knoin';
import PgpStore from 'Stores/User/Pgp';
import {getApp} from 'Helper/Apps/User';
import {showScreenPopup} from 'Knoin/Knoin';
class OpenPgpUserSettings
{
constructor() {
@ -60,7 +62,7 @@ class OpenPgpUserSettings
PgpStore.openpgpKeyring.store();
}
require('App/User').default.reloadOpenPgpKeys();
getApp().reloadOpenPgpKeys();
}
}
}

View file

@ -3,6 +3,8 @@ import {createCommand} from 'Common/Utils';
import SocialStore from 'Stores/Social';
import {getApp} from 'Helper/Apps/User';
class SocialUserSettings
{
constructor() {
@ -28,43 +30,39 @@ class SocialUserSettings
this.twitterLoggined = SocialStore.twitter.loggined;
this.twitterUserName = SocialStore.twitter.userName;
this.connectGoogle = createCommand(this, () => {
this.connectGoogle = createCommand(() => {
if (!this.googleLoggined())
{
this.getApp().googleConnect();
getApp().googleConnect();
}
}, () => !this.googleLoggined() && !this.googleActions());
this.disconnectGoogle = createCommand(this, () => {
this.getApp().googleDisconnect();
this.disconnectGoogle = createCommand(() => {
getApp().googleDisconnect();
});
this.connectFacebook = createCommand(this, () => {
this.connectFacebook = createCommand(() => {
if (!this.facebookLoggined())
{
this.getApp().facebookConnect();
getApp().facebookConnect();
}
}, () => !this.facebookLoggined() && !this.facebookActions());
this.disconnectFacebook = createCommand(this, () => {
this.getApp().facebookDisconnect();
this.disconnectFacebook = createCommand(() => {
getApp().facebookDisconnect();
});
this.connectTwitter = createCommand(this, () => {
this.connectTwitter = createCommand(() => {
if (!this.twitterLoggined())
{
this.getApp().twitterConnect();
getApp().twitterConnect();
}
}, () => !this.twitterLoggined() && !this.twitterActions());
this.disconnectTwitter = createCommand(this, () => {
this.getApp().twitterDisconnect();
this.disconnectTwitter = createCommand(() => {
getApp().twitterDisconnect();
});
}
getApp() {
return require('App/User').default;
}
}
export {SocialUserSettings, SocialUserSettings as default};

View file

@ -3,11 +3,13 @@ import ko from 'ko';
import {i18n} from 'Common/Translator';
import {showScreenPopup} from 'Knoin/Knoin';
import TemplateStore from 'Stores/User/Template';
import Remote from 'Remote/User/Ajax';
import {getApp} from 'Helper/Apps/User';
import {showScreenPopup} from 'Knoin/Knoin';
class TemplatesUserSettings
{
constructor() {
@ -55,19 +57,16 @@ class TemplatesUserSettings
}
reloadTemplates() {
this.getApp().templates();
}
getApp() {
return require('App/User').default;
getApp().templates();
}
onBuild(oDom) {
var self = this;
const self = this;
oDom
.on('click', '.templates-list .template-item .e-action', function() {
const template = ko.dataFor(this);
.on('click', '.templates-list .template-item .e-action', function() { // eslint-disable-line prefer-arrow-callback
const template = ko.dataFor(this); // eslint-disable-line no-invalid-this
if (template)
{
self.editTemplate(template);