Change to navigate by location change

This commit is contained in:
Henry
2015-11-16 17:45:31 -08:00
parent d961b41253
commit cd3bdf4f81
5 changed files with 65 additions and 27 deletions

View File

@@ -78,7 +78,7 @@
"implementation": "actions/CancelAction.js",
"name": "Cancel",
"description": "Discard changes made to these objects.",
"depends": ["$injector", "navigationService"]
"depends": ["$location", "urlService"]
}
],
"policies": [

View File

@@ -33,10 +33,10 @@ define(
* @memberof platform/commonUI/edit
* @implements {Action}
*/
function CancelAction($injector, navigationService, context) {
function CancelAction($location, urlService, context) {
this.domainObject = context.domainObject;
this.navigationService = navigationService;
this.objectService = $injector.get('objectService');
this.$location = $location;
this.urlService = urlService;
}
/**
@@ -47,7 +47,8 @@ define(
*/
CancelAction.prototype.perform = function () {
var domainObject = this.domainObject,
self = this;
$location = this.$location,
urlService = this.urlService;
// Look up the object's "editor.completion" capability;
// this is introduced by EditableDomainObject which is
@@ -63,10 +64,13 @@ define(
return editor.cancel();
}
//Discard current 'editable' object, and retrieve original
// un-edited object.
// Discard the current root view (which will be the editing
// UI, which will have been pushed atop the Browise UI.)
function returnToBrowse() {
return self.navigationService.setNavigation(self.domainObject.getOriginalObject());
$location.path(urlService.urlForLocation(
"browse",
domainObject.getOriginalObject()
));
}
return doCancel(getEditorCapability())