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

@ -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};