diff --git a/platform/commonUI/browse/bundle.json b/platform/commonUI/browse/bundle.json index a4b6678541..b367d02510 100644 --- a/platform/commonUI/browse/bundle.json +++ b/platform/commonUI/browse/bundle.json @@ -14,7 +14,7 @@ { "key": "BrowseController", "implementation": "BrowseController.js", - "depends": [ "$scope", "$routeParams", "objectService", "navigationService" ] + "depends": [ "$scope", "$route", "$location", "objectService", "navigationService" ] }, { "key": "CreateMenuController", diff --git a/platform/commonUI/browse/src/BrowseController.js b/platform/commonUI/browse/src/BrowseController.js index 9bd118e458..eebd11faf9 100644 --- a/platform/commonUI/browse/src/BrowseController.js +++ b/platform/commonUI/browse/src/BrowseController.js @@ -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) {