From 8e6505c80f12ac2766abeb6df9e0c463bb17c9a9 Mon Sep 17 00:00:00 2001 From: Shivam Dave Date: Fri, 28 Aug 2015 13:38:29 -0700 Subject: [PATCH] [Mobile] Phone Portrait Close Used merged function to close the left tree on selection of an object on phone portrait. --- .../commonUI/browse/src/BrowseController.js | 40 ++++++++----------- 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/platform/commonUI/browse/src/BrowseController.js b/platform/commonUI/browse/src/BrowseController.js index 557599e3af..2c629654f0 100644 --- a/platform/commonUI/browse/src/BrowseController.js +++ b/platform/commonUI/browse/src/BrowseController.js @@ -50,12 +50,12 @@ define( function updateRoute(domainObject) { var priorRoute = $route.current, - // Act as if params HADN'T changed to avoid page reload + // Act as if params HADN'T changed to avoid page reload unlisten; unlisten = $scope.$on('$locationChangeSuccess', function () { // Checks path to make sure /browse/ is at front - // if so, change $route.current + // if so, change $route.current if ($location.path().indexOf("/browse/") === 0) { $route.current = priorRoute; } @@ -127,8 +127,8 @@ define( navigateTo(domainObject); } } - - // Uses the current navigation to get the + + // Uses the current navigation to get the // current ContextCapability, then the // parent is gotten from that. If the parent // is not the root, then user is navigated to @@ -138,23 +138,22 @@ define( parentContext, parent, grandparentId; - + // Checks if the current object has a context if (context) { - // Sets the parent and the parent context // which is checked parent = context.getParent(); parentContext = parent.getCapability('context'); - + if ((parent.getId() !== ROOT_ID) && parentContext) { // Gets the grandparent id grandparentId = parentContext.getParent().getId(); - + // Navigates to the parent navigateTo(parent); - - // Checks after navigation if the user is located at the + + // Checks after navigation if the user is located at the // root (grandparent of original selected object, after // navigation, user is at parent of original object and // child of grandparent) @@ -162,27 +161,27 @@ define( $scope.atRoot = false; return; } - + // Set at root if no grandparent exists and // if grandparent is ROOT, after navigation $scope.atRoot = true; } } } - + function checkRoot() { var context = navigationService.getNavigation().getCapability('context'), parentContext, parent, grandparent; - + // Checks if the current object has a context if (context) { parent = context.getParent(); parentContext = parent.getCapability('context'); if ((parent.getId() !== ROOT_ID) && parentContext) { grandparent = parentContext.getParent(); - + // Checks if the grandparent exists // if it does not exist (for example in search), // than do not show the back button @@ -192,12 +191,11 @@ define( } } } - + // In any other situation where the context or parent // context does not exist or the user is at ROOT, than // hide the back arrow $scope.atRoot = true; - } // Load the root object, put it in the scope. @@ -214,12 +212,6 @@ define( selectedObject: navigationService.getNavigation() }; - // SlideMenu boolean used to hide and show - // tree menu - $scope.treeSlide = function () { - $scope.treeClass = !$scope.treeClass; - }; - // Provide a model for the left pane $scope.paneModel = { selectedObject: navigationService.getNavigation() @@ -235,11 +227,11 @@ define( $scope.$on("$destroy", function () { navigationService.removeListener(setNavigation); }); - + // If the user has selected an object (and is portrait // on a phone), then hide the tree menu $scope.$on("select-obj", function () { - //$scope.treeSlide(); + $scope.paneModel = !$scope.paneModel; }); $scope.backArrow = navigateToParent;