diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2015-03-17 16:12:36 +0100 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2015-03-17 16:12:36 +0100 |
commit | d8bc34c28c0b81ad685ac66e63e362a7ed29e8a1 (patch) | |
tree | 393e56b55f92ce43af7d8c76b9df58ab1a818636 /server/sonar-web/src/main | |
parent | 5e691b5d2c39e58a626b8ed29207cdcab1bb1223 (diff) | |
download | sonarqube-d8bc34c28c0b81ad685ac66e63e362a7ed29e8a1.tar.gz sonarqube-d8bc34c28c0b81ad685ac66e63e362a7ed29e8a1.zip |
extract settings links in the context nav
Diffstat (limited to 'server/sonar-web/src/main')
3 files changed, 35 insertions, 13 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 eaa48a1d8a0..b0b106f1fd6 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 @@ -30,6 +30,18 @@ <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'}} <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'}} <i class="icon-dropdown"></i></a> <ul class="dropdown-menu"> @@ -58,15 +70,6 @@ <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> 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 ddf73914459..6107a4276a2 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 @@ -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 }); } diff --git a/server/sonar-web/src/main/less/components/navbar.less b/server/sonar-web/src/main/less/components/navbar.less index bc016e97a65..5eaa446b3ac 100644 --- a/server/sonar-web/src/main/less/components/navbar.less +++ b/server/sonar-web/src/main/less/components/navbar.less @@ -219,6 +219,12 @@ 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 { |