[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.
This commit is contained in:
Shivam Dave 2015-06-23 11:05:00 -07:00
parent d5a9019493
commit e38ad7b082
2 changed files with 19 additions and 6 deletions

View File

@ -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"
},

View File

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