]> source.dussan.org Git - sonarqube.git/commitdiff
better highlighting of active navigation item in the project context
authorStas Vilchik <vilchiks@gmail.com>
Mon, 16 Mar 2015 13:04:20 +0000 (14:04 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Mon, 16 Mar 2015 13:04:55 +0000 (14:04 +0100)
server/sonar-web/src/main/hbs/nav/nav-context-navbar.hbs
server/sonar-web/src/main/js/nav/context-navbar-view.js

index 7d383f4966b3c1c235b216656b2e0e41c05c4783..0239245f9ee6727d63f821297623b85a91abb18f 100644 (file)
@@ -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'}}&nbsp;<i class="icon-dropdown"></i></a>
       <ul class="dropdown-menu">
         <li class="dropdown-header">{{t 'layout.dashboards'}}</li>
index 7244b1c079de90cb594e3f567206ba7e76b5d9a0..e52a490eb204fed1f0c84975c3834671bd287127 100644 (file)
@@ -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
       });
     }
   });