diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2015-01-26 16:54:05 +0100 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2015-01-26 17:10:12 +0100 |
commit | 24aca432a8313869f99124026befc6f6ea60615e (patch) | |
tree | ab5a171b2c39e6608fb60e6d9841ea62a4a15379 | |
parent | 89252c95dc7bd91998a79ee23f3e5dcd21375b6f (diff) | |
download | sonarqube-24aca432a8313869f99124026befc6f6ea60615e.tar.gz sonarqube-24aca432a8313869f99124026befc6f6ea60615e.zip |
SONAR-6041 apply feedback
8 files changed, 65 insertions, 23 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 1f0f9b61218..966bde751cb 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 @@ -1,4 +1,9 @@ <div class="container"> + {{# if canFavoriteContext}} + <div class="navbar-context-favorite"> + <a class="js-favorite {{#if isContextFavorite}}icon-favorite{{else}}icon-not-favorite{{/if}}"></a> + </div> + {{/if}} <ul class="nav navbar-nav nav-crumbs"> {{#each contextBreadcrumbs}} <li> @@ -11,11 +16,12 @@ <div class="navbar-right navbar-context-meta"> {{#if contextVersion}}Version {{contextVersion}}{{/if}} + {{#all contextVersion contextDate}}/{{/all}} {{#if contextDate}}{{dt contextDate}}{{/if}} </div> <ul class="nav navbar-nav nav-tabs"> - <li {{#isActiveLink '/dashboard'}}class="active"{{/isActiveLink}}> + <li {{#isActiveLink '/dashboard/'}}class="active"{{/isActiveLink}}> <a href="{{dashboardUrl contextKey}}">{{t 'overview.page'}}</a> </li> <li {{#isActiveLink '/components'}}class="active"{{/isActiveLink}}> @@ -33,6 +39,12 @@ <a href="{{link url}}">{{name}}</a> </li> {{/each}} + {{#if canManageContextDashboards}} + <li class="divider"></li> + <li> + <a href="{{link '/dashboards?resource=' contextId}}">{{t 'dashboard.manage_dashboards'}}</a> + </li> + {{/if}} <li class="divider"></li> <li class="dropdown-header">Tools</li> <li> diff --git a/server/sonar-web/src/main/hbs/nav/nav-global-navbar.hbs b/server/sonar-web/src/main/hbs/nav/nav-global-navbar.hbs index 9556ef5bed5..19e3e1119a8 100644 --- a/server/sonar-web/src/main/hbs/nav/nav-global-navbar.hbs +++ b/server/sonar-web/src/main/hbs/nav/nav-global-navbar.hbs @@ -17,24 +17,24 @@ {{#if canManageGlobalDashboards}} <li class="divider"></li> <li> - <a href="{{link '/dashboards'}}">{{t 'manage'}}</a> + <a href="{{link '/dashboards'}}">{{t 'dashboard.manage_dashboards'}}</a> </li> {{/if}} </ul> </li> - <li class="dropdown immediate-dropdown"> + <li {{#isActiveLink '/issues'}}class="active"{{/isActiveLink}}> <a href="{{link '/issues/search'}}">{{t 'issues.page'}}</a> </li> - <li> + <li {{#isActiveLink '/measures'}}class="active"{{/isActiveLink}}> <a href="{{link '/measures/search?qualifiers[]=TRK'}}">{{t 'layout.measures'}}</a> </li> - <li> + <li {{#isActiveLink '/coding_rules'}}class="active"{{/isActiveLink}}> <a href="{{link '/coding_rules'}}">{{t 'coding_rules.page'}}</a> </li> - <li> + <li {{#isActiveLink '/profiles'}}class="active"{{/isActiveLink}}> <a href="{{link '/profiles'}}">{{t 'quality_profiles.page'}}</a> </li> - <li> + <li {{#isActiveLink '/quality_gates'}}class="active"{{/isActiveLink}}> <a href="{{link '/quality_gates'}}">{{t 'quality_gates.page'}}</a> </li> <li class="dropdown"> 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 730fa5bac17..8a7935c8919 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 @@ -2,13 +2,43 @@ define([ 'templates/nav' ], function () { + var $ = jQuery; + return Marionette.ItemView.extend({ template: Templates['nav-context-navbar'], + modelEvents: { + 'change': 'render' + }, + + events: { + 'click .js-favorite': 'onFavoriteClick' + }, + onRender: function () { this.$('[data-toggle="tooltip"]').tooltip({ container: 'body' }); + }, + + onFavoriteClick: function () { + var that = this, + p = window.process.addBackgroundProcess(), + url = baseUrl + '/favourites/toggle/' + this.model.get('contextId'), + isContextFavorite = this.model.get('isContextFavorite'); + this.model.set({ isContextFavorite: !isContextFavorite }); + return $.post(url).done(function () { + window.process.finishBackgroundProcess(p); + }).fail(function () { + that.model.set({ isContextFavorite: isContextFavorite }); + window.process.failBackgroundProcess(p); + }); + }, + + serializeData: function () { + return _.extend(Marionette.Layout.prototype.serializeData.apply(this, arguments), { + canManageContextDashboards: window.SS.user != null + }); } }); diff --git a/server/sonar-web/src/main/js/nav/global-navbar-view.js b/server/sonar-web/src/main/js/nav/global-navbar-view.js index 7acb3ab2a9a..02c008d7592 100644 --- a/server/sonar-web/src/main/js/nav/global-navbar-view.js +++ b/server/sonar-web/src/main/js/nav/global-navbar-view.js @@ -21,7 +21,9 @@ define([ onRender: function () { var that = this; - this.$el.addClass('navbar-' + window.navbarSpace); + if (this.model.has('space')) { + this.$el.addClass('navbar-' + this.model.get('space')); + } this.$el.addClass('navbar-fade'); setTimeout(function () { that.$el.addClass('in'); @@ -34,19 +36,6 @@ define([ return false; }, - onFavoriteClick: function () { - var that = this, - p = window.process.addBackgroundProcess(), - url = baseUrl + '/favourites/toggle/' + window.navbarProjectId; - return $.post(url).done(function () { - that.isProjectFavorite = !that.isProjectFavorite; - that.render(); - window.process.finishBackgroundProcess(p); - }).fail(function () { - window.process.failBackgroundProcess(p); - }); - }, - onSearchDropdownShow: function () { var that = this; this.searchRegion.show(new SearchView({ diff --git a/server/sonar-web/src/main/less/navbar.less b/server/sonar-web/src/main/less/navbar.less index b2b3f8220be..ef44f654669 100644 --- a/server/sonar-web/src/main/less/navbar.less +++ b/server/sonar-web/src/main/less/navbar.less @@ -171,9 +171,19 @@ } } +.navbar-context-favorite { + float: left; + padding: 11px 0 11px 10px; +} + .navbar-context-meta { line-height: @navbarHeight; padding: 0 10px; color: @secondFontColor; font-size: @smallFontSize; } + + +.navbar-settings { + .horizontal-gradient(@navbarGlobalBackground, #7b1b1b); +} diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/_header.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/_header.html.erb index dc67eee948e..9d887ac38de 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/_header.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/_header.html.erb @@ -24,7 +24,6 @@ <%= link_to message('dashboard.configure_widgets'), dashboard_action(:configure), :class => 'button' -%> <% end %> <% end %> - <%= link_to message('dashboard.manage_dashboards'), {:controller => :dashboards, :action => :index, :resource => (@resource.id if @resource)}, :class => 'button' -%> </div> <% end %> </div> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar_conf_context.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar_conf_context.html.erb index 5b75a79d790..9835e33041a 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar_conf_context.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar_conf_context.html.erb @@ -13,6 +13,8 @@ contextKey: '<%= @project.key -%>', contextUuid: '<%= @project.uuid -%>', contextComparable: <%= controller.java_facade.getResourceTypeBooleanProperty(@project.qualifier, 'comparable') -%>, + canFavoriteContext: <%= logged_in? && displayed_resource && !display_only_root ? 'true' : 'false' -%>, + isContextFavorite: <%= logged_in? && current_user.favourite?(resource_id) ? 'true' : 'false' -%>, <% if @snapshot && @snapshot.version.present? %> contextVersion: '<%= @snapshot.version -%>', <% end %> 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 872507fd4cf..2b4321aac62 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -904,7 +904,7 @@ dependencies.not_used=Not used dashboard.cannot_render_widget_x=Can not render widget {0}: {1} dashboard.back_to_dashboard=Back to dashboard dashboard.configure_widgets=Configure widgets -dashboard.manage_dashboards=Manage dashboards +dashboard.manage_dashboards=Manage Dashboards dashboard.add_widget=Add widget dashboard.please_configure_the_widget_x=Please configure the widget <b>{0}</b>. dashboard.global_dashboards=Global Dashboards |