]> source.dussan.org Git - sonarqube.git/commitdiff
extract settings links in the context nav
authorStas Vilchik <vilchiks@gmail.com>
Tue, 17 Mar 2015 15:12:36 +0000 (16:12 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Tue, 17 Mar 2015 15:12:36 +0000 (16:12 +0100)
server/sonar-web/src/main/hbs/nav/nav-context-navbar.hbs
server/sonar-web/src/main/js/nav/context-navbar-view.js
server/sonar-web/src/main/less/components/navbar.less
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index eaa48a1d8a011af93ec14bce9d7f5a91b116b557..b0b106f1fd65b96ae2b070741d7fc10bdbdc9365 100644 (file)
     <li {{#isActiveLink '/component_issues'}}class="active"{{/isActiveLink}}>
       <a href="{{link '/component_issues/index?id=' contextKeyEncoded }}">{{t 'issues.page'}}</a>
     </li>
+    {{#if contextConfiguration}}
+      <li class="dropdown {{#if isSettingsActive}}active{{/if}}">
+        <a class="dropdown-toggle navbar-admin-link" data-toggle="dropdown" href="#">{{t 'layout.settings'}}&nbsp;<i class="icon-dropdown"></i></a>
+        <ul class="dropdown-menu">
+          {{#each contextConfiguration}}
+            <li>
+              <a href="{{link url}}">{{name}}</a>
+            </li>
+          {{/each}}
+        </ul>
+      </li>
+    {{/if}}
     <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">
             <a href="{{link '/comparison/index?resource=' contextKey}}">{{t 'comparison.page'}}</a>
           </li>
         {{/if}}
-        {{#if contextConfiguration}}
-          <li class="divider"></li>
-          <li class="dropdown-header">Configuration</li>
-          {{#each contextConfiguration}}
-            <li>
-              <a href="{{link url}}">{{name}}</a>
-            </li>
-          {{/each}}
-        {{/if}}
       </ul>
     </li>
   </ul>
index ddf73914459817ae73f6d61bd44a4bd787d6945b..6107a4276a24b080a8e5e17b43af1b7f85d5dbe9 100644 (file)
@@ -21,7 +21,15 @@ define([
   'templates/nav'
 ], function () {
 
-  var $ = jQuery;
+  var $ = jQuery,
+      OVERVIEW_URLS = [
+          '/design', '/libraries', '/dashboards'
+      ],
+      SETTINGS_URLS = [
+        '/project/settings', '/project/profile', '/project/qualitygate', '/manual_measures/index',
+        '/action_plans/index', '/project/links', '/project_roles/index', '/project/history', '/project/key',
+        '/project/deletion'
+      ];
 
   return Marionette.ItemView.extend({
     template: Templates['nav-context-navbar'],
@@ -53,15 +61,20 @@ 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;
+          isMoreActive = _.some(OVERVIEW_URLS, function (url) {
+            return href.indexOf(url) !== -1;
+          }) || (href.indexOf('/dashboard') !== -1 && search.indexOf('did=') !== -1),
+          isSettingsActive = _.some(SETTINGS_URLS, function (url) {
+            return href.indexOf(url) !== -1;
+          }),
+          isOverviewActive = !isMoreActive && href.indexOf('/dashboard') !== -1 && search.indexOf('did=') === -1;
 
       return _.extend(Marionette.Layout.prototype.serializeData.apply(this, arguments), {
         canManageContextDashboards: !!window.SS.user,
         contextKeyEncoded: encodeURIComponent(this.model.get('contextKey')),
 
         isOverviewActive: isOverviewActive,
+        isSettingsActive: isSettingsActive,
         isMoreActive: isMoreActive
       });
     }
index bc016e97a650685904b1b56b1ad68446e4ad5ca0..5eaa446b3ac964dab0a2967aec616b7ce862a02d 100644 (file)
     padding-top: 3px;
     padding-bottom: 3px;
   }
+
+  .navbar-admin-link:hover,
+  .navbar-admin-link:focus,
+  .active > .navbar-admin-link {
+    border-color: @orange !important;
+  }
 }
 
 .navbar-context-favorite {
index ef1603954a44bfe310867a9538528c38880a7728..446194a2bc3341bdc738f360c3b09ffbe66688ab 100644 (file)
@@ -466,7 +466,7 @@ manual_rules.delete_manual_rule_message=Are you sure that you want to delete man
 roles.page=Project Permissions
 roles.page.description=Grant and revoke project-level permissions to Browse (view a project's metrics), See Source Code, and Administer individual projects. Permissions can be granted to groups or individual users.
 roles.page.description2=Grant and revoke project-level permissions. Permissions can be granted to groups or individual users.
-project_settings.page=Settings
+project_settings.page=General Settings
 project_settings.page.description=Edit project settings.
 project_links.page=Links
 project_links.page.description=Edit some links associated with this project.