]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2804 More compact GUI
authorDavid Gageot <david@gageot.net>
Tue, 9 Oct 2012 17:07:38 +0000 (19:07 +0200)
committerDavid Gageot <david@gageot.net>
Tue, 9 Oct 2012 17:12:03 +0000 (19:12 +0200)
sonar-server/src/main/webapp/WEB-INF/app/helpers/resource_helper.rb
sonar-server/src/main/webapp/WEB-INF/app/views/resource/_header_coverage.html.erb

index 7a577eccb604c7985c522f8ed0f896183491d46f..5e24b86ca92d091c2ea514e3232e748a337020c0 100644 (file)
@@ -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
index 3d31c1d296f2fb1d2a1ab0f29435066a055dbfd1..14c947017301911bb340a9dfe3f342f8c74c2428 100644 (file)
@@ -2,33 +2,29 @@
   <% new = @period && (measure('new_coverage') || measure('new_it_coverage') || measure('new_overall_coverage')) %>
 
   <% if new -%>
-    <p><%= message('coverage_viewer.on_new_code') -%> :</p>
+    <p><%= message('coverage_viewer.on_new_code') -%>:</p>
   <% end -%>
 
   <table class="coverage">
     <% [('overall_' if @display_overall_coverage), '', ('it_' if @display_it_coverage)].compact.each_with_index do |prefix, index| -%>
       <tr>
         <% if index == 0 -%>
-          <td class="right big" style="width: 80px;"><%= format(new, prefix, 'coverage') -%></td>
+          <td class="right big" style="width: 60px;"><%= format(new, prefix, 'coverage') -%></td>
           <td></td>
-          <td class="sep"></td>
           <td class="name"><%= h Metric.name_for('line_coverage') -%>:</td>
           <td class="value">
             <%= 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') -%>
           </td>
           <td class="sep"></td>
           <td class="name"><%= h Metric.name_for('branch_coverage') -%>:</td>
           <td class="value">
             <%= 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') -%>
           </td>
         <% else -%>
-          <td class="right"><%= format(new, prefix, 'coverage') -%></td>
+          <td class="right value"><%= format(new, prefix, 'coverage') -%></td>
           <td><%= message(prefix + 'coverage_viewer.by') -%></td>
-          <td class="sep"></td>
           <td colspan="2"></td>
           <td class="sep"></td>
           <td colspan="2"></td>
@@ -38,5 +34,4 @@
   </table>
 
   <%= render :partial => 'options' -%>
-</div>
-
+</div>
\ No newline at end of file