From ca6f44f7b646196e9af7ef4503bedbb5b9b707ea Mon Sep 17 00:00:00 2001 From: Shivam Dave Date: Thu, 25 Jun 2015 09:47:58 -0700 Subject: [PATCH 1/8] [Windowing] URL Fix The URL malformation was caused by the same function returning the view and index path for both the newtab window and the browse controller window. As a result, the BrowseController now only uses a path that excludes the view and index paths, like before the UrlService was added. Another, separate function uses this url for the location and includes the view and index paths for new tabs, in order to maintain the current view. WTD 23. --- .../commonUI/browse/src/BrowseController.js | 5 +-- .../browse/src/services/UrlService.js | 31 +++++++++++++++---- .../browse/src/windowing/NewTabAction.js | 2 +- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/platform/commonUI/browse/src/BrowseController.js b/platform/commonUI/browse/src/BrowseController.js index 50f1da936c..180fd8102e 100644 --- a/platform/commonUI/browse/src/BrowseController.js +++ b/platform/commonUI/browse/src/BrowseController.js @@ -55,10 +55,11 @@ define( $route.current = priorRoute; unlisten(); }); - // urlService.urlFor used to adjust current + // urlService.urlForLocation used to adjust current // path to new, addressed, path based on // domainObject - $location.path(urlService.urlFor("browse", domainObject)); + $location.path(urlService.urlForLocation("browse", domainObject)); + } // Callback for updating the in-scope reference to the object diff --git a/platform/commonUI/browse/src/services/UrlService.js b/platform/commonUI/browse/src/services/UrlService.js index e8b05c27be..b4c145c5dc 100644 --- a/platform/commonUI/browse/src/services/UrlService.js +++ b/platform/commonUI/browse/src/services/UrlService.js @@ -39,34 +39,53 @@ define( // is returned. The view is defaulted to // the current location's (current object's) // view set. - function urlFor(mode, domainObject) { + function urlForLocation(mode, domainObject) { var context = domainObject && domainObject.getCapability('context'), objectPath = context ? context.getPath() : [], ids = objectPath.map(function (domainObject) { return domainObject.getId(); }), - viewPath = "?view=" + $location.search().view, // Parses the path together. Starts with the // default index.html file, then the mode passed // into the service, followed by ids in the url // joined by '/', and lastly the view path from // the current location - path = "index.html#/" + mode + "/" + - ids.slice(1).join("/") + viewPath; - + path = "/" + mode + "/" + + ids.slice(1).join("/"); return path; } + // Uses the Url for the current location + // from the urlForLocation function and + // includes the view and the index path + function urlForNewTab(mode, domainObject) { + var viewPath = "?view=" + $location.search().view, + newTabPath = "index.html#" + + urlForLocation(mode, domainObject) + viewPath; + return newTabPath; + } + return { /** * Returns the Url path for a specific domain object + * without the index.html path and the view path * @param {value} value of the browse or edit mode * for the path * @param {DomainObject} value of the domain object * to get the path of */ - urlFor: urlFor + urlForNewTab: urlForNewTab, + /** + * Returns the Url path for a specific domain object + * including the index.html path and the view path + * allowing a new tab to hold the correct characteristics + * @param {value} value of the browse or edit mode + * for the path + * @param {DomainObject} value of the domain object + * to get the path of + */ + urlForLocation: urlForLocation }; } diff --git a/platform/commonUI/browse/src/windowing/NewTabAction.js b/platform/commonUI/browse/src/windowing/NewTabAction.js index 2437cff41f..8616a89711 100644 --- a/platform/commonUI/browse/src/windowing/NewTabAction.js +++ b/platform/commonUI/browse/src/windowing/NewTabAction.js @@ -56,7 +56,7 @@ define( // (browse) and the domainObject is passed in and // the path is returned and opened in a new tab perform: function () { - $window.open(urlService.urlFor("browse", getSelectedObject()), + $window.open(urlService.urlForNewTab("browse", getSelectedObject()), "_blank"); } }; From 93ba4ce715d8e6222182c35f8414c2ad863063de Mon Sep 17 00:00:00 2001 From: Shivam Dave Date: Thu, 25 Jun 2015 10:10:13 -0700 Subject: [PATCH 2/8] [Windowing] Unit Test Added Unit test adjustments for the change in urlService (addition of a separate function for getting the url for a location, used by browse controller. WTD 23. --- .../browse/test/BrowseControllerSpec.js | 4 +- .../browse/test/services/UrlServiceSpec.js | 41 +++++++++++-------- .../browse/test/windowing/NewTabActionSpec.js | 2 +- 3 files changed, 28 insertions(+), 19 deletions(-) diff --git a/platform/commonUI/browse/test/BrowseControllerSpec.js b/platform/commonUI/browse/test/BrowseControllerSpec.js index 3a14589131..ca9a926f0d 100644 --- a/platform/commonUI/browse/test/BrowseControllerSpec.js +++ b/platform/commonUI/browse/test/BrowseControllerSpec.js @@ -61,7 +61,7 @@ define( ); mockUrlService = jasmine.createSpyObj( "urlService", - ["urlFor"] + ["urlForLocation"] ); mockObjectService = jasmine.createSpyObj( "objectService", @@ -225,7 +225,7 @@ define( // location.path to be called with the urlService's // urlFor function with the next domainObject and mode expect(mockLocation.path).toHaveBeenCalledWith( - mockUrlService.urlFor(mockMode, mockNextObject) + mockUrlService.urlForLocation(mockMode, mockNextObject) ); // Exercise the Angular workaround diff --git a/platform/commonUI/browse/test/services/UrlServiceSpec.js b/platform/commonUI/browse/test/services/UrlServiceSpec.js index 757a09fab0..daff0c5448 100644 --- a/platform/commonUI/browse/test/services/UrlServiceSpec.js +++ b/platform/commonUI/browse/test/services/UrlServiceSpec.js @@ -31,7 +31,11 @@ define( describe("The url service", function () { var urlService, - mockLocation; + mockLocation, + mockDomainObject, + mockContext, + mockMode, + testViews; beforeEach(function () { // Creates a mockLocation, used to @@ -41,24 +45,20 @@ define( [ "path", "search" ] ); - urlService = new UrlService(mockLocation); - }); - - it("get url for a domainObject and mode", function () { - // The mockDomainObject is initialized as a + // The mockDomainObject is initialized as a // spy object to ultimately be passed into the // urlService urlFor function - var mockDomainObject = jasmine.createSpyObj( + mockDomainObject = jasmine.createSpyObj( "domainObject", [ "getId", "getCapability", "getModel", "useCapability" ] - ), - mockContext = jasmine.createSpyObj('context', ['getPath']), - testViews = [ - { key: 'abc' }, - { key: 'def', someKey: 'some value' }, - { key: 'xyz' } - ], - mockMode = "browse"; + ); + mockContext = jasmine.createSpyObj('context', ['getPath']); + testViews = [ + { key: 'abc' }, + { key: 'def', someKey: 'some value' }, + { key: 'xyz' } + ]; + mockMode = "browse"; // The mockContext is set a path // for the mockDomainObject @@ -81,8 +81,17 @@ define( // Uses the mockLocation to get the current // "mock" website's view mockLocation.search.andReturn({ view: 'def' }); - urlService.urlFor(mockMode, mockDomainObject); + + urlService = new UrlService(mockLocation); }); + + it("get url for a location using domainObject and mode", function () { + urlService.urlForLocation(mockMode, mockDomainObject); + }); + + it("get url for a new tab using domainObject and mode", function () { + urlService.urlForNewTab(mockMode, mockDomainObject); + }); }); } ); \ No newline at end of file diff --git a/platform/commonUI/browse/test/windowing/NewTabActionSpec.js b/platform/commonUI/browse/test/windowing/NewTabActionSpec.js index 8955727e19..1371f96eda 100644 --- a/platform/commonUI/browse/test/windowing/NewTabActionSpec.js +++ b/platform/commonUI/browse/test/windowing/NewTabActionSpec.js @@ -53,7 +53,7 @@ define( // Mocks the urlService used to make the new tab's url from a // domainObject and mode - mockUrlService = jasmine.createSpyObj("urlService", ["urlFor"]); + mockUrlService = jasmine.createSpyObj("urlService", ["urlForNewTab"]); // Action done using the current context or mockContextCurrent actionCurrent = new NewTabAction(mockUrlService, mockWindow, From fd6459394acdc389964ff5a774bcdf7be732fc83 Mon Sep 17 00:00:00 2001 From: Shivam Dave Date: Thu, 25 Jun 2015 10:38:39 -0700 Subject: [PATCH 3/8] [Windowing] urlService Changed folder location of services and therefore urlService to general/src/ instead of being in browse/src/. WTD 23. --- platform/commonUI/browse/bundle.json | 2 +- .../commonUI/{browse => general}/src/services/UrlService.js | 0 .../{browse => general}/test/services/UrlServiceSpec.js | 0 3 files changed, 1 insertion(+), 1 deletion(-) rename platform/commonUI/{browse => general}/src/services/UrlService.js (100%) rename platform/commonUI/{browse => general}/test/services/UrlServiceSpec.js (100%) diff --git a/platform/commonUI/browse/bundle.json b/platform/commonUI/browse/bundle.json index 5c36555fbb..f776a45b9c 100644 --- a/platform/commonUI/browse/bundle.json +++ b/platform/commonUI/browse/bundle.json @@ -80,7 +80,7 @@ }, { "key": "urlService", - "implementation": "services/UrlService.js", + "implementation": "../../general/src/services/UrlService.js", "depends": [ "$location" ] }, { diff --git a/platform/commonUI/browse/src/services/UrlService.js b/platform/commonUI/general/src/services/UrlService.js similarity index 100% rename from platform/commonUI/browse/src/services/UrlService.js rename to platform/commonUI/general/src/services/UrlService.js diff --git a/platform/commonUI/browse/test/services/UrlServiceSpec.js b/platform/commonUI/general/test/services/UrlServiceSpec.js similarity index 100% rename from platform/commonUI/browse/test/services/UrlServiceSpec.js rename to platform/commonUI/general/test/services/UrlServiceSpec.js From 6d28add055e6aaf6c4562c16e587b2253e117135 Mon Sep 17 00:00:00 2001 From: Shivam Dave Date: Thu, 25 Jun 2015 13:16:15 -0700 Subject: [PATCH 4/8] [Windowing] urlService urlService added to the edit action bundle.json in addition to being implemented, however 2nd time edit bug still occurring. Also fixed urlService test suite. WTD 23. --- platform/commonUI/browse/bundle.json | 2 +- platform/commonUI/browse/test/suite.json | 1 - platform/commonUI/edit/bundle.json | 11 ++++++-- .../commonUI/edit/src/actions/CancelAction.js | 8 ++++-- .../commonUI/edit/src/actions/SaveAction.js | 4 +-- .../general/src/services/UrlService.js | 27 +++++++++++++++---- platform/commonUI/general/test/suite.json | 1 + 7 files changed, 41 insertions(+), 13 deletions(-) diff --git a/platform/commonUI/browse/bundle.json b/platform/commonUI/browse/bundle.json index f776a45b9c..30bae3cf00 100644 --- a/platform/commonUI/browse/bundle.json +++ b/platform/commonUI/browse/bundle.json @@ -16,7 +16,7 @@ { "key": "BrowseController", "implementation": "BrowseController.js", - "depends": [ "$scope", "$route", "$location", "objectService", "navigationService", "urlService"] + "depends": [ "$scope", "$route", "$location", "objectService", "navigationService", "urlService" ] }, { "key": "BrowseObjectController", diff --git a/platform/commonUI/browse/test/suite.json b/platform/commonUI/browse/test/suite.json index 810b75d673..6cc41900e1 100644 --- a/platform/commonUI/browse/test/suite.json +++ b/platform/commonUI/browse/test/suite.json @@ -9,7 +9,6 @@ "creation/LocatorController", "navigation/NavigateAction", "navigation/NavigationService", - "services/UrlService", "windowing/FullscreenAction", "windowing/NewTabAction", "windowing/WindowTitler" diff --git a/platform/commonUI/edit/bundle.json b/platform/commonUI/edit/bundle.json index fbfd44b42a..b512065c77 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" ], + "depends": [ "$location", "urlService", "navigationService" ], "priority": "mandatory" }, { @@ -76,7 +76,7 @@ "implementation": "actions/CancelAction.js", "name": "Cancel", "description": "Discard changes made to these objects.", - "depends": [ "$location" ] + "depends": [ "$log", "$location", "urlService", "navigationService" ] } ], "policies": [ @@ -117,6 +117,13 @@ "templateUrl": "templates/topbar-edit.html" } ], + "services": [ + { + "key": "urlService", + "implementation": "../../general/src/services/UrlService.js", + "depends": [ "$location" ] + } + ], "representers": [ { "implementation": "representers/EditRepresenter.js", diff --git a/platform/commonUI/edit/src/actions/CancelAction.js b/platform/commonUI/edit/src/actions/CancelAction.js index fce556ba48..799c837679 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($location, context) { + function CancelAction($log, $location, urlService, navigationService, context) { var domainObject = context.domainObject; // Look up the object's "editor.completion" capability; @@ -50,7 +50,11 @@ define( // Discard the current root view (which will be the editing // UI, which will have been pushed atop the Browise UI.) function returnToBrowse() { - $location.path("/browse"); + var urlBrowse = $location.path(urlService.urlForNewTab( + "browse", + domainObject + )); + $location.path(urlBrowse); } return { diff --git a/platform/commonUI/edit/src/actions/SaveAction.js b/platform/commonUI/edit/src/actions/SaveAction.js index 301fced802..036eeb9f56 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, context) { + function SaveAction($location, urlService, navigationService, context) { var domainObject = context.domainObject; // Invoke any save behavior introduced by the editor capability; @@ -45,7 +45,7 @@ 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("/browse"); + return $location.path(urlService.urlForNewTab("browse", domainObject)); } return { diff --git a/platform/commonUI/general/src/services/UrlService.js b/platform/commonUI/general/src/services/UrlService.js index b4c145c5dc..df5e4178df 100644 --- a/platform/commonUI/general/src/services/UrlService.js +++ b/platform/commonUI/general/src/services/UrlService.js @@ -51,8 +51,7 @@ define( // into the service, followed by ids in the url // joined by '/', and lastly the view path from // the current location - path = "/" + mode + "/" + - ids.slice(1).join("/"); + path = mode + "/" + ids.slice(1).join("/"); return path; } @@ -61,11 +60,27 @@ define( // includes the view and the index path function urlForNewTab(mode, domainObject) { var viewPath = "?view=" + $location.search().view, - newTabPath = "index.html#" + - urlForLocation(mode, domainObject) + viewPath; + newTabPath = + "index.html#" + urlForLocation(mode, domainObject) + viewPath; return newTabPath; } + function urlForEdit(mode, domainObject) { + var context = domainObject && + domainObject.getCapability('context'), + objectPath = context ? context.getPath() : [], + ids = objectPath.map(function (domainObject) { + return domainObject.getId(); + }), + // Parses the path together. Starts with the + // default index.html file, then the mode passed + // into the service, followed by ids in the url + // joined by '/', and lastly the view path from + // the current location + path = mode + "/"; + return path; + } + return { /** * Returns the Url path for a specific domain object @@ -85,7 +100,9 @@ define( * @param {DomainObject} value of the domain object * to get the path of */ - urlForLocation: urlForLocation + urlForLocation: urlForLocation, + + urlForEdit: urlForEdit }; } diff --git a/platform/commonUI/general/test/suite.json b/platform/commonUI/general/test/suite.json index e8c9674b44..37fc4c4b78 100644 --- a/platform/commonUI/general/test/suite.json +++ b/platform/commonUI/general/test/suite.json @@ -13,5 +13,6 @@ "directives/MCTDrag", "directives/MCTResize", "directives/MCTScroll", + "services/UrlService", "StyleSheetLoader" ] \ No newline at end of file From 3a371483abb156b76edf62c062dddfab6df0e95c Mon Sep 17 00:00:00 2001 From: Shivam Dave Date: Thu, 25 Jun 2015 14:07:02 -0700 Subject: [PATCH 5/8] [Windowing] urlService Added the urlService to the unit tests for the cancel and save buttons also removed unused services. WTD 23. --- platform/commonUI/edit/bundle.json | 4 ++-- platform/commonUI/edit/src/actions/CancelAction.js | 4 ++-- platform/commonUI/edit/src/actions/SaveAction.js | 7 +++++-- .../commonUI/edit/test/actions/CancelActionSpec.js | 12 +++++++++--- .../commonUI/edit/test/actions/SaveActionSpec.js | 11 +++++++++-- 5 files changed, 27 insertions(+), 11 deletions(-) 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) + ); }); }); } From 3d0e0af7f251234240aab4ff995d2b7e86af121f Mon Sep 17 00:00:00 2001 From: Shivam Dave Date: Thu, 25 Jun 2015 14:28:38 -0700 Subject: [PATCH 6/8] [Windowing] Remove variable Excess variable used for CancelAction's ReturnToBrowse. WTD 23. --- platform/commonUI/edit/src/actions/CancelAction.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/platform/commonUI/edit/src/actions/CancelAction.js b/platform/commonUI/edit/src/actions/CancelAction.js index 2b117b5f6d..725f6ee6a7 100644 --- a/platform/commonUI/edit/src/actions/CancelAction.js +++ b/platform/commonUI/edit/src/actions/CancelAction.js @@ -50,11 +50,10 @@ 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.urlForLocation( + $location.path($location.path(urlService.urlForLocation( "browse", domainObject - )); - $location.path(urlBrowse); + ))); } return { From 193df4fde366c7c272237de404e91518c75208ca Mon Sep 17 00:00:00 2001 From: Shivam Dave Date: Thu, 25 Jun 2015 14:37:01 -0700 Subject: [PATCH 7/8] [Windowing] Excess function Removed extra function from urlService. WTD 23. --- .../general/src/services/UrlService.js | 20 +------------------ 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/platform/commonUI/general/src/services/UrlService.js b/platform/commonUI/general/src/services/UrlService.js index df5e4178df..4562059d0c 100644 --- a/platform/commonUI/general/src/services/UrlService.js +++ b/platform/commonUI/general/src/services/UrlService.js @@ -65,22 +65,6 @@ define( return newTabPath; } - function urlForEdit(mode, domainObject) { - var context = domainObject && - domainObject.getCapability('context'), - objectPath = context ? context.getPath() : [], - ids = objectPath.map(function (domainObject) { - return domainObject.getId(); - }), - // Parses the path together. Starts with the - // default index.html file, then the mode passed - // into the service, followed by ids in the url - // joined by '/', and lastly the view path from - // the current location - path = mode + "/"; - return path; - } - return { /** * Returns the Url path for a specific domain object @@ -100,9 +84,7 @@ define( * @param {DomainObject} value of the domain object * to get the path of */ - urlForLocation: urlForLocation, - - urlForEdit: urlForEdit + urlForLocation: urlForLocation }; } From 2a347f15968e98372c89d65a377bd5ae9b643580 Mon Sep 17 00:00:00 2001 From: Shivam Dave Date: Thu, 25 Jun 2015 14:53:52 -0700 Subject: [PATCH 8/8] [Windowing] urlService Removed the urlService from the edit and browse bundles. Added the urlService to the general bundle. WTD 23. --- platform/commonUI/browse/bundle.json | 7 +------ platform/commonUI/edit/bundle.json | 9 +-------- platform/commonUI/general/bundle.json | 7 +++++++ 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/platform/commonUI/browse/bundle.json b/platform/commonUI/browse/bundle.json index 30bae3cf00..845edff2f7 100644 --- a/platform/commonUI/browse/bundle.json +++ b/platform/commonUI/browse/bundle.json @@ -77,12 +77,7 @@ { "key": "navigationService", "implementation": "navigation/NavigationService.js" - }, - { - "key": "urlService", - "implementation": "../../general/src/services/UrlService.js", - "depends": [ "$location" ] - }, + }, { "key": "creationService", "implementation": "creation/CreationService.js", diff --git a/platform/commonUI/edit/bundle.json b/platform/commonUI/edit/bundle.json index 2c5aec2e06..2aed41c2ee 100644 --- a/platform/commonUI/edit/bundle.json +++ b/platform/commonUI/edit/bundle.json @@ -116,14 +116,7 @@ "key": "topbar-edit", "templateUrl": "templates/topbar-edit.html" } - ], - "services": [ - { - "key": "urlService", - "implementation": "../../general/src/services/UrlService.js", - "depends": [ "$location" ] - } - ], + ], "representers": [ { "implementation": "representers/EditRepresenter.js", diff --git a/platform/commonUI/general/bundle.json b/platform/commonUI/general/bundle.json index ead610c963..fdac965863 100644 --- a/platform/commonUI/general/bundle.json +++ b/platform/commonUI/general/bundle.json @@ -3,6 +3,13 @@ "description": "General UI elements, meant to be reused across modes", "resources": "res", "extensions": { + "services": [ + { + "key": "urlService", + "implementation": "/services/UrlService.js", + "depends": [ "$location" ] + } + ], "runs": [ { "implementation": "StyleSheetLoader.js",