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,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()))
{