[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", "key": "window",
"name": "Open in a new tab",
"implementation": "windowing/NewTabAction.js", "implementation": "windowing/NewTabAction.js",
"description": "Open this object in a new tab", "description": "Open this object in a new tab",
"category": "view-control", "category": ["view-control", "contextual"],
"depends": [ "$window" ], "depends": [ "$window", "navigationService" ],
"group": "windowing", "group": "windowing",
"glyph": "y" "glyph": "y"
}, },

View File

@ -36,15 +36,27 @@ define(
* the user interface.) * the user interface.)
* @constructor * @constructor
*/ */
function NewTabAction($window) { function NewTabAction($window, navigationService) {
function getNavigatedObject() {
var navigatedObject = navigationService.getNavigation();
return navigatedObject;
}
return { return {
/** /**
* Open the object in a new tab * Open the object in a new tab
*/ */
perform: function () { perform: function () {
// Places the current Url into a variable var currentDomainObject = getNavigatedObject(),
// Then the Url is opened using $window context = currentDomainObject &&
$window.open($window.location.href); currentDomainObject.getCapability('context'),
objectPath = context ? context.getPath() : [],
ids = objectPath.map(function (currentDomainObject) {
return currentDomainObject.getId();
}),
partialPath = "/browse/" + ids.slice(1).join("/");
window.alert(partialPath);
} }
}; };
} }