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"); } };