diff --git a/platform/commonUI/edit/bundle.json b/platform/commonUI/edit/bundle.json index b512065c77..2c5aec2e06 100644 --- a/platform/commonUI/edit/bundle.json +++ b/platform/commonUI/edit/bundle.json @@ -67,7 +67,7 @@ "implementation": "actions/SaveAction.js", "name": "Save", "description": "Save changes made to these objects.", - "depends": [ "$location", "urlService", "navigationService" ], + "depends": [ "$location", "urlService" ], "priority": "mandatory" }, { @@ -76,7 +76,7 @@ "implementation": "actions/CancelAction.js", "name": "Cancel", "description": "Discard changes made to these objects.", - "depends": [ "$log", "$location", "urlService", "navigationService" ] + "depends": [ "$location", "urlService" ] } ], "policies": [ diff --git a/platform/commonUI/edit/src/actions/CancelAction.js b/platform/commonUI/edit/src/actions/CancelAction.js index 799c837679..2b117b5f6d 100644 --- a/platform/commonUI/edit/src/actions/CancelAction.js +++ b/platform/commonUI/edit/src/actions/CancelAction.js @@ -30,7 +30,7 @@ define( * Edit Mode. Exits the editing user interface and invokes object * capabilities to persist the changes that have been made. */ - function CancelAction($log, $location, urlService, navigationService, context) { + function CancelAction($location, urlService, context) { var domainObject = context.domainObject; // Look up the object's "editor.completion" capability; @@ -50,7 +50,7 @@ define( // Discard the current root view (which will be the editing // UI, which will have been pushed atop the Browise UI.) function returnToBrowse() { - var urlBrowse = $location.path(urlService.urlForNewTab( + var urlBrowse = $location.path(urlService.urlForLocation( "browse", domainObject )); diff --git a/platform/commonUI/edit/src/actions/SaveAction.js b/platform/commonUI/edit/src/actions/SaveAction.js index 036eeb9f56..d5db593742 100644 --- a/platform/commonUI/edit/src/actions/SaveAction.js +++ b/platform/commonUI/edit/src/actions/SaveAction.js @@ -31,7 +31,7 @@ define( * Edit Mode. Exits the editing user interface and invokes object * capabilities to persist the changes that have been made. */ - function SaveAction($location, urlService, navigationService, context) { + function SaveAction($location, urlService, context) { var domainObject = context.domainObject; // Invoke any save behavior introduced by the editor capability; @@ -45,7 +45,10 @@ define( // Discard the current root view (which will be the editing // UI, which will have been pushed atop the Browise UI.) function returnToBrowse() { - return $location.path(urlService.urlForNewTab("browse", domainObject)); + return $location.path(urlService.urlForLocation( + "browse", + domainObject + )); } return { diff --git a/platform/commonUI/edit/test/actions/CancelActionSpec.js b/platform/commonUI/edit/test/actions/CancelActionSpec.js index b0c4db6678..1701347165 100644 --- a/platform/commonUI/edit/test/actions/CancelActionSpec.js +++ b/platform/commonUI/edit/test/actions/CancelActionSpec.js @@ -30,6 +30,7 @@ define( var mockLocation, mockDomainObject, mockEditorCapability, + mockUrlService, actionContext, action; @@ -54,7 +55,10 @@ define( "editor", [ "save", "cancel" ] ); - + mockUrlService = jasmine.createSpyObj( + "urlService", + ["urlForLocation"] + ); actionContext = { domainObject: mockDomainObject @@ -64,7 +68,7 @@ define( mockDomainObject.getCapability.andReturn(mockEditorCapability); mockEditorCapability.cancel.andReturn(mockPromise(true)); - action = new CancelAction(mockLocation, actionContext); + action = new CancelAction(mockLocation, mockUrlService, actionContext); }); @@ -91,7 +95,9 @@ define( it("returns to browse when performed", function () { action.perform(); - expect(mockLocation.path).toHaveBeenCalledWith("/browse"); + expect(mockLocation.path).toHaveBeenCalledWith( + mockUrlService.urlForLocation("browse", mockDomainObject) + ); }); }); } diff --git a/platform/commonUI/edit/test/actions/SaveActionSpec.js b/platform/commonUI/edit/test/actions/SaveActionSpec.js index 45901b3f08..74a0923411 100644 --- a/platform/commonUI/edit/test/actions/SaveActionSpec.js +++ b/platform/commonUI/edit/test/actions/SaveActionSpec.js @@ -30,6 +30,7 @@ define( var mockLocation, mockDomainObject, mockEditorCapability, + mockUrlService, actionContext, action; @@ -54,6 +55,10 @@ define( "editor", [ "save", "cancel" ] ); + mockUrlService = jasmine.createSpyObj( + "urlService", + ["urlForLocation"] + ); actionContext = { @@ -64,7 +69,7 @@ define( mockDomainObject.getCapability.andReturn(mockEditorCapability); mockEditorCapability.save.andReturn(mockPromise(true)); - action = new SaveAction(mockLocation, actionContext); + action = new SaveAction(mockLocation, mockUrlService, actionContext); }); @@ -91,7 +96,9 @@ define( it("returns to browse when performed", function () { action.perform(); - expect(mockLocation.path).toHaveBeenCalledWith("/browse"); + expect(mockLocation.path).toHaveBeenCalledWith( + mockUrlService.urlForLocation("browse", mockDomainObject) + ); }); }); }