returnDispatchParams
This commit is contained in:
Vendored
+2
-2
File diff suppressed because one or more lines are too long
@@ -136,6 +136,7 @@ Espo.define('controllers/record', 'controller', function (Dep) {
|
||||
scope: this.name,
|
||||
model: model,
|
||||
returnUrl: options.returnUrl,
|
||||
returnDispatchParams: options.returnDispatchParams,
|
||||
views: this.getViews('edit'),
|
||||
};
|
||||
|
||||
@@ -163,6 +164,7 @@ Espo.define('controllers/record', 'controller', function (Dep) {
|
||||
scope: this.name,
|
||||
model: model,
|
||||
returnUrl: options.returnUrl,
|
||||
returnDispatchParams: options.returnDispatchParams,
|
||||
views: this.getViews('edit'),
|
||||
};
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ Espo.define('views/edit', 'views/main', function (Dep) {
|
||||
|
||||
menu: null,
|
||||
|
||||
optionsToPass: ['returnUrl', 'attributes'],
|
||||
optionsToPass: ['returnUrl', 'returnDispatchParams', 'attributes'],
|
||||
|
||||
views: {
|
||||
header: {
|
||||
|
||||
@@ -176,6 +176,13 @@ Espo.define('Views.Modals.Edit', 'Views.Modal', function (Dep) {
|
||||
router.dispatch(this.scope, 'edit', {
|
||||
attributes: attributes,
|
||||
returnUrl: Backbone.history.fragment,
|
||||
returnDispatchParams: {
|
||||
controller: this.scope,
|
||||
action: null,
|
||||
options: {
|
||||
isReturn: true
|
||||
}
|
||||
},
|
||||
id: this.id
|
||||
});
|
||||
router.navigate(url, {trigger: false});
|
||||
|
||||
@@ -80,6 +80,8 @@ Espo.define('Views.Record.Detail', 'Views.Record.Base', function (Dep) {
|
||||
|
||||
returnUrl: null,
|
||||
|
||||
returnDispatchParams: null,
|
||||
|
||||
sideView: 'Record.DetailSide',
|
||||
|
||||
bottomView: 'Record.DetailBottom',
|
||||
@@ -348,6 +350,8 @@ Espo.define('Views.Record.Detail', 'Views.Record.Base', function (Dep) {
|
||||
this.dropdownEditItemList = _.clone(this.dropdownEditItemList);
|
||||
|
||||
this.returnUrl = this.options.returnUrl || this.returnUrl;
|
||||
this.returnDispatchParams = this.options.returnDispatchParams || this.returnDispatchParams;
|
||||
|
||||
this.exit = this.options.exit || this.exit;
|
||||
this.columnCount = this.options.columnCount || this.columnCount;
|
||||
|
||||
@@ -680,6 +684,14 @@ Espo.define('Views.Record.Detail', 'Views.Record.Base', function (Dep) {
|
||||
url += '/view/' + this.model.id;
|
||||
}
|
||||
}
|
||||
if (this.returnDispatchParams) {
|
||||
var controller = this.returnDispatchParams.controller;
|
||||
var action = this.returnDispatchParams.action;
|
||||
var options = this.returnDispatchParams.options || {};
|
||||
this.getRouter().dispatch(controller, action, options);
|
||||
this.getRouter().navigate(url, {trigger: false});
|
||||
return;
|
||||
}
|
||||
this.getRouter().navigate(url, {trigger: true});
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user