From a824b4d77f3a0a4c6150e393c1e12026f2aee1a8 Mon Sep 17 00:00:00 2001 From: kunw Date: Wed, 18 May 2016 16:50:44 +0800 Subject: [PATCH] refinement for navigation-details default action of UI. --- .../details/retrieve-projects.directive.js | 1 - .../navigation/navigation-details.directive.js | 12 ++++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/static/ng/resources/js/components/details/retrieve-projects.directive.js b/static/ng/resources/js/components/details/retrieve-projects.directive.js index d2b1b7dbd..3a0c6ba2a 100644 --- a/static/ng/resources/js/components/details/retrieve-projects.directive.js +++ b/static/ng/resources/js/components/details/retrieve-projects.directive.js @@ -99,7 +99,6 @@ vm.selectedProject = item; vm.checkProjectMember(vm.selectedProject.ProjectId); vm.isOpen = false; - $location.search('project_id', vm.selectedProject.ProjectId); } diff --git a/static/ng/resources/js/layout/navigation/navigation-details.directive.js b/static/ng/resources/js/layout/navigation/navigation-details.directive.js index dbd57baf1..8313c68c8 100644 --- a/static/ng/resources/js/layout/navigation/navigation-details.directive.js +++ b/static/ng/resources/js/layout/navigation/navigation-details.directive.js @@ -6,9 +6,9 @@ .module('harbor.layout.navigation') .directive('navigationDetails', navigationDetails); - NavigationDetailsController.$inject = ['$window', '$location', '$scope']; + NavigationDetailsController.$inject = ['$window', '$location', '$scope', '$route']; - function NavigationDetailsController($window, $location, $scope) { + function NavigationDetailsController($window, $location, $scope, $route) { var vm = this; $scope.$watch('vm.selectedProject', function(current, origin) { @@ -48,9 +48,17 @@ function link(scope, element, attrs, ctrl) { var visited = ctrl.url.substring(1); + if(visited.indexOf('?') >= 0) { visited = ctrl.url.substring(1, ctrl.url.indexOf('?') - 1); } + + scope.$watch('vm.selectedProject', function(current) { + if(current) { + element.find('a').removeClass('active'); + element.find('a:first').addClass('active'); + } + }); element.find('a[tag*="' + visited + '"]').addClass('active'); element.on('click', click);