From d8bc34c28c0b81ad685ac66e63e362a7ed29e8a1 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Tue, 17 Mar 2015 16:12:36 +0100 Subject: [PATCH] extract settings links in the context nav --- .../src/main/hbs/nav/nav-context-navbar.hbs | 21 +++++++++++-------- .../src/main/js/nav/context-navbar-view.js | 21 +++++++++++++++---- .../src/main/less/components/navbar.less | 6 ++++++ .../resources/org/sonar/l10n/core.properties | 2 +- 4 files changed, 36 insertions(+), 14 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 @@
  • {{t 'issues.page'}}
  • + {{#if contextConfiguration}} + + {{/if}} 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 { diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties index ef1603954a4..446194a2bc3 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -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. -- 2.39.5