ref
This commit is contained in:
@@ -100,6 +100,7 @@ class UserFieldView extends LinkFieldView {
|
||||
if (this.mode === this.MODE_SEARCH) {
|
||||
let $elementTeams = this.$el.find('input.element-teams');
|
||||
|
||||
|
||||
$elementTeams.autocomplete({
|
||||
serviceUrl: () => {
|
||||
return 'Team?&maxSize=' + this.getAutocompleteMaxCount() + '&select=id,name';
|
||||
@@ -109,6 +110,7 @@ class UserFieldView extends LinkFieldView {
|
||||
paramName: 'q',
|
||||
noCache: true,
|
||||
formatResult: suggestion => {
|
||||
// noinspection JSUnresolvedReference
|
||||
return this.getHelper().escapeString(suggestion.name);
|
||||
},
|
||||
transformResult: response => {
|
||||
@@ -126,7 +128,7 @@ class UserFieldView extends LinkFieldView {
|
||||
|
||||
return {suggestions: list};
|
||||
},
|
||||
onSelect: s => {
|
||||
onSelect: /** {id: string, name: string } */s => {
|
||||
this.addLinkTeams(s.id, s.name);
|
||||
|
||||
$elementTeams.val('');
|
||||
@@ -185,11 +187,11 @@ class UserFieldView extends LinkFieldView {
|
||||
}
|
||||
|
||||
addLinkTeamsHtml(id, name) {
|
||||
id = Handlebars.Utils.escapeExpression(id);
|
||||
name = Handlebars.Utils.escapeExpression(name);
|
||||
id = this.getHelper().escapeString(id);
|
||||
name = this.getHelper().escapeString(name);
|
||||
|
||||
let $container = this.$el.find('.link-teams-container');
|
||||
|
||||
|
||||
let $el = $('<div />')
|
||||
.addClass('link-' + id)
|
||||
.addClass('list-group-item');
|
||||
|
||||
@@ -26,28 +26,31 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
define('views/fields/users', ['views/fields/link-multiple'], function (Dep) {
|
||||
import LinkMultipleFieldView from 'views/fields/link-multiple';
|
||||
|
||||
return Dep.extend({
|
||||
class UsersFieldView extends LinkMultipleFieldView {
|
||||
|
||||
init: function () {
|
||||
this.assignmentPermission = this.getAcl().get('assignmentPermission');
|
||||
init() {
|
||||
this.assignmentPermission = this.getAcl().getPermissionLevel('assignmentPermission');
|
||||
|
||||
if (this.assignmentPermission === 'no') {
|
||||
this.readOnly = true;
|
||||
}
|
||||
if (this.assignmentPermission === 'no') {
|
||||
this.readOnly = true;
|
||||
}
|
||||
|
||||
Dep.prototype.init.call(this);
|
||||
},
|
||||
super.init();
|
||||
}
|
||||
|
||||
getSelectBoolFilterList() {
|
||||
if (this.assignmentPermission === 'team' || this.assignmentPermission === 'no') {
|
||||
return ['onlyMyTeam'];
|
||||
}
|
||||
}
|
||||
|
||||
getSelectPrimaryFilterName() {
|
||||
return 'active';
|
||||
}
|
||||
}
|
||||
|
||||
export default UsersFieldView;
|
||||
|
||||
getSelectBoolFilterList: function () {
|
||||
if (this.assignmentPermission === 'team' || this.assignmentPermission === 'no') {
|
||||
return ['onlyMyTeam'];
|
||||
}
|
||||
},
|
||||
|
||||
getSelectPrimaryFilterName: function () {
|
||||
return 'active';
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user