diff --git a/bundles.json b/bundles.json index 53a8058a5a..d7edba5db7 100644 --- a/bundles.json +++ b/bundles.json @@ -3,6 +3,7 @@ "platform/core", "platform/representation", "platform/commonUI/browse", + "platform/commonUI/edit", "platform/commonUI/dialog", "platform/commonUI/general", diff --git a/platform/commonUI/general/res/templates/test.html b/platform/commonUI/general/res/templates/test.html deleted file mode 100644 index d0b6d29bb4..0000000000 --- a/platform/commonUI/general/res/templates/test.html +++ /dev/null @@ -1,3 +0,0 @@ - -
{{model.name}}
-
\ No newline at end of file diff --git a/platform/commonUI/general/res/templates/tree-item.html b/platform/commonUI/general/res/templates/tree-item.html index 60c3ed276a..7ea6ff9dba 100644 --- a/platform/commonUI/general/res/templates/tree-item.html +++ b/platform/commonUI/general/res/templates/tree-item.html @@ -1,23 +1,28 @@ - - - {{toggle.isActive() ? "v" : ">"}} + + + + {{toggle.isActive() ? "v" : ">"}} + + + + + + + ID: {{treeNode.getNodeObject().getId()}}? + + + + - - - - - - - \ No newline at end of file diff --git a/platform/commonUI/general/src/TreeNodeController.js b/platform/commonUI/general/src/TreeNodeController.js index 1593393fe7..152c0f154b 100644 --- a/platform/commonUI/general/src/TreeNodeController.js +++ b/platform/commonUI/general/src/TreeNodeController.js @@ -13,7 +13,9 @@ define( * @constructor */ function TreeNodeController($scope, navigationService) { - var navigatedObject = navigationService.getNavigation(); + var navigatedObject = navigationService.getNavigation(), + isNavigated = false, + expandedObject; function idsEqual(objA, objB) { return objA && objB && (objA.getId() === objB.getId()); @@ -58,14 +60,16 @@ define( function checkNavigation() { var nodeObject = $scope.domainObject; - $scope.node.isSelected = + isNavigated = idsEqual(nodeObject, navigatedObject) && idsEqual(parentOf(nodeObject), parentOf(navigatedObject)); + // Expand if necessary - if (!$scope.node.expanded && - isOnNavigationPath(nodeObject, navigatedObject) && - $scope.toggle !== undefined) { + if (isOnNavigationPath(nodeObject, navigatedObject) && + $scope.toggle !== undefined && + $scope.toggle.isActive()) { $scope.toggle.toggle(); + expandedObject = nodeObject; } } @@ -74,25 +78,23 @@ define( checkNavigation(); } - // When the node is expanded, set "node.domainObject" in - // the scope; this is used to populate the subtree, which - // should only happen when first expanded (lazy loading) - function doExpand(state) { - if (state) { - $scope.node.domainObject = $scope.domainObject; - } - } - - // Set up a little namespace for tree node properties - $scope.node = {}; - navigationService.addListener(setNavigation); $scope.$on("$destroy", function () { navigationService.removeListener(setNavigation); }); $scope.$watch("domainObject", checkNavigation); - $scope.$watch("toggle.isActive()", doExpand); + return { + setNodeObject: function (domainObject) { + expandedObject = domainObject; + }, + getNodeObject: function () { + return expandedObject; + }, + isNavigated: function () { + return isNavigated; + } + }; } return TreeNodeController;