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

@ -1,2 +0,0 @@
/Admin/Prem/**
/Admin/_Prem/**

View file

@ -1,11 +1,15 @@
/* global RL_COMMUNITY */
import ko from 'ko';
import {i18n, trigger as translatorTrigger} from 'Common/Translator';
import {appSettingsGet, settingsGet} from 'Storage/Settings';
import CoreStore from 'Stores/Admin/Core';
import AppStore from 'Stores/Admin/App';
import CoreStore from 'Stores/Admin/Core';
import {getApp} from 'Helper/Apps/Admin';
class AboutAdminSettings
{
@ -71,14 +75,14 @@ class AboutAdminSettings
onBuild() {
if (this.access() && !this.community)
{
require('App/Admin').default.reloadCoreData();
getApp().reloadCoreData();
}
}
updateCoreData() {
if (!this.coreUpdating() && !this.community)
{
require('App/Admin').default.updateCoreData();
getApp().updateCoreData();
}
}
}

View file

@ -1,4 +1,6 @@
/* global RL_COMMUNITY */
import _ from '_';
import ko from 'ko';

View file

@ -91,11 +91,11 @@ class ContactsAdminSettings
}
}).extend({notify: 'always'});
this.contactsType.subscribe(function() {
this.contactsType.subscribe(() => {
this.testContactsSuccess(false);
this.testContactsError(false);
this.testContactsErrorMessage('');
}, this);
});
this.pdoDsn = ko.observable(settingsGet('ContactsPdoDsn'));
this.pdoUser = ko.observable(settingsGet('ContactsPdoUser'));
@ -111,7 +111,7 @@ class ContactsAdminSettings
this.testContactsError = ko.observable(false);
this.testContactsErrorMessage = ko.observable('');
this.testContactsCommand = createCommand(this, () => {
this.testContactsCommand = createCommand(() => {
this.testContactsSuccess(false);
this.testContactsError(false);

View file

@ -8,6 +8,8 @@ import {showScreenPopup} from 'Knoin/Knoin';
import DomainStore from 'Stores/Admin/Domain';
import Remote from 'Remote/Admin/Ajax';
import {getApp} from 'Helper/Apps/Admin';
class DomainsAdminSettings
{
constructor() {
@ -42,15 +44,15 @@ class DomainsAdminSettings
onBuild(oDom) {
const self = this;
oDom
.on('click', '.b-admin-domains-list-table .e-item .e-action', function() {
const domainItem = ko.dataFor(this);
.on('click', '.b-admin-domains-list-table .e-item .e-action', function() { // eslint-disable-line prefer-arrow-callback
const domainItem = ko.dataFor(this); // eslint-disable-line no-invalid-this
if (domainItem)
{
Remote.domain(self.onDomainLoadRequest, domainItem.name);
}
});
require('App/Admin').default.reloadDomainList();
getApp().reloadDomainList();
}
onDomainLoadRequest(sResult, oData) {
@ -61,7 +63,7 @@ class DomainsAdminSettings
}
onDomainListChangeRequest() {
require('App/Admin').default.reloadDomainList();
getApp().reloadDomainList();
}
}

View file

@ -5,16 +5,16 @@ import ko from 'ko';
import {settingsSaveHelperSimpleFunction, boolToAjax, trim} from 'Common/Utils';
import {settingsGet} from 'Storage/Settings';
import AppAdminStore from 'Stores/Admin/App';
import AppStore from 'Stores/Admin/App';
class LoginAdminSettings
{
constructor() {
this.determineUserLanguage = AppAdminStore.determineUserLanguage;
this.determineUserDomain = AppAdminStore.determineUserDomain;
this.determineUserLanguage = AppStore.determineUserLanguage;
this.determineUserDomain = AppStore.determineUserDomain;
this.defaultDomain = ko.observable(settingsGet('LoginDefaultDomain')).idleTrigger();
this.allowLanguagesOnLogin = AppAdminStore.allowLanguagesOnLogin;
this.allowLanguagesOnLogin = AppStore.allowLanguagesOnLogin;
this.dummy = ko.observable(false);
}

View file

@ -9,6 +9,8 @@ import {getNotification} from 'Common/Translator';
import PackageStore from 'Stores/Admin/Package';
import Remote from 'Remote/Admin/Ajax';
import {getApp} from 'Helper/Apps/Admin';
class PackagesAdminSettings
{
constructor() {
@ -30,7 +32,7 @@ class PackagesAdminSettings
}
onBuild() {
require('App/Admin').default.reloadPackagesList();
getApp().reloadPackagesList();
}
requestHelper(packageToRequest, install) {
@ -63,7 +65,7 @@ class PackagesAdminSettings
}
else
{
require('App/Admin').default.reloadPackagesList();
getApp().reloadPackagesList();
}
};
}

View file

@ -1,4 +1,6 @@
/* global RL_COMMUNITY */
import _ from '_';
import ko from 'ko';
@ -14,6 +16,8 @@ import PluginStore from 'Stores/Admin/Plugin';
import Remote from 'Remote/Admin/Ajax';
import {getApp} from 'Helper/Apps/Admin';
class PluginsAdminSettings
{
constructor() {
@ -40,17 +44,19 @@ class PluginsAdminSettings
}
onBuild(oDom) {
const self = this;
oDom
.on('click', '.e-item .configure-plugin-action', function() {
const plugin = ko.dataFor(this);
.on('click', '.e-item .configure-plugin-action', function() { // eslint-disable-line prefer-arrow-callback
const plugin = ko.dataFor(this); // eslint-disable-line no-invalid-this
if (plugin)
{
self.configurePlugin(plugin);
}
})
.on('click', '.e-item .disabled-plugin', function() {
const plugin = ko.dataFor(this);
.on('click', '.e-item .disabled-plugin', function() { // eslint-disable-line prefer-arrow-callback
const plugin = ko.dataFor(this); // eslint-disable-line no-invalid-this
if (plugin)
{
self.disablePlugin(plugin);
@ -66,7 +72,7 @@ class PluginsAdminSettings
onShow() {
PluginStore.plugins.error('');
require('App/Admin').default.reloadPluginList();
getApp().reloadPluginList();
}
onPluginLoadRequest(result, data) {
@ -92,7 +98,7 @@ class PluginsAdminSettings
}
}
require('App/Admin').default.reloadPluginList();
getApp().reloadPluginList();
}
}

View file

@ -0,0 +1,105 @@
import _ from '_';
import {settingsSaveHelperSimpleFunction, trim, boolToAjax} from 'Common/Utils';
import {BrandingAdminSettings} from 'Settings/Admin/Branding';
class BrandingPremAdminSettings extends BrandingAdminSettings
{
onBuild(oDom) {
super.onBuild(oDom);
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),
f4 = settingsSaveHelperSimpleFunction(this.userLogo.trigger, this),
f5 = settingsSaveHelperSimpleFunction(this.userLogoTitle.trigger, this),
f6 = settingsSaveHelperSimpleFunction(this.loginBackground.trigger, this),
f7 = settingsSaveHelperSimpleFunction(this.userCss.trigger, this),
f8 = settingsSaveHelperSimpleFunction(this.welcomePageUrl.trigger, this),
f9 = settingsSaveHelperSimpleFunction(this.welcomePageDisplay.trigger, this),
f10 = settingsSaveHelperSimpleFunction(this.userLogoMessage.trigger, this),
f11 = settingsSaveHelperSimpleFunction(this.userIframeMessage.trigger, this);
this.loginLogo.subscribe((value) => {
Remote.saveAdminConfig(f1, {
'LoginLogo': trim(value)
});
});
this.loginDescription.subscribe((value) => {
Remote.saveAdminConfig(f2, {
'LoginDescription': trim(value)
});
});
this.loginCss.subscribe((value) => {
Remote.saveAdminConfig(f3, {
'LoginCss': trim(value)
});
});
this.userLogo.subscribe((value) => {
Remote.saveAdminConfig(f4, {
'UserLogo': trim(value)
});
});
this.userLogoTitle.subscribe((value) => {
Remote.saveAdminConfig(f5, {
'UserLogoTitle': trim(value)
});
});
this.userLogoMessage.subscribe((value) => {
Remote.saveAdminConfig(f10, {
'UserLogoMessage': trim(value)
});
});
this.userIframeMessage.subscribe((value) => {
Remote.saveAdminConfig(f11, {
'UserIframeMessage': trim(value)
});
});
this.loginBackground.subscribe((value) => {
Remote.saveAdminConfig(f6, {
'LoginBackground': trim(value)
});
});
this.userCss.subscribe((value) => {
Remote.saveAdminConfig(f7, {
'UserCss': trim(value)
});
});
this.welcomePageUrl.subscribe((value) => {
Remote.saveAdminConfig(f8, {
'WelcomePageUrl': trim(value)
});
});
this.welcomePageDisplay.subscribe((value) => {
Remote.saveAdminConfig(f9, {
'WelcomePageDisplay': trim(value)
});
});
this.loginPowered.subscribe((value) => {
Remote.saveAdminConfig(null, {
'LoginPowered': boolToAjax(value)
});
});
}, 50);
}
}
}
export {BrandingPremAdminSettings, BrandingPremAdminSettings as default};

View file

@ -0,0 +1,71 @@
import ko from 'ko';
import {settingsGet} from 'Storage/Settings';
import {showScreenPopup} from 'Knoin/Knoin';
import LicenseStore from 'Stores/Admin/License';
import {getApp} from 'Helper/Apps/Admin';
class LicensingPremAdminSettings
{
constructor() {
this.licensing = LicenseStore.licensing;
this.licensingProcess = LicenseStore.licensingProcess;
this.licenseValid = LicenseStore.licenseValid;
this.licenseExpired = LicenseStore.licenseExpired;
this.licenseError = LicenseStore.licenseError;
this.licenseTrigger = LicenseStore.licenseTrigger;
this.adminDomain = ko.observable('');
this.subscriptionEnabled = ko.observable(!!settingsGet('SubscriptionEnabled'));
this.licenseTrigger.subscribe(() => {
if (this.subscriptionEnabled())
{
getApp().reloadLicensing(true);
}
});
}
onBuild() {
if (this.subscriptionEnabled())
{
getApp().reloadLicensing(false);
}
}
onShow() {
this.adminDomain(settingsGet('AdminDomain'));
}
showActivationForm() {
showScreenPopup(require('View/Popup/Activate'));
}
showTrialForm() {
showScreenPopup(require('View/Popup/Activate'), [true]);
}
/**
* @returns {boolean}
*/
licenseIsUnlim() {
return 1898625600 === this.licenseExpired() || 1898625700 === this.licenseExpired(); // eslint-disable-line no-magic-numbers
}
/**
* @returns {string}
*/
licenseExpiredMomentValue() {
const
moment = require('moment'),
time = this.licenseExpired(),
momentUnix = moment.unix(time);
return this.licenseIsUnlim() ? 'Never' : (time && (momentUnix.format('LL') + ' (' + momentUnix.from(moment()) + ')'));
}
}
export {LicensingPremAdminSettings, LicensingPremAdminSettings as default};

View file

@ -77,7 +77,7 @@ class SecurityAdminSettings
this.adminPasswordNewError(false);
});
this.saveNewAdminPasswordCommand = createCommand(this, () => {
this.saveNewAdminPasswordCommand = createCommand(() => {
if ('' === trim(this.adminLogin()))
{

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);