This commit is contained in:
Yuri Kuznetsov
2022-08-20 18:03:27 +03:00
parent ca89fd021d
commit 33cac3a551
23 changed files with 98 additions and 113 deletions
+3 -4
View File
@@ -26,17 +26,16 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/fields/currency-list', 'views/fields/enum', function (Dep) {
define('views/fields/currency-list', ['views/fields/enum'], function (Dep) {
return Dep.extend({
setupOptions: function () {
this.params.options = [];
(this.getConfig().get('currencyList') || []).forEach(function (item) {
(this.getConfig().get('currencyList') || []).forEach(item => {
this.params.options.push(item);
}, this);
});
},
});
});
+2 -3
View File
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/global-search/name-field', 'views/fields/base', function (Dep) {
define('views/global-search/name-field', ['views/fields/base'], function (Dep) {
return Dep.extend({
@@ -39,7 +39,6 @@ Espo.define('views/global-search/name-field', 'views/fields/base', function (Dep
id: this.model.id,
iconHtml: this.getHelper().getScopeColorIconHtml(this.model.get('_scope'))
};
}
},
});
});
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/global-search/scope-badge', 'view', function (Dep) {
define('views/global-search/scope-badge', ['view'], function (Dep) {
return Dep.extend({
@@ -34,11 +34,8 @@ Espo.define('views/global-search/scope-badge', 'view', function (Dep) {
data: function () {
return {
label: this.translate(this.model.get('_scope'), 'scopeNames')
label: this.translate(this.model.get('_scope'), 'scopeNames'),
};
},
});
});
+10 -11
View File
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/modals/image-crop', ['views/modal', 'lib!Cropper'], function (Dep, Cropper) {
define('views/modals/image-crop', ['views/modal', 'lib!Cropper'], function (Dep, Cropper) {
return Dep.extend({
@@ -48,24 +48,26 @@ Espo.define('views/modals/image-crop', ['views/modal', 'lib!Cropper'], function
{
name: 'crop',
label: 'Submit',
style: 'primary'
style: 'primary',
},
{
name: 'cancel',
label: 'Cancel'
}
label: 'Cancel',
},
];
this.on('remove', function () {
this.on('remove', () => {
if (this.$img.length) {
this.$img.cropper('destroy');
this.$img.parent().empty();
}
}, this);
});
},
afterRender: function () {
var $img = this.$img = $('<img>').attr('src', this.options.contents).addClass('hidden');
var $img = this.$img = $('<img>')
.attr('src', this.options.contents)
.addClass('hidden');
this.$el.find('.image-container').append($img);
@@ -77,15 +79,12 @@ Espo.define('views/modals/image-crop', ['views/modal', 'lib!Cropper'], function
rotatable: false,
});
}, 50);
},
actionCrop: function () {
var dataUrl = this.$img.cropper('getDataURL', 'image/jpeg');
this.trigger('crop', dataUrl);
this.close();
}
},
});
});
+5 -9
View File
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/note/record/edit', 'views/record/edit', function (Dep) {
define('views/note/record/edit', ['views/record/edit'], function (Dep) {
return Dep.extend({
@@ -38,9 +38,10 @@ Espo.define('views/note/record/edit', 'views/record/edit', function (Dep) {
Dep.prototype.setup.call(this);
this.controlRequiredFields();
this.listenTo(this.model, 'change:attachmentsIds', function () {
this.listenTo(this.model, 'change:attachmentsIds', () => {
this.controlRequiredFields();
}, this);
});
},
controlRequiredFields: function () {
@@ -53,11 +54,6 @@ Espo.define('views/note/record/edit', 'views/record/edit', function (Dep) {
afterRender: function () {
Dep.prototype.afterRender.call(this);
}
},
});
});
+3 -4
View File
@@ -25,12 +25,11 @@
* 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/role/list', 'views/list', function (Dep) {
define('views/role/list', ['views/list'], function (Dep) {
return Dep.extend({
searchPanel: false
searchPanel: false,
});
});
+2 -5
View File
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/role/record/detail-side', 'views/record/detail-side', function (Dep) {
define('views/role/record/detail-side', ['views/record/detail-side'], function (Dep) {
return Dep.extend({
@@ -34,11 +34,8 @@ Espo.define('views/role/record/detail-side', 'views/record/detail-side', functio
{
name: 'default',
label: false,
view: 'views/role/record/panels/side'
view: 'views/role/record/panels/side',
}
],
});
});
+2 -1
View File
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/role/record/detail', 'views/record/detail', function (Dep) {
define('views/role/record/detail', ['views/record/detail'], function (Dep) {
return Dep.extend({
@@ -42,6 +42,7 @@ Espo.define('views/role/record/detail', 'views/record/detail', function (Dep) {
setup: function () {
Dep.prototype.setup.call(this);
this.createView('extra', this.tableView, {
el: this.options.el + ' .extra',
model: this.model
+15 -13
View File
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/role/record/edit', 'views/record/edit', function (Dep) {
define('views/role/record/edit', ['views/record/edit'], function (Dep) {
return Dep.extend({
@@ -49,20 +49,25 @@ Espo.define('views/role/record/edit', 'views/record/edit', function (Dep) {
for (var i in scopeList) {
var scope = scopeList[i];
if (this.$el.find('select[name="' + scope + '"]').val() == 'not-set') {
if (this.$el.find('select[name="' + scope + '"]').val() === 'not-set') {
continue;
}
if (this.$el.find('select[name="' + scope + '"]').val() == 'disabled') {
if (this.$el.find('select[name="' + scope + '"]').val() === 'disabled') {
data['data'][scope] = false;
} else {
var o = true;
if (aclTypeMap[scope] != 'boolean') {
if (aclTypeMap[scope] !== 'boolean') {
o = {};
for (var j in actionList) {
var action = actionList[j];
o[action] = this.$el.find('select[name="' + scope + '-' + action + '"]').val();
}
}
data['data'][scope] = o;
}
}
@@ -97,16 +102,13 @@ Espo.define('views/role/record/edit', 'views/record/edit', function (Dep) {
this.createView('extra', this.tableView, {
mode: 'edit',
el: this.options.el + ' .extra',
model: this.model
}, function (view) {
this.listenTo(view, 'change', function () {
model: this.model,
}, (view) => {
this.listenTo(view, 'change', () => {
var data = this.fetch();
this.model.set(data);
}, this);
}, this);
}
});
});
},
});
});
+1 -1
View File
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('views/role/record/list', 'views/record/list', function (Dep) {
define('views/role/record/list', ['views/record/list'], function (Dep) {
return Dep.extend({
+1 -1
View File
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/role/record/panels/side', 'views/record/panels/side', function (Dep) {
define('views/role/record/panels/side', ['views/record/panels/side'], function (Dep) {
return Dep.extend({
@@ -25,19 +25,23 @@
* 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/preferences/fields/auto-follow-entity-type-list', 'views/fields/multi-enum', function (Dep) {
define('views/preferences/fields/auto-follow-entity-type-list', ['views/fields/multi-enum'], function (Dep) {
return Dep.extend({
setup: function () {
this.params.options = Object.keys(this.getMetadata().get('scopes')).filter(function (scope) {
return this.getMetadata().get('scopes.' + scope + '.entity') && this.getMetadata().get('scopes.' + scope + '.stream');
}, this).sort(function (v1, v2) {
return this.translate(v1, 'scopeNamesPlural').localeCompare(this.translate(v2, 'scopeNamesPlural'));
}.bind(this));
this.params.options = Object.keys(this.getMetadata().get('scopes'))
.filter(scope => {
return this.getMetadata().get('scopes.' + scope + '.entity') &&
this.getMetadata().get('scopes.' + scope + '.stream');
})
.sort((v1, v2) => {
return this.translate(v1, 'scopeNamesPlural')
.localeCompare(this.translate(v2, 'scopeNamesPlural'));
});
Dep.prototype.setup.call(this);
},
});
});
+5 -7
View File
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/user/fields/contact', 'views/fields/link', function (Dep) {
define('views/user/fields/contact', ['views/fields/link'], function (Dep) {
return Dep.extend({
@@ -37,10 +37,10 @@ Espo.define('views/user/fields/contact', 'views/fields/link', function (Dep) {
if (model.get('accountId')) {
var names = {};
names[model.get('accountId')] = model.get('accountName');
attributes.accountsIds = [model.get('accountId')],
attributes.accountsNames = names;
names[model.get('accountId')] = model.get('accountName');
attributes.accountsIds = [model.get('accountId')];
attributes.accountsNames = names;
}
attributes.firstName = model.get('firstName');
@@ -58,8 +58,6 @@ Espo.define('views/user/fields/contact', 'views/fields/link', function (Dep) {
}
this.model.set(attributes);
}
},
});
});
+2 -4
View File
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/user/list', 'views/list', function (Dep) {
define('views/user/list', ['views/list'], function (Dep) {
return Dep.extend({
@@ -34,8 +34,6 @@ Espo.define('views/user/list', 'views/list', function (Dep) {
setup: function () {
Dep.prototype.setup.call(this);
}
},
});
});
+3 -3
View File
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/user/modals/detail', 'views/modals/detail', function (Dep) {
define('views/user/modals/detail', ['views/modals/detail'], function (Dep) {
return Dep.extend({
@@ -34,8 +34,8 @@ Espo.define('views/user/modals/detail', 'views/modals/detail', function (Dep) {
if (this.model.isPortal()) {
return 'PortalUser';
}
return 'User';
}
return 'User';
},
});
});
@@ -26,15 +26,13 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/user/record/detail-quick-side', ['views/record/detail-side', 'views/user/record/detail-side'], function (Dep, UserDetailSide) {
define('views/user/record/detail-quick-side',
['views/record/detail-side', 'views/user/record/detail-side'], function (Dep, UserDetailSide) {
return Dep.extend({
setupPanels: function () {
UserDetailSide.prototype.setupPanels.call(this);
}
},
});
});
+3 -4
View File
@@ -26,7 +26,8 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/user/record/detail-quick', ['views/record/detail-small', 'views/user/record/detail'], function (Dep, Detail) {
define('views/user/record/detail-quick',
['views/record/detail-small', 'views/user/record/detail'], function (Dep, Detail) {
return Dep.extend({
@@ -44,8 +45,6 @@ Espo.define('views/user/record/detail-quick', ['views/record/detail-small', 'vie
controlFieldAppearance: function () {
Detail.prototype.controlFieldAppearance.call(this);
}
},
});
});
+2 -3
View File
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/user/record/edit-quick', ['views/record/edit-small', 'views/user/record/detail'], function (Dep, Detail) {
define('views/user/record/edit-quick', ['views/record/edit-small', 'views/user/record/detail'], function (Dep, Detail) {
return Dep.extend({
@@ -40,7 +40,6 @@ Espo.define('views/user/record/edit-quick', ['views/record/edit-small', 'views/u
controlFieldAppearance: function () {
Detail.prototype.controlFieldAppearance.call(this);
}
},
});
});
+1 -2
View File
@@ -26,11 +26,10 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/user/record/edit-side', 'views/record/edit-side', function (Dep) {
define('views/user/record/edit-side', ['views/record/edit-side'], function (Dep) {
return Dep.extend({
});
});
+5 -4
View File
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/user/record/list', 'views/record/list', function (Dep) {
define('views/user/record/list', ['views/record/list'], function (Dep) {
return Dep.extend({
@@ -47,9 +47,11 @@ Espo.define('views/user/record/list', 'views/record/list', function (Dep) {
this.layoutName = 'listApi';
}
if (this.scope === 'PortalUser') {
this.layoutName = 'listPortal';
}
if (!this.getUser().isAdmin()) {
this.removeMassAction('massUpdate');
this.removeMassAction('export');
@@ -62,9 +64,8 @@ Espo.define('views/user/record/list', 'views/record/list', function (Dep) {
if (model.isPortal()) {
return 'PortalUser';
}
return this.scope;
}
},
});
});
@@ -26,15 +26,13 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/user/record/panels/default-side', 'views/record/panels/default-side', function (Dep) {
define('views/user/record/panels/default-side', ['views/record/panels/default-side'], function (Dep) {
return Dep.extend({
complexCreatedDisabled: true,
complexModifiedDisabled: true
complexModifiedDisabled: true,
});
});
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/user/record/panels/stream', 'views/stream/panel', function (Dep) {
define('views/user/record/panels/stream', ['views/stream/panel'], function (Dep) {
return Dep.extend({
@@ -35,10 +35,11 @@ Espo.define('views/user/record/panels/stream', 'views/stream/panel', function (D
var assignmentPermission = this.getAcl().checkAssignmentPermission(this.model);
if (this.model.id == this.getUser().id) {
if (this.model.id === this.getUser().id) {
this.placeholderText = this.translate('writeMessageToSelf', 'messages');
} else {
this.placeholderText = this.translate('writeMessageToUser', 'messages').replace('{user}', this.model.get('name'));
this.placeholderText = this.translate('writeMessageToUser', 'messages')
.replace('{user}', this.model.get('name'));
}
if (!assignmentPermission) {
@@ -46,13 +47,14 @@ Espo.define('views/user/record/panels/stream', 'views/stream/panel', function (D
if (this.getAcl().get('assignmentPermission') === 'team') {
if (!this.model.has('teamsIds')) {
this.listenToOnce(this.model, 'sync', function () {
this.listenToOnce(this.model, 'sync', () => {
assignmentPermission = this.getAcl().checkUserPermission(this.model);
if (assignmentPermission) {
this.postDisabled = false;
this.$el.find('.post-container').removeClass('hidden');;
}
}, this);
});
}
}
}
@@ -61,14 +63,12 @@ Espo.define('views/user/record/panels/stream', 'views/stream/panel', function (D
prepareNoteForPost: function (model) {
var userIdList = [this.model.id];
var userNames = {};
userNames[userIdList] = this.model.get('name');
model.set('usersIds', userIdList);
model.set('usersNames', userNames);
model.set('targetType', 'users');
}
},
});
});
@@ -26,12 +26,13 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/user/record/row-actions/default', 'views/record/row-actions/default', function (Dep) {
define('views/user/record/row-actions/default', ['views/record/row-actions/default'], function (Dep) {
return Dep.extend({
getActionList: function () {
var scope = 'User';
if (this.model.isPortal()) {
scope = 'PortalUser';
} else if (this.model.isApi()) {
@@ -47,6 +48,7 @@ Espo.define('views/user/record/row-actions/default', 'views/record/row-actions/d
},
link: '#' + scope + '/view/' + this.model.id
}];
if (this.options.acl.edit) {
list.push({
action: 'quickEdit',
@@ -58,8 +60,8 @@ Espo.define('views/user/record/row-actions/default', 'views/record/row-actions/d
link: '#' + scope + '/edit/' + this.model.id
});
}
return list;
}
});
return list;
},
});
});