diff --git a/awx/ui/client/src/main-menu/main-menu.directive.js b/awx/ui/client/src/main-menu/main-menu.directive.js
index 80acd52a0a..50b4404648 100644
--- a/awx/ui/client/src/main-menu/main-menu.directive.js
+++ b/awx/ui/client/src/main-menu/main-menu.directive.js
@@ -1,36 +1,14 @@
/* jshint unused: vars */
export default
- [ '$location', 'templateUrl', '$rootScope', function($location, templateUrl, $rootScope) {
+ [ '$state', 'templateUrl', '$rootScope', function($state, templateUrl, $rootScope) {
return {
restrict: 'E',
templateUrl: templateUrl('main-menu/main-menu'),
link: function(scope, element, attrs) {
- // check to see if this is the current route
- scope.isCurrentRoute = function(route) {
- if ($location.url().split('/')[1] === route) {
- return true;
- } else {
- return false;
- }
- };
- // check to see if the current route is the currently
- // logged in user
- scope.isCurrentRouteUser = function() {
- if ($rootScope && $rootScope.current_user) {
- if ($location.url().split('/')[1] === 'users') {
- if ($location.url().split('/')[2] === ($rootScope.current_user.id + "")) {
- return true;
- } else {
- return false;
- }
- } else {
- return false;
- }
- } else {
- return false;
- }
+ scope.isCurrentState = function(name){
+ return $state.current.name == name
};
// set up the user tooltip
diff --git a/awx/ui/client/src/main-menu/main-menu.partial.html b/awx/ui/client/src/main-menu/main-menu.partial.html
index 69d638792b..f05ab5b1ab 100644
--- a/awx/ui/client/src/main-menu/main-menu.partial.html
+++ b/awx/ui/client/src/main-menu/main-menu.partial.html
@@ -13,7 +13,7 @@
+ ng-class="{'is-currentRoute' : isCurrentState('projects')}">
PROJECTS
@@ -21,7 +21,7 @@
+ ng-class="{'is-currentRoute' : isCurrentState('inventories')}">
INVENTORIES
@@ -29,7 +29,7 @@
+ ng-class="{'is-currentRoute' : isCurrentState('jobTemplates')}">
JOB TEMPLATES
@@ -37,7 +37,7 @@
+ ng-class="{'is-currentRoute' : isCurrentState('jobs')}">
JOBS
@@ -45,7 +45,7 @@
+ ng-class="{'is-currentRoute' : isCurrentState('users.edit')}">
VIEW USER PAGE FOR {{ $root.current_user.username | uppercase }}
@@ -53,7 +53,7 @@
+ ng-class="{'is-currentRoute' : isCurrentState('setup')}">
SETTINGS
@@ -61,7 +61,7 @@
+ ng-class="{'is-currentRoute' : isCurrentState('portalMode')}">
PORTAL MODE
@@ -77,7 +77,7 @@
+ ng-class="{'is-currentRoute' : isCurrentState('logout')}">
LOG OUT
@@ -88,7 +88,7 @@
+ ng-class="{'is-currentRoute' : isCurrentState('projects'), 'is-loggedOut' : !$root.current_user.username}">
PROJECTS
@@ -96,7 +96,7 @@
+ ng-class="{'is-currentRoute' : isCurrentState('inventories'), 'is-loggedOut' : !$root.current_user.username}">
INVENTORIES
@@ -104,7 +104,7 @@
+ ng-class="{'is-currentRoute' : isCurrentState('jobTemplates'), 'is-loggedOut' : !$root.current_user.username}">
JOB TEMPLATES
@@ -112,7 +112,7 @@
+ ng-class="{'is-currentRoute' : isCurrentState('jobs'), 'is-loggedOut' : !$root.current_user.username}">
JOBS
@@ -120,7 +120,7 @@