quick view middle click
This commit is contained in:
@@ -30,8 +30,20 @@ define('crm:views/contact/fields/accounts', ['views/fields/link-multiple-with-co
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
events: {
|
||||
'click [data-action="switchPrimary"]': function (e) {
|
||||
getAttributeList: function () {
|
||||
var list = Dep.prototype.getAttributeList.call(this);
|
||||
|
||||
list.push('accountId');
|
||||
list.push('accountName');
|
||||
list.push('title');
|
||||
|
||||
return list;
|
||||
},
|
||||
|
||||
setup: function () {
|
||||
Dep.prototype.setup.call(this);
|
||||
|
||||
this.events['click [data-action="switchPrimary"]'] = e => {
|
||||
let $target = $(e.currentTarget);
|
||||
let id = $target.data('id');
|
||||
|
||||
@@ -47,21 +59,7 @@ define('crm:views/contact/fields/accounts', ['views/fields/link-multiple-with-co
|
||||
|
||||
this.setPrimaryId(id);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
getAttributeList: function () {
|
||||
var list = Dep.prototype.getAttributeList.call(this);
|
||||
|
||||
list.push('accountId');
|
||||
list.push('accountName');
|
||||
list.push('title');
|
||||
|
||||
return list;
|
||||
},
|
||||
|
||||
setup: function () {
|
||||
Dep.prototype.setup.call(this);
|
||||
};
|
||||
|
||||
this.primaryIdFieldName = 'accountId';
|
||||
this.primaryNameFieldName = 'accountName';
|
||||
|
||||
@@ -173,6 +173,7 @@ function (Dep, RegExpPattern) {
|
||||
.append(
|
||||
$('<a>')
|
||||
.attr('href', '#' + this.foreignScope + '/view/' + id)
|
||||
.attr('data-id', id)
|
||||
.text(name)
|
||||
);
|
||||
|
||||
|
||||
@@ -127,6 +127,7 @@ define('views/fields/link-multiple-with-role', ['views/fields/link-multiple'], f
|
||||
.append(
|
||||
$('<a>')
|
||||
.attr('href', '#' + this.foreignScope + '/view/' + id)
|
||||
.attr('data-id', id)
|
||||
.text(name)
|
||||
);
|
||||
|
||||
|
||||
@@ -189,6 +189,38 @@ define('views/fields/link-multiple', ['views/fields/base'], function (Dep) {
|
||||
*/
|
||||
iconHtml: '',
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
events: {
|
||||
/**
|
||||
* @param {JQueryMouseEventObject} e
|
||||
* @this module:views/fields/link-multiple.Class
|
||||
*/
|
||||
'auxclick a[href]:not([role="button"])': function (e) {
|
||||
if (!this.isReadMode()) {
|
||||
return;
|
||||
}
|
||||
|
||||
let isCombination = e.button === 1 && (e.ctrlKey || e.metaKey);
|
||||
|
||||
if (!isCombination) {
|
||||
return;
|
||||
}
|
||||
|
||||
let id = $(e.currentTarget).attr('data-id');
|
||||
|
||||
if (!id) {
|
||||
return;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
this.quickView(id);
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
@@ -664,6 +696,7 @@ define('views/fields/link-multiple', ['views/fields/base'], function (Dep) {
|
||||
|
||||
let $a = $('<a>')
|
||||
.attr('href', this.getUrl(id))
|
||||
.attr('data-id', id)
|
||||
.text(name);
|
||||
|
||||
if (iconHtml) {
|
||||
@@ -853,5 +886,39 @@ define('views/fields/link-multiple', ['views/fields/base'], function (Dep) {
|
||||
this.searchParams.typeFront ||
|
||||
this.searchParams.type || 'anyOf';
|
||||
},
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @param {string} id
|
||||
*/
|
||||
quickView: function (id) {
|
||||
let entityType = this.foreignScope;
|
||||
|
||||
if (!this.getAcl().checkScope(entityType, 'read')) {
|
||||
return;
|
||||
}
|
||||
|
||||
let viewName = this.getMetadata().get(['clientDefs', entityType, 'modalViews', 'detail']) ||
|
||||
'views/modals/detail';
|
||||
|
||||
Espo.Ui.notify(this.translate('loading', 'messages'));
|
||||
|
||||
let options = {
|
||||
scope: entityType,
|
||||
id: id,
|
||||
};
|
||||
|
||||
this.createView('dialog', viewName, options, view => {
|
||||
this.listenToOnce(view, 'after:render', () => {
|
||||
Espo.Ui.notify(false);
|
||||
});
|
||||
|
||||
view.render();
|
||||
|
||||
this.listenToOnce(view, 'remove', () => {
|
||||
this.clearView('dialog');
|
||||
});
|
||||
});
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -174,6 +174,32 @@ define('views/fields/link-parent', ['views/fields/base'], function (Dep) {
|
||||
*/
|
||||
initialSearchIsNotIdle: true,
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
events: {
|
||||
/**
|
||||
* @param {JQueryMouseEventObject} e
|
||||
* @this module:views/fields/link-parent.Class
|
||||
*/
|
||||
'auxclick a[href]:not([role="button"])': function (e) {
|
||||
if (!this.isReadMode()) {
|
||||
return;
|
||||
}
|
||||
|
||||
let isCombination = e.button === 1 && (e.ctrlKey || e.metaKey);
|
||||
|
||||
if (!isCombination) {
|
||||
return;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
this.quickView();
|
||||
},
|
||||
},
|
||||
|
||||
data: function () {
|
||||
var nameValue = this.model.get(this.nameName);
|
||||
|
||||
@@ -684,5 +710,43 @@ define('views/fields/link-parent', ['views/fields/base'], function (Dep) {
|
||||
getSearchType: function () {
|
||||
return this.getSearchParamsData().type || this.searchParams.typeFront;
|
||||
},
|
||||
|
||||
/**
|
||||
* @protected
|
||||
*/
|
||||
quickView: function () {
|
||||
let id = this.model.get(this.idName);
|
||||
let entityType = this.model.get(this.typeName);
|
||||
|
||||
if (!id || !entityType) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.getAcl().checkScope(entityType, 'read')) {
|
||||
return;
|
||||
}
|
||||
|
||||
let viewName = this.getMetadata().get(['clientDefs', entityType, 'modalViews', 'detail']) ||
|
||||
'views/modals/detail';
|
||||
|
||||
Espo.Ui.notify(this.translate('loading', 'messages'));
|
||||
|
||||
let options = {
|
||||
scope: entityType,
|
||||
id: id,
|
||||
};
|
||||
|
||||
this.createView('dialog', viewName, options, view => {
|
||||
this.listenToOnce(view, 'after:render', () => {
|
||||
Espo.Ui.notify(false);
|
||||
});
|
||||
|
||||
view.render();
|
||||
|
||||
this.listenToOnce(view, 'remove', () => {
|
||||
this.clearView('dialog');
|
||||
});
|
||||
});
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -169,6 +169,32 @@ define('views/fields/link', ['views/fields/base'], function (Dep) {
|
||||
*/
|
||||
mandatorySelectAttributeList: null,
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
events: {
|
||||
/**
|
||||
* @param {JQueryMouseEventObject} e
|
||||
* @this module:views/fields/link.Class
|
||||
*/
|
||||
'auxclick a[href]:not([role="button"])': function (e) {
|
||||
if (!this.isReadMode()) {
|
||||
return;
|
||||
}
|
||||
|
||||
let isCombination = e.button === 1 && (e.ctrlKey || e.metaKey);
|
||||
|
||||
if (!isCombination) {
|
||||
return;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
this.quickView();
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
@@ -939,5 +965,44 @@ define('views/fields/link', ['views/fields/base'], function (Dep) {
|
||||
this.searchParams.typeFront ||
|
||||
this.searchParams.type;
|
||||
},
|
||||
|
||||
/**
|
||||
* @protected
|
||||
*/
|
||||
quickView: function () {
|
||||
let id = this.model.get(this.idName);
|
||||
|
||||
if (!id) {
|
||||
return;
|
||||
}
|
||||
|
||||
let entityType = this.foreignScope;
|
||||
|
||||
if (!this.getAcl().checkScope(entityType, 'read')) {
|
||||
return;
|
||||
}
|
||||
|
||||
let viewName = this.getMetadata().get(['clientDefs', entityType, 'modalViews', 'detail']) ||
|
||||
'views/modals/detail';
|
||||
|
||||
Espo.Ui.notify(this.translate('loading', 'messages'));
|
||||
|
||||
let options = {
|
||||
scope: entityType,
|
||||
id: id,
|
||||
};
|
||||
|
||||
this.createView('dialog', viewName, options, view => {
|
||||
this.listenToOnce(view, 'after:render', () => {
|
||||
Espo.Ui.notify(false);
|
||||
});
|
||||
|
||||
view.render();
|
||||
|
||||
this.listenToOnce(view, 'remove', () => {
|
||||
this.clearView('dialog');
|
||||
});
|
||||
});
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -104,6 +104,7 @@ define('views/user/fields/teams', ['views/fields/link-multiple-with-role'], func
|
||||
.append(
|
||||
$('<a>')
|
||||
.attr('href', '#' + this.foreignScope + '/view/' + id)
|
||||
.attr('data-id', id)
|
||||
.text(name)
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user