This commit is contained in:
Yuri Kuznetsov
2023-12-22 11:15:07 +02:00
parent f515c61f25
commit 9fbc97f0e6
31 changed files with 262 additions and 255 deletions
+2 -2
View File
@@ -32,7 +32,7 @@ class EmailAclPortal extends AclPortal {
// noinspection JSUnusedGlobalSymbols
checkModelRead(model, data, precise) {
let result = this.checkModel(model, data, 'read', precise);
const result = this.checkModel(model, data, 'read', precise);
if (result) {
return true;
@@ -42,7 +42,7 @@ class EmailAclPortal extends AclPortal {
return false;
}
let d = data || {};
const d = data || {};
if (d.read === 'no') {
return false;
+4 -4
View File
@@ -32,7 +32,7 @@ class EmailAcl extends Acl {
// noinspection JSUnusedGlobalSymbols
checkModelRead(model, data, precise) {
let result = this.checkModel(model, data, 'read', precise);
const result = this.checkModel(model, data, 'read', precise);
if (result) {
return true;
@@ -42,7 +42,7 @@ class EmailAcl extends Acl {
return false;
}
let d = data || {};
const d = data || {};
if (d.read === 'no') {
return false;
@@ -92,7 +92,7 @@ class EmailAcl extends Acl {
}
checkModelDelete(model, data, precise) {
let result = this.checkModel(model, data, 'delete', precise);
const result = this.checkModel(model, data, 'delete', precise);
if (result) {
return true;
@@ -102,7 +102,7 @@ class EmailAcl extends Acl {
return false;
}
let d = data || {};
const d = data || {};
if (d.read === 'no') {
return false;
+2 -2
View File
@@ -34,9 +34,9 @@ class NoteCollection extends Collection {
/** @inheritDoc */
prepareAttributes(response, params) {
let total = this.total;
const total = this.total;
let list = super.prepareAttributes(response, params);
const list = super.prepareAttributes(response, params);
if (params.data && params.data.after) {
if (total >= 0 && response.total >= 0) {
+5 -5
View File
@@ -33,7 +33,7 @@ import Collection from 'collection';
class TreeCollection extends Collection {
createSeed() {
let seed = new this.constructor();
const seed = new this.constructor();
seed.url = this.url;
seed.model = this.model;
@@ -45,9 +45,9 @@ class TreeCollection extends Collection {
}
prepareAttributes(response, options) {
let list = super.prepareAttributes(response, options);
const list = super.prepareAttributes(response, options);
let seed = this.clone();
const seed = this.clone();
seed.reset();
@@ -61,11 +61,11 @@ class TreeCollection extends Collection {
*/
this.categoryData = response.data || null;
let f = (l, depth) => {
const f = (l, depth) => {
l.forEach(d => {
d.depth = depth;
let c = this.createSeed();
const c = this.createSeed();
if (d.childList) {
if (d.childList.length) {
+1 -1
View File
@@ -49,7 +49,7 @@ class AddressMapController extends Controller {
model.fetch()
.then(() => {
let viewName = this.getMetadata().get(['AddressMap', 'view']) ||
const viewName = this.getMetadata().get(['AddressMap', 'view']) ||
'views/address-map/view';
this.main(viewName, {
+28 -24
View File
@@ -43,7 +43,7 @@ class AdminController extends Controller {
// noinspection JSUnusedGlobalSymbols
actionPage(options) {
let page = options.page;
const page = options.page;
if (options.options) {
options = {
@@ -58,7 +58,7 @@ class AdminController extends Controller {
throw new Error();
}
let methodName = 'action' + Espo.Utils.upperCaseFirst(page);
const methodName = 'action' + Espo.Utils.upperCaseFirst(page);
if (this[methodName]) {
this[methodName](options);
@@ -66,7 +66,7 @@ class AdminController extends Controller {
return;
}
let defs = this.getPageDefs(page);
const defs = this.getPageDefs(page);
if (!defs) {
throw new Espo.Exceptions.NotFound();
@@ -82,7 +82,7 @@ class AdminController extends Controller {
throw new Espo.Exceptions.NotFound();
}
let model = this.getSettingsModel();
const model = this.getSettingsModel();
model.fetch().then(() => {
model.id = '1';
@@ -106,7 +106,7 @@ class AdminController extends Controller {
// noinspection JSUnusedGlobalSymbols
actionIndex(options) {
let isReturn = options.isReturn;
let key = this.name + 'Index';
const key = this.name + 'Index';
if (this.getRouter().backProcessed) {
isReturn = true;
@@ -251,39 +251,42 @@ class AdminController extends Controller {
// noinspection JSUnusedGlobalSymbols
actionLayouts(options) {
var scope = options.scope || null;
var type = options.type || null;
var em = options.em || false;
const scope = options.scope || null;
const type = options.type || null;
const em = options.em || false;
this.main('views/admin/layouts/index', {scope: scope, type: type, em: em});
}
// noinspection JSUnusedGlobalSymbols
actionLabelManager(options) {
var scope = options.scope || null;
var language = options.language || null;
const scope = options.scope || null;
const language = options.language || null;
this.main('views/admin/label-manager/index', {scope: scope, language: language});
}
// noinspection JSUnusedGlobalSymbols
actionTemplateManager(options) {
var name = options.name || null;
const name = options.name || null;
this.main('views/admin/template-manager/index', {name: name});
}
// noinspection JSUnusedGlobalSymbols
actionFieldManager(options) {
var scope = options.scope || null;
var field = options.field || null;
const scope = options.scope || null;
const field = options.field || null;
this.main('views/admin/field-manager/index', {scope: scope, field: field});
}
// noinspection JSUnusedGlobalSymbols
/**
* @param {Record} options
*/
actionEntityManager(options) {
var scope = options.scope || null;
const scope = options.scope || null;
if (scope && options.edit) {
this.main('views/admin/entity-manager/edit', {scope: scope});
@@ -314,7 +317,7 @@ class AdminController extends Controller {
// noinspection JSUnusedGlobalSymbols
actionLinkManager(options) {
var scope = options.scope || null;
const scope = options.scope || null;
this.main('views/admin/link-manager/index', {scope: scope});
}
@@ -328,7 +331,7 @@ class AdminController extends Controller {
* @returns {module:models/settings}
*/
getSettingsModel() {
let model = this.getConfig().clone();
const model = this.getConfig().clone();
model.defs = this.getConfig().defs;
this.listenTo(model, 'after:save', () => {
@@ -337,6 +340,7 @@ class AdminController extends Controller {
this._broadcastChannel.postMessage('update:config');
});
// noinspection JSValidateTypes
return model;
}
@@ -410,7 +414,7 @@ class AdminController extends Controller {
// noinspection JSUnusedGlobalSymbols
actionIntegrations(options) {
var integration = options.name || null;
const integration = options.name || null;
this.main('views/admin/integrations/index', {integration: integration});
}
@@ -427,14 +431,14 @@ class AdminController extends Controller {
this.rebuildRunning = true;
let master = this.get('master');
const master = this.get('master');
Espo.Ui.notify(master.translate('pleaseWait', 'messages'));
Espo.Ajax
.postRequest('Admin/rebuild')
.then(() => {
let msg = master.translate('Rebuild has been done', 'labels', 'Admin');
const msg = master.translate('Rebuild has been done', 'labels', 'Admin');
Espo.Ui.success(msg);
@@ -458,7 +462,7 @@ class AdminController extends Controller {
Espo.Ajax.postRequest('Admin/clearCache')
.then(() => {
let msg = master.translate('Cache has been cleared', 'labels', 'Admin');
const msg = master.translate('Cache has been cleared', 'labels', 'Admin');
Espo.Ui.success(msg);
@@ -473,14 +477,14 @@ class AdminController extends Controller {
* @returns {Object|null}
*/
getPageDefs(page) {
let panelsDefs = this.getMetadata().get(['app', 'adminPanel']) || {};
const panelsDefs = this.getMetadata().get(['app', 'adminPanel']) || {};
let resultDefs = null;
for (let panelKey in panelsDefs) {
let itemList = panelsDefs[panelKey].itemList || [];
for (const panelKey in panelsDefs) {
const itemList = panelsDefs[panelKey].itemList || [];
for (let defs of itemList) {
for (const defs of itemList) {
if (defs.url === '#Admin/' + page) {
resultDefs = defs;
+5 -5
View File
@@ -45,12 +45,12 @@ class BaseController extends Controller {
* }} [options]
*/
login(options) {
let viewName = this.getConfig().get('loginView') || 'views/login';
const viewName = this.getConfig().get('loginView') || 'views/login';
let anotherUser = (options || {}).anotherUser;
let prefilledUsername = (options || {}).username;
const anotherUser = (options || {}).anotherUser;
const prefilledUsername = (options || {}).username;
let viewOptions = {
const viewOptions = {
anotherUser: anotherUser,
prefilledUsername: prefilledUsername,
};
@@ -109,7 +109,7 @@ class BaseController extends Controller {
* Log out.
*/
logout() {
let title = this.getConfig().get('applicationName') || 'EspoCRM';
const title = this.getConfig().get('applicationName') || 'EspoCRM';
$('head title').text(title);
+2 -2
View File
@@ -34,8 +34,8 @@ class EmailController extends RecordController {
super.prepareModelView(model, options);
this.listenToOnce(model, 'after:send', () => {
let key = this.name + 'List';
let stored = this.getStoredMainView(key);
const key = this.name + 'List';
const stored = this.getStoredMainView(key);
if (stored) {
this.clearStoredMainView(key);
+2 -1
View File
@@ -44,11 +44,12 @@ class ExternalAccountController extends Controller {
});
}
// noinspection JSUnusedGlobalSymbols
/**
* @param {{id: string}} options
*/
actionEdit(options) {
let id = options.id;
const id = options.id;
this.collectionFactory.create('ExternalAccount', collection => {
collection.once('sync', () => {
+1 -1
View File
@@ -35,7 +35,7 @@ class LayoutSetController extends RecordController {
* @param {Record} options
*/
actionEditLayouts(options) {
let id = options.id;
const id = options.id;
if (!id) {
throw new Error("ID not passed.");
@@ -32,7 +32,7 @@ class LeadCaptureOptInConfirmationController extends Controller {
// noinspection JSUnusedGlobalSymbols
actionOptInConfirmationSuccess(data) {
let viewName = this.getMetadata().get(['clientDefs', 'LeadCapture', 'optInConfirmationSuccessView']) ||
const viewName = this.getMetadata().get(['clientDefs', 'LeadCapture', 'optInConfirmationSuccessView']) ||
'views/lead-capture/opt-in-confirmation-success';
this.entire(viewName, {
@@ -44,7 +44,7 @@ class LeadCaptureOptInConfirmationController extends Controller {
// noinspection JSUnusedGlobalSymbols
actionOptInConfirmationExpired(data) {
let viewName = this.getMetadata().get(['clientDefs', 'LeadCapture', 'optInConfirmationExpiredView']) ||
const viewName = this.getMetadata().get(['clientDefs', 'LeadCapture', 'optInConfirmationExpiredView']) ||
'views/lead-capture/opt-in-confirmation-expired';
this.entire(viewName, {
+3 -3
View File
@@ -35,8 +35,8 @@ class LoginAsController extends Controller {
* @param {Record} options
*/
actionLogin(options) {
let anotherUser = options.anotherUser;
let username = options.username;
const anotherUser = options.anotherUser;
const username = options.username;
if (!anotherUser) {
throw new Error("No anotherUser.");
@@ -49,7 +49,7 @@ class LoginAsController extends Controller {
this.listenToOnce(this.baseController, 'login', () => {
this.baseController.once('router-set', () => {
let url = window.location.href.split('?')[0];
const url = window.location.href.split('?')[0];
window.location.replace(url);
})
+2 -2
View File
@@ -35,13 +35,13 @@ class NoteController extends Controller {
* @param {Record} options
*/
actionView(options) {
let id = options.id;
const id = options.id;
if (!id) {
throw new Espo.Exceptions.NotFound;
}
let viewName = this.getMetadata().get(['clientDefs', this.name, 'views', 'detail']) ||
const viewName = this.getMetadata().get(['clientDefs', this.name, 'views', 'detail']) ||
'views/note/detail';
let model;
+1 -1
View File
@@ -34,7 +34,7 @@ class PreferencesController extends RecordController {
defaultAction = 'own'
getModel(callback, context) {
let model = new Preferences();
const model = new Preferences();
model.settings = this.getConfig();
model.defs = this.getMetadata().get('entityDefs.Preferences');
+31 -30
View File
@@ -32,6 +32,7 @@ import Controller from 'controller';
/**
* A record controller.
* @template {module:model} TModel
*/
class RecordController extends Controller {
@@ -75,9 +76,9 @@ class RecordController extends Controller {
}
actionList(options) {
let isReturn = options.isReturn || this.getRouter().backProcessed;
const isReturn = options.isReturn || this.getRouter().backProcessed;
let key = this.name + 'List';
const key = this.name + 'List';
if (!isReturn && this.getStoredMainView(key)) {
this.clearStoredMainView(key);
@@ -96,7 +97,7 @@ class RecordController extends Controller {
this.listenToOnce(this.baseController, 'action', abort);
this.listenToOnce(collection, 'sync', () => this.stopListening(this.baseController, 'action', abort));
let viewOptions = {
const viewOptions = {
scope: this.name,
collection: collection,
params: options,
@@ -153,9 +154,9 @@ class RecordController extends Controller {
* }} options
*/
actionView(options) {
let id = options.id;
const id = options.id;
let isReturn = this.getRouter().backProcessed;
const isReturn = this.getRouter().backProcessed;
if (isReturn) {
if (this.lastViewActionOptions && this.lastViewActionOptions.id === id) {
@@ -181,7 +182,7 @@ class RecordController extends Controller {
};
if ('model' in options) {
let model = options.model;
const model = options.model;
createView(model);
@@ -251,9 +252,9 @@ class RecordController extends Controller {
*/
prepareModelCreate(model, options) {
this.listenToOnce(model, 'before:save', () => {
let key = this.name + 'List';
const key = this.name + 'List';
let stored = this.getStoredMainView(key);
const stored = this.getStoredMainView(key);
if (!stored) {
return;
@@ -265,9 +266,9 @@ class RecordController extends Controller {
});
this.listenToOnce(model, 'after:save', () => {
let key = this.name + 'List';
const key = this.name + 'List';
let stored = this.getStoredMainView(key);
const stored = this.getStoredMainView(key);
if (!stored) {
return;
@@ -288,14 +289,14 @@ class RecordController extends Controller {
create(options) {
options = options || {};
let optionsOptions = options.options || {};
const optionsOptions = options.options || {};
this.getModel().then(model => {
if (options.relate) {
model.setRelate(options.relate);
}
let o = {
const o = {
scope: this.name,
model: model,
returnUrl: options.returnUrl,
@@ -303,7 +304,7 @@ class RecordController extends Controller {
params: options,
};
for (let k in optionsOptions) {
for (const k in optionsOptions) {
o[k] = optionsOptions[k];
}
@@ -334,9 +335,9 @@ class RecordController extends Controller {
*/
prepareModelEdit(model, options) {
this.listenToOnce(model, 'before:save', () => {
let key = this.name + 'List';
const key = this.name + 'List';
let stored = this.getStoredMainView(key);
const stored = this.getStoredMainView(key);
if (!stored) {
return;
@@ -349,9 +350,9 @@ class RecordController extends Controller {
}
actionEdit(options) {
let id = options.id;
const id = options.id;
let optionsOptions = options.options || {};
const optionsOptions = options.options || {};
this.getModel().then(model => {
model.id = id;
@@ -369,7 +370,7 @@ class RecordController extends Controller {
.then(() => {
this.hideLoadingNotification();
let o = {
const o = {
scope: this.name,
model: model,
returnUrl: options.returnUrl,
@@ -377,7 +378,7 @@ class RecordController extends Controller {
params: options,
};
for (let k in optionsOptions) {
for (const k in optionsOptions) {
o[k] = optionsOptions[k];
}
@@ -401,12 +402,12 @@ class RecordController extends Controller {
// noinspection JSUnusedGlobalSymbols
actionMerge(options) {
let ids = options.ids.split(',');
const ids = options.ids.split(',');
this.getModel().then((model) => {
let models = [];
const models = [];
let proceed = () => {
const proceed = () => {
this.main('views/merge', {
models: models,
scope: this.name,
@@ -417,7 +418,7 @@ class RecordController extends Controller {
let i = 0;
ids.forEach(id => {
let current = model.clone();
const current = model.clone();
current.id = id;
models.push(current);
@@ -437,10 +438,10 @@ class RecordController extends Controller {
// noinspection JSUnusedGlobalSymbols
actionRelated(options) {
let id = options.id;
let link = options.link;
const id = options.id;
const link = options.link;
let viewName = this.getViewName('listRelated');
const viewName = this.getViewName('listRelated');
let model;
@@ -452,7 +453,7 @@ class RecordController extends Controller {
return model.fetch({main: true});
})
.then(() => {
let foreignEntityType = model.getLinkParam(link, 'entity');
const foreignEntityType = model.getLinkParam(link, 'entity');
if (!foreignEntityType) {
this.baseController.error404();
@@ -486,10 +487,10 @@ class RecordController extends Controller {
throw new Error('No collection for unnamed controller');
}
let entityType = this.entityType || this.name;
const entityType = this.entityType || this.name;
if (usePreviouslyFetched && entityType in this.collectionMap) {
let collection = this.collectionMap[entityType];
const collection = this.collectionMap[entityType];
return Promise.resolve(collection);
}
@@ -516,7 +517,7 @@ class RecordController extends Controller {
throw new Error('No collection for unnamed controller');
}
let modelName = this.entityType || this.name;
const modelName = this.entityType || this.name;
return this.modelFactory.create(modelName, model => {
if (callback) {
+1 -1
View File
@@ -36,7 +36,7 @@ class ImportHandler extends ActionHandler {
.postRequest(`Import/${this.view.model.id}/exportErrors`)
.then(data => {
if (!data.attachmentId) {
let message = this.view.translate('noErrors', 'messages', 'Import');
const message = this.view.translate('noErrors', 'messages', 'Import');
Espo.Ui.warning(message);
+15 -15
View File
@@ -42,12 +42,12 @@ class OidcLoginHandler extends LoginHandler {
this.processWithData(data)
.then(info => {
let code = info.code;
let nonce = info.nonce;
const code = info.code;
const nonce = info.nonce;
let authString = Base64.encode('**oidc:' + code);
const authString = Base64.encode('**oidc:' + code);
let headers = {
const headers = {
'Espo-Authorization': authString,
'Authorization': 'Basic ' + authString,
'X-Oidc-Authorization-Nonce': nonce,
@@ -81,10 +81,10 @@ class OidcLoginHandler extends LoginHandler {
* @return {Promise<{code: string, nonce: string}>}
*/
processWithData(data) {
let state = (Math.random() + 1).toString(36).substring(7);
let nonce = (Math.random() + 1).toString(36).substring(7);
const state = (Math.random() + 1).toString(36).substring(7);
const nonce = (Math.random() + 1).toString(36).substring(7);
let params = {
const params = {
client_id: data.clientId,
redirect_uri: data.redirectUri,
response_type: 'code',
@@ -102,12 +102,12 @@ class OidcLoginHandler extends LoginHandler {
params.claims = data.claims;
}
let partList = Object.entries(params)
const partList = Object.entries(params)
.map(([key, value]) => {
return key + '=' + encodeURIComponent(value);
});
let url = data.endpoint + '?' + partList.join('&');
const url = data.endpoint + '?' + partList.join('&');
return this.processWindow(url, state, nonce);
}
@@ -120,10 +120,10 @@ class OidcLoginHandler extends LoginHandler {
* @return {Promise<{code: string, nonce: string}>}
*/
processWindow(url, state, nonce) {
let proxy = window.open(url, 'ConnectWithOAuth', 'location=0,status=0,width=800,height=800');
const proxy = window.open(url, 'ConnectWithOAuth', 'location=0,status=0,width=800,height=800');
return new Promise((resolve, reject) => {
let fail = () => {
const fail = () => {
window.clearInterval(interval);
if (!proxy.closed) {
@@ -133,7 +133,7 @@ class OidcLoginHandler extends LoginHandler {
reject();
};
let interval = window.setInterval(() => {
const interval = window.setInterval(() => {
if (proxy.closed) {
fail();
@@ -153,7 +153,7 @@ class OidcLoginHandler extends LoginHandler {
return;
}
let parsedData = this.parseWindowUrl(url);
const parsedData = this.parseWindowUrl(url);
if (!parsedData) {
fail();
@@ -200,7 +200,7 @@ class OidcLoginHandler extends LoginHandler {
*/
parseWindowUrl(url) {
try {
let params = new URL(url).searchParams;
const params = new URL(url).searchParams;
return {
code: params.get('code'),
@@ -209,7 +209,7 @@ class OidcLoginHandler extends LoginHandler {
errorDescription: params.get('errorDescription'),
};
}
catch(e) {
catch (e) {
return null;
}
}
@@ -35,7 +35,7 @@ class SameAccountManySelectRelatedHandler extends SelectRelatedHandler {
* @return {Promise<module:handlers/select-related~filters>}
*/
getFilters(model) {
let advanced = {};
const advanced = {};
let accountId = null;
let accountName = null;
@@ -51,7 +51,7 @@ class SameAccountManySelectRelatedHandler extends SelectRelatedHandler {
}
if (accountId) {
let nameHash = {};
const nameHash = {};
nameHash[accountId] = accountName;
advanced.accounts = {
@@ -35,7 +35,7 @@ class SameAccountSelectRelatedHandler extends SelectRelatedHandler {
* @return {Promise<module:handlers/select-related~filters>}
*/
getFilters(model) {
let advanced = {};
const advanced = {};
let accountId = null;
let accountName = null;
@@ -68,4 +68,5 @@ class SameAccountSelectRelatedHandler extends SelectRelatedHandler {
}
}
// noinspection JSUnusedGlobalSymbols
export default SameAccountSelectRelatedHandler;
+8 -8
View File
@@ -61,7 +61,7 @@ class CollapsedModalBar extends View {
}
getDataList() {
let list = [];
const list = [];
let numberList = Espo.Utils.clone(this.numberList);
@@ -86,7 +86,7 @@ class CollapsedModalBar extends View {
let duplicateNumber = 0;
this.numberList.forEach(number => {
let view = this.getModalViewByNumber(number);
const view = this.getModalViewByNumber(number);
if (!view) {
return;
@@ -105,17 +105,17 @@ class CollapsedModalBar extends View {
}
getModalViewByNumber(number) {
let key = 'key-' + number;
const key = 'key-' + number;
return this.getView(key);
}
addModalView(modalView, options) {
let number = this.lastNumber;
const number = this.lastNumber;
this.numberList.push(this.lastNumber);
let key = 'key-' + number;
const key = 'key-' + number;
this.createView(key, 'views/collapsed-modal', {
title: options.title,
@@ -132,7 +132,7 @@ class CollapsedModalBar extends View {
// Use timeout to prevent DOM being updated after modal is re-rendered.
setTimeout(() => {
let key = 'dialog-' + number;
const key = 'dialog-' + number;
this.setView(key, modalView);
@@ -149,9 +149,9 @@ class CollapsedModalBar extends View {
}
removeModalView(number, noReRender) {
let key = 'key-' + number;
const key = 'key-' + number;
let index = this.numberList.indexOf(number);
const index = this.numberList.indexOf(number);
if (~index) {
this.numberList.splice(index, 1);
+40 -40
View File
@@ -43,7 +43,7 @@ class DashboardView extends View {
events = {
/** @this DashboardView */
'click button[data-action="selectTab"]': function (e) {
let tab = parseInt($(e.currentTarget).data('tab'));
const tab = parseInt($(e.currentTarget).data('tab'));
this.selectTab(tab);
},
@@ -80,7 +80,7 @@ class DashboardView extends View {
setupCurrentTabLayout() {
if (!this.dashboardLayout) {
let defaultLayout = [
const defaultLayout = [
{
"name": "My Espo",
"layout": [],
@@ -105,7 +105,7 @@ class DashboardView extends View {
}
}
let dashboardLayout = this.dashboardLayout || [];
const dashboardLayout = this.dashboardLayout || [];
if (dashboardLayout.length <= this.currentTab) {
this.currentTab = 0;
@@ -153,7 +153,7 @@ class DashboardView extends View {
this.dashletsReadOnly = true;
}
else {
let forbiddenPreferencesFieldList = this.getAcl()
const forbiddenPreferencesFieldList = this.getAcl()
.getScopeForbiddenFieldList('Preferences', 'edit');
if (~forbiddenPreferencesFieldList.indexOf('dashboardLayout')) {
@@ -210,14 +210,14 @@ class DashboardView extends View {
this.preservedDashletElements = {};
this.currentTabLayout.forEach(o => {
let key = 'dashlet-' + o.id;
let view = this.getView(key);
const key = 'dashlet-' + o.id;
const view = this.getView(key);
this.unchainView(key);
this.preservedDashletViews[o.id] = view;
let $el = view.$el.children(0);
const $el = view.$el.children(0);
this.preservedDashletElements[o.id] = $el;
@@ -226,8 +226,8 @@ class DashboardView extends View {
}
addPreservedDashlet(id) {
let view = this.preservedDashletViews[id];
let $el = this.preservedDashletElements[id];
const view = this.preservedDashletViews[id];
const $el = this.preservedDashletElements[id];
this.$el.find('.dashlet-container[data-id="'+id+'"]').append($el);
@@ -253,12 +253,12 @@ class DashboardView extends View {
this.$dashboard.empty();
let $dashboard = this.$dashboard;
const $dashboard = this.$dashboard;
$dashboard.addClass('fallback');
this.currentTabLayout.forEach(o => {
let $item = this.prepareFallbackItem(o);
const $item = this.prepareFallbackItem(o);
$dashboard.append($item);
});
@@ -296,20 +296,20 @@ class DashboardView extends View {
fallbackControlHeights() {
this.currentTabLayout.forEach(o => {
let $container = this.$dashboard.find('.dashlet-container[data-id="'+o.id+'"]');
const $container = this.$dashboard.find('.dashlet-container[data-id="' + o.id + '"]');
let headerHeight = $container.find('.panel-heading').outerHeight();
const headerHeight = $container.find('.panel-heading').outerHeight();
let $body = $container.find('.dashlet-body');
const $body = $container.find('.dashlet-body');
let bodyEl = $body.get(0);
const bodyEl = $body.get(0);
if (!bodyEl) {
return;
}
if (bodyEl.scrollHeight > bodyEl.offsetHeight) {
let height = bodyEl.scrollHeight + headerHeight;
const height = bodyEl.scrollHeight + headerHeight;
$container.css('height', height + 'px');
}
@@ -327,7 +327,7 @@ class DashboardView extends View {
this.$dashboard.empty();
let $gridstack = this.$gridstack = this.$dashboard;
const $gridstack = this.$gridstack = this.$dashboard;
$gridstack.removeClass('fallback');
@@ -343,7 +343,7 @@ class DashboardView extends View {
disableResize = true;
}
let grid = this.grid = GridStack.init(
const grid = this.grid = GridStack.init(
{
cellHeight: this.getThemeManager().getParam('dashboardCellHeight') * 1.14,
margin: this.getThemeManager().getParam('dashboardCellMargin') / 2,
@@ -368,7 +368,7 @@ class DashboardView extends View {
grid.removeAll();
this.currentTabLayout.forEach(o => {
let $item = this.prepareGridstackItem(o.id, o.name);
const $item = this.prepareGridstackItem(o.id, o.name);
if (!this.getMetadata().get(['dashlets', o.name])) {
return;
@@ -416,8 +416,8 @@ class DashboardView extends View {
// noinspection SpellCheckingInspection
this.grid.on('resizestop', e => {
let id = $(e.target).data('id');
let view = this.getView('dashlet-' + id);
const id = $(e.target).data('id');
const view = this.getView('dashlet-' + id);
if (!view) {
return;
@@ -429,12 +429,12 @@ class DashboardView extends View {
fetchLayout() {
this.dashboardLayout[this.currentTab].layout =
_.map(this.$gridstack.find('.grid-stack-item'), el => {
let $el = $(el);
const $el = $(el);
let x = $el.attr('gs-x');
let y = $el.attr('gs-y');
let h = $el.attr('gs-h');
let w = $el.attr('gs-w');
const x = $el.attr('gs-x');
const y = $el.attr('gs-y');
const h = $el.attr('gs-h');
const w = $el.attr('gs-w');
return {
id: $el.data('id'),
@@ -448,8 +448,8 @@ class DashboardView extends View {
}
prepareGridstackItem(id, name) {
let $item = $('<div>').addClass('grid-stack-item');
let $container = $('<div class="grid-stack-item-content dashlet-container"></div>');
const $item = $('<div>').addClass('grid-stack-item');
const $container = $('<div class="grid-stack-item-content dashlet-container"></div>');
$container.attr('data-id', id);
$container.attr('data-name', name);
@@ -463,8 +463,8 @@ class DashboardView extends View {
}
prepareFallbackItem(o) {
let $item = $('<div>');
let $container = $('<div class="dashlet-container">');
const $item = $('<div>');
const $container = $('<div class="dashlet-container">');
$container.attr('data-id', o.id);
$container.attr('data-name', o.name);
@@ -507,12 +507,12 @@ class DashboardView extends View {
revertToFallback = true;
}
let $item = this.$gridstack.find('.grid-stack-item[data-id="'+id+'"]');
const $item = this.$gridstack.find('.grid-stack-item[data-id="' + id + '"]');
// noinspection JSUnresolvedReference
this.grid.removeWidget($item.get(0), true);
let layout = this.dashboardLayout[this.currentTab].layout;
const layout = this.dashboardLayout[this.currentTab].layout;
layout.forEach((o, i) => {
if (o.id === id) {
@@ -520,7 +520,7 @@ class DashboardView extends View {
}
});
let o = {};
const o = {};
o.dashletsOptions = this.getPreferences().get('dashletsOptions') || {};
@@ -535,7 +535,7 @@ class DashboardView extends View {
this.getPreferences().save(o, {patch: true});
this.getPreferences().trigger('update');
let index = this.dashletIdList.indexOf(id);
const index = this.dashletIdList.indexOf(id);
if (~index) {
this.dashletIdList.splice(index, index);
@@ -559,9 +559,9 @@ class DashboardView extends View {
revertToFallback = true;
}
let id = 'd' + (Math.floor(Math.random() * 1000001)).toString();
const id = 'd' + (Math.floor(Math.random() * 1000001)).toString();
let $item = this.prepareGridstackItem(id, name);
const $item = this.prepareGridstackItem(id, name);
this.grid.addWidget(
$item.get(0),
@@ -590,7 +590,7 @@ class DashboardView extends View {
}
createDashletView(id, name, label, callback) {
let o = {
const o = {
id: id,
name: name,
};
@@ -628,7 +628,7 @@ class DashboardView extends View {
}
editTabs() {
let dashboardLocked = this.getPreferences().get('dashboardLocked');
const dashboardLocked = this.getPreferences().get('dashboardLocked');
this.createView('editTabs', 'views/modals/edit-dashboard', {
dashboardLayout: this.dashboardLayout,
@@ -640,7 +640,7 @@ class DashboardView extends View {
this.listenToOnce(view, 'after:save', data => {
view.close();
let dashboardLayout = [];
const dashboardLayout = [];
data.dashboardTabList.forEach(name => {
let layout = [];
@@ -657,7 +657,7 @@ class DashboardView extends View {
name = data.renameMap[name];
}
let o = {
const o = {
name: name,
layout: layout,
};
+8 -8
View File
@@ -100,12 +100,12 @@ class DashletView extends View {
}
controlDropdownShown($dropdownContainer) {
let $panel = this.$el.children().first();
const $panel = this.$el.children().first();
let dropdownBottom = $dropdownContainer.find('.dropdown-menu')
const dropdownBottom = $dropdownContainer.find('.dropdown-menu')
.get(0).getBoundingClientRect().bottom;
let panelBottom = $panel.get(0).getBoundingClientRect().bottom;
const panelBottom = $panel.get(0).getBoundingClientRect().bottom;
if (dropdownBottom < panelBottom) {
return;
@@ -124,7 +124,7 @@ class DashletView extends View {
this.id = this.options.id;
this.on('resize', () => {
let bodyView = this.getView('body');
const bodyView = this.getView('body');
if (!bodyView) {
return;
@@ -133,7 +133,7 @@ class DashletView extends View {
bodyView.trigger('resize');
});
let viewName = this.getMetadata().get(['dashlets', this.name, 'view']) ||
const viewName = this.getMetadata().get(['dashlets', this.name, 'view']) ||
'views/dashlets/' + Espo.Utils.camelCaseToHyphen(this.name);
this.createView('body', viewName, {
@@ -157,7 +157,7 @@ class DashletView extends View {
}
actionOptions() {
let optionsView =
const optionsView =
this.getMetadata().get(['dashlets', this.name, 'options', 'view']) ||
this.optionsView ||
'views/dashlets/options/base';
@@ -174,7 +174,7 @@ class DashletView extends View {
Espo.Ui.notify(false);
this.listenToOnce(view, 'save', (attributes) => {
let id = this.id;
const id = this.id;
Espo.Ui.notify(this.translate('saving', 'messages'));
@@ -187,7 +187,7 @@ class DashletView extends View {
this.trigger('change');
});
let o = this.getPreferences().get('dashletsOptions') || {};
const o = this.getPreferences().get('dashletsOptions') || {};
o[id] = attributes;
+11 -11
View File
@@ -105,7 +105,7 @@ class EditView extends MainView {
* Set up a record.
*/
setupRecord() {
let o = {
const o = {
model: this.model,
fullSelector: '#main > .record',
scope: this.scope,
@@ -116,7 +116,7 @@ class EditView extends MainView {
o[option] = this.options[option];
});
let params = this.options.params || {};
const params = this.options.params || {};
if (params.rootUrl) {
o.rootUrl = params.rootUrl;
@@ -140,9 +140,9 @@ class EditView extends MainView {
/** @inheritDoc */
getHeader() {
let headerIconHtml = this.getHeaderIconHtml();
let rootUrl = this.options.rootUrl || this.options.params.rootUrl || '#' + this.scope;
let scopeLabel = this.getLanguage().translate(this.scope, 'scopeNamesPlural');
const headerIconHtml = this.getHeaderIconHtml();
const rootUrl = this.options.rootUrl || this.options.params.rootUrl || '#' + this.scope;
const scopeLabel = this.getLanguage().translate(this.scope, 'scopeNamesPlural');
let $root = $('<span>').text(scopeLabel);
@@ -163,17 +163,17 @@ class EditView extends MainView {
}
if (this.model.isNew()) {
let $create = $('<span>').text(this.getLanguage().translate('create'));
const $create = $('<span>').text(this.getLanguage().translate('create'));
return this.buildHeaderHtml([$root, $create]);
}
let name = this.model.get('name') || this.model.id;
const name = this.model.get('name') || this.model.id;
let $name = $('<span>').text(name);
if (!this.options.noHeaderLinks) {
let url = '#' + this.scope + '/view/' + this.model.id;
const url = '#' + this.scope + '/view/' + this.model.id;
$name =
$('<a>')
@@ -188,7 +188,7 @@ class EditView extends MainView {
/** @inheritDoc */
updatePageTitle() {
if (this.model.isNew()) {
let title = this.getLanguage().translate('Create') + ' ' +
const title = this.getLanguage().translate('Create') + ' ' +
this.getLanguage().translate(this.scope, 'scopeNames');
this.setPageTitle(title);
@@ -196,9 +196,9 @@ class EditView extends MainView {
return;
}
let name = this.model.get('name');
const name = this.model.get('name');
let title = name ? name : this.getLanguage().translate(this.scope, 'scopeNames');
const title = name ? name : this.getLanguage().translate(this.scope, 'scopeNames');
this.setPageTitle(title);
}
+7 -7
View File
@@ -35,7 +35,7 @@ class HeaderView extends View {
template = 'header'
data() {
let data = {};
const data = {};
if ('getHeader' in this.getParentMainView()) {
data.header = this.getParentMainView().getHeader();
@@ -44,7 +44,7 @@ class HeaderView extends View {
data.scope = this.scope || this.getParentMainView().scope;
data.items = this.getItems();
let dropdown = (data.items || {}).dropdown || [];
const dropdown = (data.items || {}).dropdown || [];
data.hasVisibleDropdownItems = false;
@@ -99,8 +99,8 @@ class HeaderView extends View {
this.fontSizePercentage = 100;
}
let $container = this.$el.find('.header-breadcrumbs');
let containerWidth = $container.width();
const $container = this.$el.find('.header-breadcrumbs');
const containerWidth = $container.width();
let childrenWidth = 0;
$container.children().each((i, el) => {
@@ -112,8 +112,8 @@ class HeaderView extends View {
$container.addClass('overlapped');
this.$el.find('.title').each((i, el) => {
let $el = $(el);
let text = $(el).text();
const $el = $(el);
const text = $(el).text();
$el.attr('title', text);
@@ -139,7 +139,7 @@ class HeaderView extends View {
this.fontSizePercentage -= 4;
let $flexible = this.$el.find('.font-size-flexible');
const $flexible = this.$el.find('.font-size-flexible');
$flexible.css('font-size', this.fontSizePercentage + '%');
$flexible.css('position', 'relative');
+1 -1
View File
@@ -33,7 +33,7 @@ class HomeView extends View {
template = 'home'
setup() {
let viewName = this.getMetadata().get(['clientDefs', 'Home', 'view']) ||
const viewName = this.getMetadata().get(['clientDefs', 'Home', 'view']) ||
'views/dashboard';
this.createView('content', viewName, {selector: '> .home-content'});
+27 -27
View File
@@ -266,7 +266,7 @@ class ListRelatedView extends MainView {
this.viewMode = this.viewMode || this.defaultViewMode;
let viewModeList = this.options.viewModeList ||
const viewModeList = this.options.viewModeList ||
this.viewModeList ||
this.getMetadata().get(['clientDefs', this.foreignScope, 'listRelatedViewModeList']);
@@ -275,10 +275,10 @@ class ListRelatedView extends MainView {
if (this.viewModeList.length > 1) {
let viewMode = null;
let modeKey = 'listRelatedViewMode' + this.scope + this.link;
const modeKey = 'listRelatedViewMode' + this.scope + this.link;
if (this.getStorage().has('state', modeKey)) {
let storedViewMode = this.getStorage().get('state', modeKey);
const storedViewMode = this.getStorage().get('state', modeKey);
if (storedViewMode && this.viewModeList.includes(storedViewMode)) {
viewMode = storedViewMode;
@@ -342,14 +342,14 @@ class ListRelatedView extends MainView {
if (this.panelDefs.filterList) {
this.panelDefs.filterList.forEach(item1 => {
let isFound = false;
let name1 = item1.name || item1;
const name1 = item1.name || item1;
if (!name1 || name1 === 'all') {
return;
}
filterList.forEach(item2 => {
let name2 = item2.name || item2;
const name2 = item2.name || item2;
if (name1 === name2) {
isFound = true;
@@ -408,7 +408,7 @@ class ListRelatedView extends MainView {
this.collection.maxSize = this.collectionMaxSize;
if (toStore) {
var modeKey = 'listViewMode' + this.scope + this.link;
const modeKey = 'listViewMode' + this.scope + this.link;
this.getStorage().set('state', modeKey, mode);
}
@@ -417,7 +417,7 @@ class ListRelatedView extends MainView {
this.getSearchView().setViewMode(mode);
}
let methodName = 'setViewMode' + Espo.Utils.upperCaseFirst(this.viewMode);
const methodName = 'setViewMode' + Espo.Utils.upperCaseFirst(this.viewMode);
if (this[methodName]) {
this[methodName]();
@@ -428,9 +428,9 @@ class ListRelatedView extends MainView {
* Set up a search manager.
*/
setupSearchManager() {
let collection = this.collection;
const collection = this.collection;
let searchManager = new SearchManager(
const searchManager = new SearchManager(
collection,
'list',
null,
@@ -478,7 +478,7 @@ class ListRelatedView extends MainView {
this.recordView;
}
let propertyName = 'record' + Espo.Utils.upperCaseFirst(this.viewMode) + 'View';
const propertyName = 'record' + Espo.Utils.upperCaseFirst(this.viewMode) + 'View';
return this.getMetadata().get(['clientDefs', this.foreignScope, 'recordViews', this.viewMode]) ||
this[propertyName];
@@ -554,7 +554,7 @@ class ListRelatedView extends MainView {
o.pagination = true;
}
let massUnlinkDisabled = this.panelDefs.massUnlinkDisabled ||
const massUnlinkDisabled = this.panelDefs.massUnlinkDisabled ||
this.panelDefs.unlinkDisabled || this.unlinkDisabled;
o = {
@@ -578,7 +578,7 @@ class ListRelatedView extends MainView {
this.prepareRecordViewOptions(o);
let listViewName = this.getRecordViewName();
const listViewName = this.getRecordViewName();
this.createView('list', listViewName, o, view =>{
if (!this.hasParentView()) {
@@ -618,14 +618,14 @@ class ListRelatedView extends MainView {
* @protected
*/
actionQuickCreate() {
let link = this.link;
let foreignScope = this.foreignScope;
let foreignLink = this.model.getLinkParam(link, 'foreign');
const link = this.link;
const foreignScope = this.foreignScope;
const foreignLink = this.model.getLinkParam(link, 'foreign');
let attributes = {};
let attributeMap = this.getMetadata()
.get(['clientDefs', this.scope, 'relationshipPanels', link, 'createAttributeMap']) || {};
const attributeMap = this.getMetadata()
.get(['clientDefs', this.scope, 'relationshipPanels', link, 'createAttributeMap']) || {};
Object.keys(attributeMap)
.forEach(attr => {
@@ -634,7 +634,7 @@ class ListRelatedView extends MainView {
Espo.Ui.notify(' ... ');
let handler = this.getMetadata()
const handler = this.getMetadata()
.get(['clientDefs', this.scope, 'relationshipPanels', link, 'createHandler']);
(new Promise(resolve => {
@@ -654,7 +654,7 @@ class ListRelatedView extends MainView {
.then(additionalAttributes => {
attributes = {...attributes, ...additionalAttributes};
let viewName = this.getMetadata()
const viewName = this.getMetadata()
.get(['clientDefs', foreignScope, 'modalViews', 'edit']) || 'views/modals/edit';
this.createView('quickCreate', viewName, {
@@ -685,7 +685,7 @@ class ListRelatedView extends MainView {
* @protected
*/
actionUnlinkRelated(data) {
let id = data.id;
const id = data.id;
this.confirm({
message: this.translate('unlinkRecordConfirmation', 'messages'),
@@ -710,11 +710,11 @@ class ListRelatedView extends MainView {
* @inheritDoc
*/
getHeader() {
let name = this.model.get('name') || this.model.id;
const name = this.model.get('name') || this.model.id;
let recordUrl = '#' + this.scope + '/view/' + this.model.id;
const recordUrl = '#' + this.scope + '/view/' + this.model.id;
let $name =
const $name =
$('<a>')
.attr('href', recordUrl)
.addClass('font-size-flexible title')
@@ -724,8 +724,8 @@ class ListRelatedView extends MainView {
$name.css('text-decoration', 'line-through');
}
let headerIconHtml = this.getHelper().getScopeColorIconHtml(this.foreignScope);
let scopeLabel = this.getLanguage().translate(this.scope, 'scopeNamesPlural');
const headerIconHtml = this.getHelper().getScopeColorIconHtml(this.foreignScope);
const scopeLabel = this.getLanguage().translate(this.scope, 'scopeNamesPlural');
let $root = $('<span>').text(scopeLabel);
@@ -744,7 +744,7 @@ class ListRelatedView extends MainView {
$root.prepend(headerIconHtml);
}
let $link = $('<span>').text(this.translate(this.link, 'links', this.scope));
const $link = $('<span>').text(this.translate(this.link, 'links', this.scope));
return this.buildHeaderHtml([
$root,
@@ -796,7 +796,7 @@ class ListRelatedView extends MainView {
return;
}
let $search = this.$el.find('input.text-filter').first();
const $search = this.$el.find('input.text-filter').first();
if (!$search.length) {
return;
+24 -24
View File
@@ -58,7 +58,7 @@ class ListWithCategories extends ListView {
nestedCategoriesCollection
data() {
let data = {};
const data = {};
data.hasTree = (this.isExpanded || this.hasNavigationPanel) && !this.categoriesDisabled;
data.hasNestedCategories = !this.isExpanded;
@@ -78,14 +78,14 @@ class ListWithCategories extends ListView {
this.getAcl().check(this.categoryScope, 'edit') ||
this.getAcl().check(this.categoryScope, 'create');
let isExpandedByDefault = this.getMetadata()
const isExpandedByDefault = this.getMetadata()
.get(['clientDefs', this.categoryScope, 'isExpandedByDefault']) || false;
if (isExpandedByDefault) {
this.isExpanded = true;
}
let isCollapsedByDefault = this.getMetadata()
const isCollapsedByDefault = this.getMetadata()
.get(['clientDefs', this.categoryScope, 'isCollapsedByDefault']) || false;
if (isCollapsedByDefault) {
@@ -119,7 +119,7 @@ class ListWithCategories extends ListView {
this.hasNavigationPanel = this.getNavigationPanelStoredValue();
}
let params = this.options.params || {};
const params = this.options.params || {};
if ('categoryId' in params) {
this.currentCategoryId = params.categoryId;
@@ -183,7 +183,7 @@ class ListWithCategories extends ListView {
}
getNavigationPanelStoredValue() {
let value = this.getStorage().get('state', 'categories-navigation-panel-' + this.scope);
const value = this.getStorage().get('state', 'categories-navigation-panel-' + this.scope);
return value === 'true' || value === true;
}
@@ -197,7 +197,7 @@ class ListWithCategories extends ListView {
}
getIsExpandedStoredValue() {
let value = this.getStorage().get('state', 'categories-expanded-' + this.scope);
const value = this.getStorage().get('state', 'categories-expanded-' + this.scope);
return value === 'true' || value === true ;
}
@@ -303,7 +303,7 @@ class ListWithCategories extends ListView {
}
selectCurrentCategory() {
let categoriesView = this.getCategoriesView();
const categoriesView = this.getCategoriesView();
if (categoriesView) {
categoriesView.setSelected(this.currentCategoryId);
@@ -538,7 +538,7 @@ class ListWithCategories extends ListView {
applyCategoryToCollection() {
this.collection.whereFunction = () => {
let filter;
let isExpanded = this.isExpanded;
const isExpanded = this.isExpanded;
if (!isExpanded && !this.hasTextFilter()) {
if (this.isCategoryMultiple()) {
@@ -598,14 +598,14 @@ class ListWithCategories extends ListView {
if (this.isCategoryMultiple()) {
if (this.currentCategoryId) {
let names = {};
const names = {};
names[this.currentCategoryId] = this.getCurrentCategoryName();
data = {};
let idsAttribute = this.categoryField + 'Ids';
let namesAttribute = this.categoryField + 'Names';
const idsAttribute = this.categoryField + 'Ids';
const namesAttribute = this.categoryField + 'Names';
data[idsAttribute] = [this.currentCategoryId];
data[namesAttribute] = names;
@@ -616,8 +616,8 @@ class ListWithCategories extends ListView {
return null;
}
let idAttribute = this.categoryField + 'Id';
let nameAttribute = this.categoryField + 'Name';
const idAttribute = this.categoryField + 'Id';
const nameAttribute = this.categoryField + 'Name';
data = {};
@@ -656,35 +656,35 @@ class ListWithCategories extends ListView {
return super.getHeader();
}
let path = this.nestedCategoriesCollection.path;
const path = this.nestedCategoriesCollection.path;
if (!path || path.length === 0) {
return super.getHeader();
}
let rootUrl = '#' + this.scope;
const rootUrl = '#' + this.scope;
let $root = $('<a>')
const $root = $('<a>')
.attr('href', rootUrl)
.addClass('action')
.text(this.translate(this.scope, 'scopeNamesPlural'))
.addClass('action')
.attr('data-action', 'openCategory');
let list = [$root];
const list = [$root];
let currentName = this.nestedCategoriesCollection.categoryData.name;
let upperId = this.nestedCategoriesCollection.categoryData.upperId;
let upperName = this.nestedCategoriesCollection.categoryData.upperName;
const currentName = this.nestedCategoriesCollection.categoryData.name;
const upperId = this.nestedCategoriesCollection.categoryData.upperId;
const upperName = this.nestedCategoriesCollection.categoryData.upperName;
if (path.length > 2) {
list.push('...');
}
if (upperId) {
let url = rootUrl + '/' + 'list/categoryId=' + this.escapeString(upperId);
const url = rootUrl + '/' + 'list/categoryId=' + this.escapeString(upperId);
let $folder = $('<a>')
const $folder = $('<a>')
.attr('href', url)
.text(upperName)
.addClass('action')
@@ -695,7 +695,7 @@ class ListWithCategories extends ListView {
list.push($folder);
}
let $last = $('<span>').text(currentName);
const $last = $('<span>').text(currentName);
list.push($last);
@@ -716,7 +716,7 @@ class ListWithCategories extends ListView {
// noinspection JSUnusedGlobalSymbols
actionToggleNavigationPanel() {
let value = !this.hasNavigationPanel;
const value = !this.hasNavigationPanel;
this.hasNavigationPanel = value;
+3 -3
View File
@@ -129,7 +129,7 @@ class ListView extends MainView {
keepCurrentRootUrl = false
/**
* A view mode. 'list', 'kanban`.
* A view mode. 'list', 'kanban'.
*
* @type {string}
*/
@@ -677,8 +677,9 @@ class ListView extends MainView {
getHeader() {
const $root = $('<span>')
.text(this.getLanguage().translate(this.scope, 'scopeNamesPlural'));
if (this.options.params && this.options.params.fromAdmin) {
let $root = $('<a>')
const $root = $('<a>')
.attr('href', '#Admin')
.text(this.translate('Administration', 'labels', 'Admin'));
@@ -688,7 +689,6 @@ class ListView extends MainView {
return this.buildHeaderHtml([$root, $scope]);
}
const headerIconHtml = this.getHeaderIconHtml();
if (headerIconHtml) {
+10 -10
View File
@@ -129,7 +129,7 @@ class LoginView extends View {
setup() {
this.anotherUser = this.options.anotherUser || null;
let loginData = this.getConfig().get('loginData') || {};
const loginData = this.getConfig().get('loginData') || {};
this.fallback = !!loginData.fallback;
this.method = loginData.method;
@@ -162,7 +162,7 @@ class LoginView extends View {
* @return {string}
*/
getLogoSrc() {
let companyLogoId = this.getConfig().get('companyLogoId');
const companyLogoId = this.getConfig().get('companyLogoId');
if (!companyLogoId) {
return this.getBasePath() +
@@ -208,9 +208,9 @@ class LoginView extends View {
login() {
let authString;
let userName = this.$username.val();
let password = this.$password.val();
const password = this.$password.val();
let trimmedUserName = userName.trim();
const trimmedUserName = userName.trim();
if (trimmedUserName !== userName) {
this.$username.val(trimmedUserName);
@@ -237,7 +237,7 @@ class LoginView extends View {
throw e;
}
let headers = {
const headers = {
'Authorization': 'Basic ' + authString,
'Espo-Authorization': authString,
};
@@ -254,7 +254,7 @@ class LoginView extends View {
proceed(headers, userName, password) {
headers = Espo.Utils.clone(headers);
let initialHeaders = Espo.Utils.clone(headers);
const initialHeaders = Espo.Utils.clone(headers);
headers['Espo-Authorization-By-Token'] = 'false';
headers['Espo-Authorization-Create-Token-Secret'] = 'true';
@@ -323,9 +323,9 @@ class LoginView extends View {
processEmptyUsername() {
this.isPopoverDestroyed = false;
let $el = this.$username;
const $el = this.$username;
let message = this.getLanguage().translate('userCantBeEmpty', 'messages', 'User');
const message = this.getLanguage().translate('userCantBeEmpty', 'messages', 'User');
$el
.popover({
@@ -336,7 +336,7 @@ class LoginView extends View {
})
.popover('show');
let $cell = $el.closest('.form-group');
const $cell = $el.closest('.form-group');
$cell.addClass('has-error');
@@ -373,7 +373,7 @@ class LoginView extends View {
* @param {Object.<string, *>} data
*/
onSecondStepRequired(headers, userName, password, data) {
let view = data.view || 'views/login-second-step';
const view = data.view || 'views/login-second-step';
this.trigger('redirect', view, headers, userName, password, data);
}
+8 -8
View File
@@ -44,8 +44,8 @@ class PopupNotificationView extends View {
init() {
super.init();
let id = this.options.id;
let containerSelector = this.containerSelector = '#' + id;
const id = this.options.id;
const containerSelector = this.containerSelector = '#' + id;
this.setSelector(containerSelector);
@@ -57,7 +57,7 @@ class PopupNotificationView extends View {
this.on('render', () => {
$(containerSelector).remove();
let className = 'popup-notification-' + Espo.Utils.toDom(this.type);
const className = 'popup-notification-' + Espo.Utils.toDom(this.type);
$('<div>')
.attr('id', id)
@@ -101,14 +101,14 @@ class PopupNotificationView extends View {
return;
}
let html =
const html =
'<audio autoplay="autoplay">' +
'<source src="' + this.soundPath + '.mp3" type="audio/mpeg" />' +
'<source src="' + this.soundPath + '.ogg" type="audio/ogg" />' +
'<embed hidden="true" autostart="true" loop="false" src="' + this.soundPath +'.mp3" />' +
'<source src="' + this.soundPath + '.mp3" type="audio/mpeg" />' +
'<source src="' + this.soundPath + '.ogg" type="audio/ogg" />' +
'<embed hidden="true" autostart="true" loop="false" src="' + this.soundPath + '.mp3" />' +
'</audio>';
let $audio = $(html);
const $audio = $(html);
$audio.get(0).volume = 0.3;
// noinspection JSUnresolvedReference
+4 -4
View File
@@ -45,7 +45,7 @@ class StreamView extends View {
},
/** @this StreamView */
'click button[data-action="selectFilter"]': function (e) {
let data = $(e.currentTarget).data();
const data = $(e.currentTarget).data();
this.actionSelectFilter(data);
},
@@ -115,8 +115,8 @@ class StreamView extends View {
}
actionSelectFilter(data) {
let name = data.name;
let filter = name;
const name = data.name;
const filter = name;
let internalFilter = name;
@@ -128,7 +128,7 @@ class StreamView extends View {
this.setFilter(this.filter);
this.filterList.forEach((item) => {
var $el = this.$el.find('.page-header button[data-action="selectFilter"][data-name="'+item+'"]');
const $el = this.$el.find('.page-header button[data-action="selectFilter"][data-name="' + item + '"]');
if (item === filter) {
$el.addClass('active');