diff --git a/client/modules/crm/src/controllers/unsubscribe.js b/client/modules/crm/src/controllers/unsubscribe.js index 2afcf298b5..5ce6e52294 100644 --- a/client/modules/crm/src/controllers/unsubscribe.js +++ b/client/modules/crm/src/controllers/unsubscribe.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('crm:controllers/unsubscribe', 'controller', function (Dep) { +define('crm:controllers/unsubscribe', ['controller'], function (Dep) { return Dep.extend({ @@ -54,7 +54,6 @@ Espo.define('crm:controllers/unsubscribe', 'controller', function (Dep) { }, function (view) { view.render(); }); - } - + }, }); }); diff --git a/client/modules/crm/src/knowledge-base-helper.js b/client/modules/crm/src/knowledge-base-helper.js index 093221df4d..0615416a99 100644 --- a/client/modules/crm/src/knowledge-base-helper.js +++ b/client/modules/crm/src/knowledge-base-helper.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('crm:knowledge-base-helper', 'ajax', function (Ajax) { +define('crm:knowledge-base-helper', ['ajax'], function (Ajax) { var KnowledgeBaseHelper = function (language) { this.language = language; @@ -41,25 +41,27 @@ Espo.define('crm:knowledge-base-helper', 'ajax', function (Ajax) { getAttributesForEmail: function (model, attributes, callback) { attributes = attributes || {}; attributes.body = model.get('body'); + if (attributes.name) { attributes.name = attributes.name + ' '; } else { attributes.name = ''; } - attributes.name += this.getLanguage().translate('KnowledgeBaseArticle', 'scopeNames') + ': ' + model.get('name'); + + attributes.name += this.getLanguage().translate('KnowledgeBaseArticle', 'scopeNames') + ': ' + + model.get('name'); Ajax.postRequest('KnowledgeBaseArticle/action/getCopiedAttachments', { id: model.id - }).then(function (data) { + }).then((data) => { attributes.attachmentsIds = data.ids; attributes.attachmentsNames = data.names; attributes.isHtml = true; callback(attributes); - }.bind(this)); - } + }); + }, }); return KnowledgeBaseHelper; - }); diff --git a/client/modules/crm/src/views/contact/fields/accounts.js b/client/modules/crm/src/views/contact/fields/accounts.js index b90b863247..6d401a1604 100644 --- a/client/modules/crm/src/views/contact/fields/accounts.js +++ b/client/modules/crm/src/views/contact/fields/accounts.js @@ -34,12 +34,19 @@ Espo.define('crm:views/contact/fields/accounts', 'views/fields/link-multiple-wit events: { 'click [data-action="switchPrimary"]': function (e) { - $target = $(e.currentTarget); + let $target = $(e.currentTarget); var id = $target.data('id'); if (!$target.hasClass('active')) { - this.$el.find('button[data-action="switchPrimary"]').removeClass('active').children().addClass('text-muted'); - $target.addClass('active').children().removeClass('text-muted'); + this.$el.find('button[data-action="switchPrimary"]') + .removeClass('active') + .children() + .addClass('text-muted'); + + $target.addClass('active') + .children() + .removeClass('text-muted'); + this.setPrimaryId(id); } } @@ -47,9 +54,11 @@ Espo.define('crm:views/contact/fields/accounts', 'views/fields/link-multiple-wit getAttributeList: function () { var list = Dep.prototype.getAttributeList.call(this); + list.push('accountId'); list.push('accountName'); list.push('title'); + return list; }, @@ -68,7 +77,6 @@ Espo.define('crm:views/contact/fields/accounts', 'views/fields/link-multiple-wit this.primaryName = this.model.get(this.primaryNameFieldName); }, this); - if (this.mode === 'edit' || this.mode === 'detail') { this.events['click a[data-action="setPrimary"]'] = function (e) { var id = $(e.currentTarget).data('id'); @@ -111,6 +119,7 @@ Espo.define('crm:views/contact/fields/accounts', 'views/fields/link-multiple-wit names.push(this.getDetailLinkHtml(id)); } }, this); + return names.join(''); } }, @@ -207,8 +216,6 @@ Espo.define('crm:views/contact/fields/accounts', 'views/fields/link-multiple-wit } return data; - } - + }, }); - }); diff --git a/client/modules/crm/src/views/opportunity/fields/contacts.js b/client/modules/crm/src/views/opportunity/fields/contacts.js index 827386effe..e4ed131b2b 100644 --- a/client/modules/crm/src/views/opportunity/fields/contacts.js +++ b/client/modules/crm/src/views/opportunity/fields/contacts.js @@ -35,12 +35,21 @@ define( events: { 'click [data-action="switchPrimary"]': function (e) { - $target = $(e.currentTarget); + let $target = $(e.currentTarget); + var id = $target.data('id'); if (!$target.hasClass('active')) { - this.$el.find('button[data-action="switchPrimary"]').removeClass('active').children().addClass('text-muted'); - $target.addClass('active').children().removeClass('text-muted'); + this.$el.find('button[data-action="switchPrimary"]') + .removeClass('active') + .children() + .addClass('text-muted'); + + $target + .addClass('active') + .children() + .removeClass('text-muted'); + this.setPrimaryId(id); } } @@ -48,8 +57,10 @@ define( getAttributeList: function () { var list = Dep.prototype.getAttributeList.call(this); + list.push(this.primaryIdFieldName); list.push(this.primaryNameFieldName); + return list; }, @@ -138,7 +149,10 @@ define( var isPrimary = (id == this.primaryId); var iconHtml = ''; var title = this.translate('Primary'); - var $primary = $(''); + + var $primary = $(''); + $primary.insertAfter($el.children().first().children().first()); this.managePrimaryButton(); @@ -148,6 +162,7 @@ define( managePrimaryButton: function () { var $primary = this.$el.find('button[data-action="switchPrimary"]'); + if ($primary.length > 1) { $primary.removeClass('hidden'); } else { @@ -175,7 +190,9 @@ define( getSelectFilters: function () { if (this.model.get('accountId')) { var nameHash = {}; + nameHash[this.model.get('accountId')] = this.model.get('accountName'); + return { 'accounts': { type: 'linkedWith', @@ -197,6 +214,5 @@ define( } } }, - }); }); diff --git a/client/modules/crm/src/views/target/detail.js b/client/modules/crm/src/views/target/detail.js index 8bd9388a86..641dd9dfc7 100644 --- a/client/modules/crm/src/views/target/detail.js +++ b/client/modules/crm/src/views/target/detail.js @@ -24,9 +24,9 @@ * * In accordance with Section 7(b) of the GNU General Public License version 3, * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. - ************************************************************************/ + ************************************************************************/ -Espo.define('Crm:Views.Target.Detail', 'Views.Detail', function (Dep) { +define('crm:views/target/detail', ['views/detail'], function (Dep) { return Dep.extend({ @@ -50,4 +50,3 @@ Espo.define('Crm:Views.Target.Detail', 'Views.Detail', function (Dep) { }); }); - diff --git a/client/src/views/admin/entity-manager/index.js b/client/src/views/admin/entity-manager/index.js index 5c6cae3bab..9a1e3ec0eb 100644 --- a/client/src/views/admin/entity-manager/index.js +++ b/client/src/views/admin/entity-manager/index.js @@ -89,7 +89,7 @@ define('views/admin/entity-manager/index', 'view', function (Dep) { isRemovable = false; } - hasView = d.customizable; + let hasView = d.customizable; this.scopeDataList.push({ name: scope, diff --git a/client/src/views/dashlets/fields/records/expanded-layout.js b/client/src/views/dashlets/fields/records/expanded-layout.js index d6c1328602..5a0c8f61e8 100644 --- a/client/src/views/dashlets/fields/records/expanded-layout.js +++ b/client/src/views/dashlets/fields/records/expanded-layout.js @@ -68,7 +68,7 @@ Espo.define('views/dashlets/fields/records/expanded-layout', 'views/fields/base' this.$container.append($row); - $input = $row.find('input'); + let $input = $row.find('input'); $input.selectize({ options: fieldDataList, diff --git a/client/src/views/email-filter/fields/action.js b/client/src/views/email-filter/fields/action.js index 85f10c0139..44146d0e96 100644 --- a/client/src/views/email-filter/fields/action.js +++ b/client/src/views/email-filter/fields/action.js @@ -25,13 +25,16 @@ * In accordance with Section 7(b) of the GNU General Public License version 3, * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('views/email-filter/fields/action', 'views/fields/enum', function (Dep) { + +define('views/email-filter/fields/action', ['views/fields/enum'], function (Dep) { return Dep.extend({ setup: function () { Dep.prototype.setup.call(this); + this.controlActionOptions(); + this.listenTo(this.model, 'change:parentType', this.controlActionOptions, this); }, @@ -41,11 +44,10 @@ Espo.define('views/email-filter/fields/action', 'views/fields/enum', function (D } else { this.params.options = ['Skip']; } + if (this.isRendered()) { this.reRender(); } - } - + }, }); - }); diff --git a/client/src/views/fields/base.js b/client/src/views/fields/base.js index 9b34973e15..7de60cf194 100644 --- a/client/src/views/fields/base.js +++ b/client/src/views/fields/base.js @@ -802,7 +802,8 @@ define('views/fields/base', ['view'], function (Dep) { var $sign = $label.find('span.required-sign'); if ($label.length && !$sign.length) { - $text = $label.find('span.label-text'); + let $text = $label.find('span.label-text'); + $(' *').insertAfter($text); $sign = $label.find('span.required-sign'); } diff --git a/client/src/views/fields/link-multiple-with-columns.js b/client/src/views/fields/link-multiple-with-columns.js index 0ea7ea75e2..1fec9773b2 100644 --- a/client/src/views/fields/link-multiple-with-columns.js +++ b/client/src/views/fields/link-multiple-with-columns.js @@ -326,7 +326,7 @@ define('views/fields/link-multiple-with-columns', 'views/fields/link-multiple', } }, this); - $left = $('
| ').append($select);
$row.append($cell);
diff --git a/client/src/views/modals/password-change-request.js b/client/src/views/modals/password-change-request.js
index d8e62914b9..ad3afea824 100644
--- a/client/src/views/modals/password-change-request.js
+++ b/client/src/views/modals/password-change-request.js
@@ -130,7 +130,8 @@ define('views/modals/password-change-request', 'views/modal', function (Dep) {
if (!isValid) return;
- $submit = this.$el.find('button[data-name="submit"]');
+ let $submit = this.$el.find('button[data-name="submit"]');
+
$submit.addClass('disabled');
Espo.Ui.notify(this.translate('pleaseWait', 'messages'));
diff --git a/client/src/views/notification/badge.js b/client/src/views/notification/badge.js
index 176c3f3832..16adcd3b4f 100644
--- a/client/src/views/notification/badge.js
+++ b/client/src/views/notification/badge.js
@@ -445,7 +445,7 @@ define('views/notification/badge', 'view', function (Dep) {
});
});
- $document = $(document);
+ let $document = $(document);
$document.on('mouseup.notification', e => {
if (!$container.is(e.target) && $container.has(e.target).length === 0) {
diff --git a/client/src/views/record/detail.js b/client/src/views/record/detail.js
index be3605fa3f..1e2f4f5774 100644
--- a/client/src/views/record/detail.js
+++ b/client/src/views/record/detail.js
@@ -774,7 +774,7 @@ define('views/record/detail', ['views/record/base', 'view-record-helper'], funct
var $p = $('.popover');
$p.each(function (i, el) {
- $el = $(el);
+ let $el = $(el);
$el.css('top', ($el.position().top - blockHeight) + 'px');
});
}
@@ -787,7 +787,7 @@ define('views/record/detail', ['views/record/base', 'view-record-helper'], funct
var $p = $('.popover');
$p.each(function (i, el) {
- $el = $(el);
+ let $el = $(el);
$el.css('top', ($el.position().top + blockHeight) + 'px');
});
}
diff --git a/client/src/views/record/list.js b/client/src/views/record/list.js
index 689051b90e..f8a641e873 100644
--- a/client/src/views/record/list.js
+++ b/client/src/views/record/list.js
@@ -200,7 +200,7 @@ define(
},
'click .actions-menu a.mass-action': function (e) {
- $el = $(e.currentTarget);
+ let $el = $(e.currentTarget);
var action = $el.data('action');
diff --git a/client/src/views/role/record/table.js b/client/src/views/role/record/table.js
index aab5bfb37f..829602001a 100644
--- a/client/src/views/role/record/table.js
+++ b/client/src/views/role/record/table.js
@@ -121,7 +121,8 @@ define('views/role/record/table', 'view', function (Dep) {
$dropdowns.removeAttr('disabled');
$dropdowns.removeClass('hidden');
$dropdowns.each(function (i, select) {
- $select = $(select);
+ let $select = $(select);
+
if (this.lowestLevelByDefault) {
$select.find('option').last().prop('selected', true);
} else {
@@ -140,7 +141,9 @@ define('views/role/record/table', 'view', function (Dep) {
$select.find('option').first().prop('selected', true);
}
}
+
$select.trigger('change');
+
this.controlSelectColor($select);
}.bind(this));
} else {
diff --git a/client/src/views/site/navbar.js b/client/src/views/site/navbar.js
index d9b80b8255..a3dbd33cda 100644
--- a/client/src/views/site/navbar.js
+++ b/client/src/views/site/navbar.js
@@ -552,8 +552,8 @@ define('views/site/navbar', 'view', function (Dep) {
this.adjustBodyMinHeightMethodName = 'adjustBodyMinHeightHorizontal';
- $moreDd = $('#nav-more-tabs-dropdown');
- $moreLi = $moreDd.closest('li');
+ let $moreDd = $('#nav-more-tabs-dropdown');
+ let $moreLi = $moreDd.closest('li');
var updateWidth = () => {
var windowWidth = window.innerWidth;
diff --git a/client/src/views/stream/record/edit.js b/client/src/views/stream/record/edit.js
index 68c1e4cde7..40dc25f4e5 100644
--- a/client/src/views/stream/record/edit.js
+++ b/client/src/views/stream/record/edit.js
@@ -128,7 +128,7 @@ define('views/stream/record/edit', 'views/record/base', function (Dep) {
this.post();
}
else if (e.keyCode === 9) {
- $text = $(e.currentTarget);
+ let $text = $(e.currentTarget);
if ($text.val() === '') {
this.disablePostingMode();
@@ -301,4 +301,4 @@ define('views/stream/record/edit', 'views/record/base', function (Dep) {
},
});
-});
\ No newline at end of file
+});
diff --git a/client/src/views/user/fields/teams.js b/client/src/views/user/fields/teams.js
index cd380ed1f9..d083800a0b 100644
--- a/client/src/views/user/fields/teams.js
+++ b/client/src/views/user/fields/teams.js
@@ -96,10 +96,13 @@ define('views/user/fields/teams', 'views/fields/link-multiple-with-role', functi
if (role != '') {
role = this.getHelper().escapeString(role);
- roleHtml = ' ' + role + '';
+
+ roleHtml = ' ' + role +
+ '';
}
- var lineHtml = ' ' + '' + name + ' ' + roleHtml + ' ';
+ var lineHtml = '' + '' + name + ' ' +
+ roleHtml + ' ';
return lineHtml;
},
@@ -109,25 +112,33 @@ define('views/user/fields/teams', 'views/fields/link-multiple-with-role', functi
if (!roleList.length) {
return;
- };
+ }
+
if (roleList.length || roleValue) {
- $role = $(' |