summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2011-11-03 12:09:07 +0100
committerSimon Brandhof <simon.brandhof@gmail.com>2011-11-03 12:09:19 +0100
commita0d25f507507367e957260d8e357286b736b423e (patch)
tree4530a83ca74475fb599b085801d2dfaef7b465d4
parent4a255dabb7b8cd29326c81480078e4c7011cd10d (diff)
downloadsonarqube-a0d25f507507367e957260d8e357286b736b423e.tar.gz
sonarqube-a0d25f507507367e957260d8e357286b736b423e.zip
SONAR-2963 fix l10n labels + fix vertical alignment
-rw-r--r--plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/it_coverage.html.erb24
-rw-r--r--plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties15
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/settings_controller.rb24
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/settings/_plugins.html.erb10
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 @@
%>
<table width="100%">
<tr>
- <td nowrap width="50%">
+ <td nowrap valign="top">
<div class="dashbox">
- <p class="title"><%= message('widget.it_coverage.name') -%></p>
+ <p class="title"><%= message('widget.it-coverage.name') -%></p>
<p>
<span class="big"><%= format_measure(coverage_measure, :suffix => '', :url => url_for_drilldown('it_coverage'), :default => '-') %></span>
<%= 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 %>
<p>
- <%= 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) -%>
</p>
<% end %>
<% it_branch_coverage=measure('it_branch_coverage')
if it_branch_coverage %>
<p>
- <%= 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) -%>
</p>
<% end %>
</div>
</td>
- <td nowrap>
+ <td nowrap valign="top">
<div class="dashbox">
<%
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')
%>
- <h3><%= message('widget.it_coverage.on_new_code') -%>: </h3>
+ <h3><%= message('widget.it-coverage.on_new_code') -%>: </h3>
<% if new_lines.to_i==0 %>
- <p><%= message('widget.it_coverage.no_new_lines_to_cover') -%></p>
+ <p><%= message('widget.it-coverage.no_new_lines_to_cover') -%></p>
<% else %>
<% if new_coverage %>
<p>
- <span class="big"><a href="<%= url_for_drilldown('new_it_coverage', :period => dashboard_configuration.period_index) -%>"><%= format_variation(new_coverage, :style => 'none', :default => '-') -%></a></span>
+ <span class="big">
+ <a href="<%= url_for_drilldown('new_it_coverage', :period => dashboard_configuration.period_index) -%>"><%= format_variation(new_coverage, :style => 'none', :default => '-') -%></a>
+ </span>
</p>
<% end %>
<p>
- <a href="<%= url_for_drilldown('new_it_lines_to_cover', :period => dashboard_configuration.period_index) -%>"><%= format_variation(new_lines_to_cover_measure, :style => 'none', :default => '-') -%><%= message('widget.it_coverage.lines_to_cover.suffix') -%></a>
+ <a href="<%= url_for_drilldown('new_it_lines_to_cover', :period => dashboard_configuration.period_index) -%>"><%= format_variation(new_lines_to_cover_measure, :style => 'none', :default => '-') -%><%= message('widget.it-coverage.lines_to_cover.suffix') -%></a>
</p>
<% if new_line_coverage %>
<p>
- <a href="<%= url_for_drilldown('new_it_uncovered_lines', :highlight => 'new_it_line_coverage', :period => dashboard_configuration.period_index) -%>"><%= format_variation(new_line_coverage, :style => 'none', :default => '-') -%><%= message('widget.it_coverage.line_coverage.suffix') -%></a>
+ <a href="<%= url_for_drilldown('new_it_uncovered_lines', :highlight => 'new_it_line_coverage', :period => dashboard_configuration.period_index) -%>"><%= format_variation(new_line_coverage, :style => 'none', :default => '-') -%><%= message('widget.it-coverage.line_coverage.suffix') -%></a>
</p>
<% end %>
<% if new_branch_coverage %>
<p>
- <a href="<%= url_for_drilldown('new_it_uncovered_conditions', :highlight => 'new_it_branch_coverage', :period => dashboard_configuration.period_index) -%>"><%= format_variation(new_branch_coverage, :style => 'none', :default => '-') -%><%= message('widget.it_coverage.branch_coverage.suffix') -%></a>
+ <a href="<%= url_for_drilldown('new_it_uncovered_conditions', :highlight => 'new_it_branch_coverage', :period => dashboard_configuration.period_index) -%>"><%= format_variation(new_branch_coverage, :style => 'none', :default => '-') -%><%= message('widget.it-coverage.branch_coverage.suffix') -%></a>
</p>
<%
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]<<property
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_plugins.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_plugins.html.erb
index ec7db02725e..354a6ed9561 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_plugins.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_plugins.html.erb
@@ -106,12 +106,10 @@
<% textarea = text_area_tag property.key(), value, :size => "100x10" %>
<span id="<%= span_id %>"><%= (value.length < 50) ? textfield : textarea %></span>
- <% unless property.defaultValue().blank? %>
- <% if @project %>
- <span class="note">Default : <%= h Property.value(property.key(), nil, property.defaultValue()) -%></span>
- <% else %>
- <span class="note">Default : <%= h property.defaultValue() -%></span>
- <% end %>
+ <%
+ default_prop_value = (@project ? Property.value(property.key(), nil, property.defaultValue()) : property.defaultValue())
+ unless default_prop_value.blank? %>
+ <span class="note">Default : <%= h default_prop_value -%></span>
<% end %>
</p>
</td>