From e38ad7b082e940c0b895642b7021b60fe83489e3 Mon Sep 17 00:00:00 2001 From: Shivam Dave Date: Tue, 23 Jun 2015 11:05:00 -0700 Subject: [PATCH] [Windowing] Path Alert Alerts user of the current path using an alert window, however the path is partially shown. It is the part of the current path after index.html#. WTD-16. --- platform/commonUI/browse/bundle.json | 5 +++-- .../browse/src/windowing/NewTabAction.js | 20 +++++++++++++++---- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/platform/commonUI/browse/bundle.json b/platform/commonUI/browse/bundle.json index babf873aae..243a0b5519 100644 --- a/platform/commonUI/browse/bundle.json +++ b/platform/commonUI/browse/bundle.json @@ -92,10 +92,11 @@ }, { "key": "window", + "name": "Open in a new tab", "implementation": "windowing/NewTabAction.js", "description": "Open this object in a new tab", - "category": "view-control", - "depends": [ "$window" ], + "category": ["view-control", "contextual"], + "depends": [ "$window", "navigationService" ], "group": "windowing", "glyph": "y" }, diff --git a/platform/commonUI/browse/src/windowing/NewTabAction.js b/platform/commonUI/browse/src/windowing/NewTabAction.js index 5711e528c3..7d617103ec 100644 --- a/platform/commonUI/browse/src/windowing/NewTabAction.js +++ b/platform/commonUI/browse/src/windowing/NewTabAction.js @@ -36,15 +36,27 @@ define( * the user interface.) * @constructor */ - function NewTabAction($window) { + function NewTabAction($window, navigationService) { + function getNavigatedObject() { + var navigatedObject = navigationService.getNavigation(); + return navigatedObject; + } + return { /** * Open the object in a new tab */ perform: function () { - // Places the current Url into a variable - // Then the Url is opened using $window - $window.open($window.location.href); + var currentDomainObject = getNavigatedObject(), + context = currentDomainObject && + currentDomainObject.getCapability('context'), + objectPath = context ? context.getPath() : [], + ids = objectPath.map(function (currentDomainObject) { + return currentDomainObject.getId(); + }), + partialPath = "/browse/" + ids.slice(1).join("/"); + + window.alert(partialPath); } }; }