From a0d25f507507367e957260d8e357286b736b423e Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Thu, 3 Nov 2011 12:09:07 +0100 Subject: SONAR-2963 fix l10n labels + fix vertical alignment --- .../plugins/core/widgets/it_coverage.html.erb | 24 ++++++++++++---------- .../main/resources/org/sonar/l10n/core.properties | 15 +++++++------- .../WEB-INF/app/controllers/settings_controller.rb | 24 +++++++++++----------- .../WEB-INF/app/views/settings/_plugins.html.erb | 10 ++++----- 4 files changed, 37 insertions(+), 36 deletions(-) diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/it_coverage.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/it_coverage.html.erb index 0ac037516ff..050cb2d8e98 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/it_coverage.html.erb +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/it_coverage.html.erb @@ -4,9 +4,9 @@ %> - - -- cgit v1.2.3
+
-

<%= message('widget.it_coverage.name') -%>

+

<%= message('widget.it-coverage.name') -%>

<%= format_measure(coverage_measure, :suffix => '', :url => url_for_drilldown('it_coverage'), :default => '-') %> <%= dashboard_configuration.selected_period? ? format_variation(coverage_measure) : trend_icon(coverage_measure) -%> @@ -14,20 +14,20 @@ <% it_line_coverage=measure('it_line_coverage') if it_line_coverage %>

- <%= format_measure(it_line_coverage, :suffix => message('widget.it_coverage.line_coverage.suffix'), :url => url_for_drilldown('it_uncovered_lines', :highlight => 'it_line_coverage')) %> + <%= format_measure(it_line_coverage, :suffix => message('widget.it-coverage.line_coverage.suffix'), :url => url_for_drilldown('it_uncovered_lines', :highlight => 'it_line_coverage')) %> <%= dashboard_configuration.selected_period? ? format_variation(it_line_coverage) : trend_icon(it_line_coverage) -%>

<% end %> <% it_branch_coverage=measure('it_branch_coverage') if it_branch_coverage %>

- <%= format_measure(it_branch_coverage, :suffix => message('widget.it_coverage.branch_coverage.suffix'), :url => url_for_drilldown('it_uncovered_conditions', :highlight => 'it_branch_coverage')) %> + <%= format_measure(it_branch_coverage, :suffix => message('widget.it-coverage.branch_coverage.suffix'), :url => url_for_drilldown('it_uncovered_conditions', :highlight => 'it_branch_coverage')) %> <%= dashboard_configuration.selected_period? ? format_variation(it_branch_coverage) : trend_icon(it_branch_coverage) -%>

<% end %>
+
<% if dashboard_configuration.selected_period? @@ -39,26 +39,28 @@ new_line_coverage=measure('new_it_line_coverage') new_branch_coverage=measure('new_it_branch_coverage') %> -

<%= message('widget.it_coverage.on_new_code') -%>:

+

<%= message('widget.it-coverage.on_new_code') -%>:

<% if new_lines.to_i==0 %> -

<%= message('widget.it_coverage.no_new_lines_to_cover') -%>

+

<%= message('widget.it-coverage.no_new_lines_to_cover') -%>

<% else %> <% if new_coverage %>

- <%= format_variation(new_coverage, :style => 'none', :default => '-') -%> + + <%= format_variation(new_coverage, :style => 'none', :default => '-') -%> +

<% end %>

- <%= format_variation(new_lines_to_cover_measure, :style => 'none', :default => '-') -%><%= message('widget.it_coverage.lines_to_cover.suffix') -%> + <%= format_variation(new_lines_to_cover_measure, :style => 'none', :default => '-') -%><%= message('widget.it-coverage.lines_to_cover.suffix') -%>

<% if new_line_coverage %>

- <%= format_variation(new_line_coverage, :style => 'none', :default => '-') -%><%= message('widget.it_coverage.line_coverage.suffix') -%> + <%= format_variation(new_line_coverage, :style => 'none', :default => '-') -%><%= message('widget.it-coverage.line_coverage.suffix') -%>

<% end %> <% if new_branch_coverage %>

- <%= format_variation(new_branch_coverage, :style => 'none', :default => '-') -%><%= message('widget.it_coverage.branch_coverage.suffix') -%> + <%= format_variation(new_branch_coverage, :style => 'none', :default => '-') -%><%= message('widget.it-coverage.branch_coverage.suffix') -%>

