diff --git a/platform/commonUI/browse/bundle.json b/platform/commonUI/browse/bundle.json index ee6ad552c0..f8c230edd1 100644 --- a/platform/commonUI/browse/bundle.json +++ b/platform/commonUI/browse/bundle.json @@ -96,7 +96,7 @@ "implementation": "windowing/NewTabAction.js", "description": "Open this object in a new tab", "category": ["view-control", "contextual"], - "depends": [ "$window", "$route", "$location", "navigationService" ], + "depends": [ "$window", "$route", "$location" ], "group": "windowing", "glyph": "y" }, diff --git a/platform/commonUI/browse/src/windowing/NewTabAction.js b/platform/commonUI/browse/src/windowing/NewTabAction.js index d715bb4c52..1780658473 100644 --- a/platform/commonUI/browse/src/windowing/NewTabAction.js +++ b/platform/commonUI/browse/src/windowing/NewTabAction.js @@ -29,7 +29,7 @@ define( function () { "use strict"; var ROOT_ID = "ROOT", - DEFAULT_PATH = "mine"; + DEFAULT_PATH = "/mine"; /** * The new tab action allows a domain object to be opened * into a new browser tab. (Currently this is a stub, present @@ -37,10 +37,19 @@ define( * the user interface.) * @constructor */ - function NewTabAction($window, $route, $location, navigationService) { - function getNavigatedObject() { - var navigatedObject = navigationService.getNavigation(); - return navigatedObject; + function NewTabAction($window, $route, $location, context) { + + + function getSelectedObject() { + var object, + newParent; + if (context.selectedObject) { + newParent = context.domainObject; + object = context.selectedObject; + } else { + object = context.domainObject; + } + return object; } return { @@ -48,19 +57,19 @@ define( * Open the object in a new tab */ perform: function () { - - - var currentDomainObject = getNavigatedObject(), - context = currentDomainObject && - currentDomainObject.getCapability('context'), + var genPath = [ROOT_ID].concat(($route.current.params.ids || DEFAULT_PATH)), + selectedDomainObject = getSelectedObject(), + context = selectedDomainObject && + selectedDomainObject.getCapability('context'), objectPath = context ? context.getPath() : [], - ids = objectPath.map(function (currentDomainObject) { - return currentDomainObject.getId(); + ids = objectPath.map(function (selectedDomainObject) { + return selectedDomainObject.getId(); }), viewKey = $location.search().view, - partialPath = "index.html#/browse/" + ids.slice(1).join("/") + "?view=" + viewKey; + partialPath = "index.html#/browse/" + ids.slice(1).join("/") + + "?view=" + viewKey; - window.alert(partialPath); + window.open(partialPath, "_blank"); } }; }