From feeba2c324912d9129cc6f357aeb7de7cb3c1502 Mon Sep 17 00:00:00 2001 From: David Gageot Date: Tue, 9 Oct 2012 19:07:38 +0200 Subject: [PATCH] SONAR-2804 More compact GUI --- .../WEB-INF/app/helpers/resource_helper.rb | 4 ++-- .../views/resource/_header_coverage.html.erb | 17 ++++++----------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/resource_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/resource_helper.rb index 7a577eccb60..5e24b86ca92 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/resource_helper.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/resource_helper.rb @@ -28,7 +28,7 @@ module ResourceHelper end end - def format_difference(new, prefix, measure_name1, measure_name2) - format(new, prefix, measure_name1).to_i - format(new, prefix, measure_name2).to_i + def format_ratio(new, prefix, measure_name1, measure_name2) + '(' + (format(new, prefix, measure_name1).to_i - format(new, prefix, measure_name2).to_i).to_s + '/' + format(new, prefix, measure_name1) + ')' end end \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_header_coverage.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_header_coverage.html.erb index 3d31c1d296f..14c94701730 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_header_coverage.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_header_coverage.html.erb @@ -2,33 +2,29 @@ <% new = @period && (measure('new_coverage') || measure('new_it_coverage') || measure('new_overall_coverage')) %> <% if new -%> -

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

+

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

<% end -%> <% [('overall_' if @display_overall_coverage), '', ('it_' if @display_it_coverage)].compact.each_with_index do |prefix, index| -%> <% if index == 0 -%> - + - <% else -%> - + - @@ -38,5 +34,4 @@
<%= format(new, prefix, 'coverage') -%><%= format(new, prefix, 'coverage') -%> <%= h Metric.name_for('line_coverage') -%>: <%= format(new, prefix, 'line_coverage') -%> - (<%= format_difference(new, prefix, 'lines_to_cover', 'uncovered_lines') -%> - / <%= format(new, prefix, 'lines_to_cover') -%>) + <%= format_ratio(new, prefix, 'lines_to_cover', 'uncovered_lines') -%> <%= h Metric.name_for('branch_coverage') -%>: <%= format(new, prefix, 'branch_coverage') -%> - (<%= format_difference(new, prefix, 'conditions_to_cover', 'uncovered_conditions') -%> - / <%= format(new, prefix, 'conditions_to_cover') -%>) + <%= format_ratio(new, prefix, 'conditions_to_cover', 'uncovered_conditions') -%> <%= format(new, prefix, 'coverage') -%><%= format(new, prefix, 'coverage') -%> <%= message(prefix + 'coverage_viewer.by') -%>
<%= render :partial => 'options' -%> - - + \ No newline at end of file -- 2.39.5