<% end diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties index e25642d4c48..c12cdf73223 100644 --- a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties +++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties @@ -464,13 +464,14 @@ widget.code_coverage.errors.suffix=\ errors widget.code_coverage.tests.suffix=\ tests widget.code_coverage.skipped.suffix=\ skipped -widget.it_coverage.name=Integration Test Coverage -widget.it_coverage.description=Reports code coverage by integration tests -widget.it_coverage.line_coverage.suffix=\ line coverage -widget.it_coverage.branch_coverage.suffix=\ branch coverage -widget.it_coverage.lines_to_cover.suffix=\ lines to cover -widget.it_coverage.on_new_code=On new code -widget.it_coverage.no_new_lines_to_cover=No new lines to cover +# id of this widget does not use underscore in order to be backward-compatible with previous version of JaCoCo plugin +widget.it-coverage.name=Integration Test Coverage +widget.it-coverage.description=Reports on code coverage by integration tests +widget.it-coverage.line_coverage.suffix=\ line coverage +widget.it-coverage.branch_coverage.suffix=\ branch coverage +widget.it-coverage.lines_to_cover.suffix=\ lines to cover +widget.it-coverage.on_new_code=On new code +widget.it-coverage.no_new_lines_to_cover=No new lines to cover widget.comments_duplications.name=Comments & Duplications diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/settings_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/settings_controller.rb index 57108dc01e9..5c688d42a8e 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/settings_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/settings_controller.rb @@ -27,44 +27,42 @@ class SettingsController < ApplicationController def index access_denied unless is_admin? - load_properties(false) + load_properties(nil) @category ||= 'general' end def update + project=nil if params[:resource_id] project=Project.by_key(params[:resource_id]) access_denied unless (project && is_admin?(project)) - resource_id=project.id else access_denied unless is_admin? - resource_id=nil end - load_properties(true) + load_properties(project) if @category && @properties_per_category[@category] @properties_per_category[@category].each do |property| value=params[property.key()] - persisted_property = Property.find(:first, :conditions => {:prop_key=> property.key(), :resource_id => resource_id, :user_id => nil}) - + persisted_property = Property.find(:first, :conditions => {:prop_key=> property.key(), :resource_id => (project ? project.id : nil), :user_id => nil}) if persisted_property if value.empty? - Property.delete_all('prop_key' => property.key(), 'resource_id' => resource_id, 'user_id' => nil) + Property.delete_all('prop_key' => property.key(), 'resource_id' => (project ? project.id : nil), 'user_id' => nil) elsif persisted_property.text_value != value.to_s persisted_property.text_value = value.to_s persisted_property.save! end elsif !value.blank? - Property.create(:prop_key => property.key(), :text_value => value.to_s, :resource_id => resource_id) + Property.create(:prop_key => property.key(), :text_value => value.to_s, :resource_id => (project ? project.id : nil)) end end java_facade.reloadConfiguration() flash[:notice] = 'Parameters updated' end - if resource_id - redirect_to :controller => 'project', :action => 'settings', :id => resource_id, :category => @category + if project + redirect_to :controller => 'project', :action => 'settings', :id => project.id, :category => @category else redirect_to :controller => 'settings', :action => 'index', :category => @category end @@ -72,11 +70,13 @@ class SettingsController < ApplicationController private - def load_properties(all=true) + def load_properties(project) @category=params[:category] @properties_per_category={} definitions = java_facade.getPropertyDefinitions() - definitions.getProperties().select {|property| property.global}.each do |property| + definitions.getProperties().select {|property| + (project.nil? && property.global) || (project && project.module? && property.module()) || (project && project.project? && property.project()) + }.each do |property| category = definitions.getCategory(property.key()) @properties_per_category[category]||=[] @properties_per_category[category]< "100x10" %> <%= (value.length < 50) ? textfield : textarea %> - <% unless property.defaultValue().blank? %> - <% if @project %> - Default : <%= h Property.value(property.key(), nil, property.defaultValue()) -%> - <% else %> - Default : <%= h property.defaultValue() -%> - <% end %> + <% + default_prop_value = (@project ? Property.value(property.key(), nil, property.defaultValue()) : property.defaultValue()) + unless default_prop_value.blank? %> + Default : <%= h default_prop_value -%> <% end %>