Collapse higher-level navigation on certain actions

    * Selecting parent-level navigation collapses
      child navigation.

    * Selecting top-level navigation collapses all.

Change-Id: I35d3ed1594e96f32539f488b86aa7d1eb558c5d1
Signed-off-by: Iftekharul Islam <iislam@us.ibm.com>
diff --git a/app/common/directives/app-navigation.js b/app/common/directives/app-navigation.js
index a1e912c..00c3ec7 100644
--- a/app/common/directives/app-navigation.js
+++ b/app/common/directives/app-navigation.js
@@ -12,21 +12,26 @@
                     'showNavigation': '='
                 },
                 'controller': ['$scope', '$location', 'dataService', function($scope, $location, dataService){
+                    $scope.showSubMenu = false;
                     $scope.change = function(firstLevel){
-                        $scope.firstLevel = firstLevel;
-                        //$location.path('/'+firstLevel);
+                        if(firstLevel != $scope.firstLevel) {
+                            $scope.firstLevel = firstLevel;
+                            $scope.showSubMenu = true;
+                        }else{
+                           $scope.showSubMenu = !$scope.showSubMenu;
+                        }
                     };
                     $scope.closeSubnav = function(){
-                        $scope.firstLevel = '';
+                        $scope.showSubMenu = false;
                     };
                     $scope.$watch('showNavigation', function(){
                         var paddingTop = 0;
-                        // var urlRoot = $location.path().split("/")[1];
-                        // if(urlRoot != ""){
-                        //     $scope.firstLevel = urlRoot;
-                        // }else{
-                        //     $scope.firstLevel = 'overview';
-                        // }
+                        var urlRoot = $location.path().split("/")[1];
+                        if(urlRoot != ""){
+                            $scope.firstLevel = urlRoot;
+                        }else{
+                            $scope.firstLevel = 'overview';
+                        }
 
                         if($scope.showNavigation){
                             paddingTop = document.getElementById('header__wrapper').offsetHeight;