returnDispatchParams

This commit is contained in:
yuri
2015-09-01 16:30:41 +03:00
parent 5f9b4d99f3
commit dcce3335cd
5 changed files with 24 additions and 3 deletions
+2 -2
View File
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'),
};
+1 -1
View File
@@ -33,7 +33,7 @@ Espo.define('views/edit', 'views/main', function (Dep) {
menu: null,
optionsToPass: ['returnUrl', 'attributes'],
optionsToPass: ['returnUrl', 'returnDispatchParams', 'attributes'],
views: {
header: {
+7
View File
@@ -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});
},