[Addressability] Update path on navigation

Update path in browse mode when navigation state changes.
WTD-1149.
This commit is contained in:
Victor Woeltjen 2015-06-16 13:28:19 -07:00
parent 9fae2db04a
commit 084d6b6859
2 changed files with 13 additions and 2 deletions

View File

@ -14,7 +14,7 @@
{
"key": "BrowseController",
"implementation": "BrowseController.js",
"depends": [ "$scope", "$routeParams", "objectService", "navigationService" ]
"depends": [ "$scope", "$route", "$location", "objectService", "navigationService" ]
},
{
"key": "CreateMenuController",

View File

@ -41,17 +41,28 @@ define(
*
* @constructor
*/
function BrowseController($scope, $routeParams, objectService, navigationService) {
function BrowseController($scope, $routeParams, $location, objectService, navigationService) {
var path = [ROOT_ID].concat(
($routeParams.ids || DEFAULT_PATH).split("/")
);
function updateRoute(domainObject) {
var context = domainObject.getCapability('context'),
objectPath = context.getPath(),
ids = objectPath.map(function (domainObject) {
return domainObject.getId();
});
$location.path("/browse/" + ids.slice(1).join("/"));
}
// Callback for updating the in-scope reference to the object
// that is currently navigated-to.
function setNavigation(domainObject) {
$scope.navigatedObject = domainObject;
$scope.treeModel.selectedObject = domainObject;
navigationService.setNavigation(domainObject);
updateRoute(domainObject);
}
function navigateTo(domainObject) {