diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2015-03-16 14:04:20 +0100 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2015-03-16 14:04:55 +0100 |
commit | 2a93e40d9ce602185afc37dcee2d5483f9b4e063 (patch) | |
tree | 310d3d14f6ed4d6485dd40aae32fd990d8d786c9 | |
parent | d18308ab161d71489498c056a9124e2c87f7f20d (diff) | |
download | sonarqube-2a93e40d9ce602185afc37dcee2d5483f9b4e063.tar.gz sonarqube-2a93e40d9ce602185afc37dcee2d5483f9b4e063.zip |
better highlighting of active navigation item in the project context
-rw-r--r-- | server/sonar-web/src/main/hbs/nav/nav-context-navbar.hbs | 4 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/nav/context-navbar-view.js | 11 |
2 files changed, 12 insertions, 3 deletions
diff --git a/server/sonar-web/src/main/hbs/nav/nav-context-navbar.hbs b/server/sonar-web/src/main/hbs/nav/nav-context-navbar.hbs index 7d383f4966b..0239245f9ee 100644 --- a/server/sonar-web/src/main/hbs/nav/nav-context-navbar.hbs +++ b/server/sonar-web/src/main/hbs/nav/nav-context-navbar.hbs @@ -21,7 +21,7 @@ </div> <ul class="nav navbar-nav nav-tabs"> - <li {{#isActiveLink '/dashboard/'}}class="active"{{/isActiveLink}}> + <li {{#if isOverviewActive}}class="active"{{/if}}> <a href="{{dashboardUrl contextKey}}">{{t 'overview.page'}}</a> </li> <li {{#isActiveLink '/components'}}class="active"{{/isActiveLink}}> @@ -30,7 +30,7 @@ <li {{#isActiveLink '/component_issues'}}class="active"{{/isActiveLink}}> <a href="{{link '/component_issues/index?id=' contextKeyEncoded }}">{{t 'issues.page'}}</a> </li> - <li class="dropdown"> + <li class="dropdown {{#if isMoreActive}}active{{/if}}"> <a class="dropdown-toggle" data-toggle="dropdown" href="#">{{t 'more'}} <i class="icon-dropdown"></i></a> <ul class="dropdown-menu"> <li class="dropdown-header">{{t 'layout.dashboards'}}</li> diff --git a/server/sonar-web/src/main/js/nav/context-navbar-view.js b/server/sonar-web/src/main/js/nav/context-navbar-view.js index 7244b1c079d..e52a490eb20 100644 --- a/server/sonar-web/src/main/js/nav/context-navbar-view.js +++ b/server/sonar-web/src/main/js/nav/context-navbar-view.js @@ -51,9 +51,18 @@ define([ }, serializeData: function () { + var href = window.location.href, + search = window.location.search, + isOverviewActive = href.indexOf('/dashboard/') !== -1 && search.indexOf('did=') === -1, + isMoreActive = !isOverviewActive && href.indexOf('/components') === -1 && + href.indexOf('/component_issues') === -1; + return _.extend(Marionette.Layout.prototype.serializeData.apply(this, arguments), { canManageContextDashboards: window.SS.user != null, - contextKeyEncoded: encodeURIComponent(this.model.get('contextKey')) + contextKeyEncoded: encodeURIComponent(this.model.get('contextKey')), + + isOverviewActive: isOverviewActive, + isMoreActive: isMoreActive }); } }); |