diff options
author | David Gageot <david@gageot.net> | 2012-10-10 09:14:07 +0200 |
---|---|---|
committer | David Gageot <david@gageot.net> | 2012-10-10 09:14:17 +0200 |
commit | 92da0a8b2b2cad6e4604b646451a2a3ed3a67461 (patch) | |
tree | 61d3963ffdf323a4318360d8dbe46aa4547a49e1 | |
parent | 933b61b9b7cdb4be8d4299770369f1faf1bb6ca6 (diff) | |
download | sonarqube-92da0a8b2b2cad6e4604b646451a2a3ed3a67461.tar.gz sonarqube-92da0a8b2b2cad6e4604b646451a2a3ed3a67461.zip |
SONAR-2804 Restore metric id for its
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/app/helpers/resource_helper.rb | 19 | ||||
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/app/views/resource/_header_coverage.html.erb | 4 |
2 files changed, 17 insertions, 6 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 5e24b86ca92..03816ed9f08 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 @@ -20,15 +20,26 @@ module ResourceHelper DUPLICATION_SNIPPET_DEFAULT_NB_OF_LINES = 6 - def format(new, prefix, measure_name) + def format(new, prefix, measure_name, options = {}) if new - format_variation(measure('new_' + prefix + measure_name), :period => @period, :default => '-', :style => 'none') + key = 'new_' + prefix + measure_name + value = format_variation(measure(key), :period => @period, :default => '-', :style => 'none') else - measure(prefix + measure_name).formatted_value + key = prefix + measure_name + value = measure(key).formatted_value + end + + if options[:span] + "<span id=\"m_#{key}\">#{value}</span>" + else + value end end 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) + ')' + value1 = format(new, prefix, measure_name1) + value2 = format(new, prefix, measure_name2) + + '(' + (value1.to_i - value2.to_i).to_s + '/' + value1 + ')' 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 14c94701730..d222fd2f510 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 @@ -9,7 +9,7 @@ <% [('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: 60px;"><%= format(new, prefix, 'coverage') -%></td> + <td class="right big" style="width: 60px;"><%= format(new, prefix, 'coverage', :span => true) -%></td> <td></td> <td class="name"><%= h Metric.name_for('line_coverage') -%>:</td> <td class="value"> @@ -23,7 +23,7 @@ <%= format_ratio(new, prefix, 'conditions_to_cover', 'uncovered_conditions') -%> </td> <% else -%> - <td class="right value"><%= format(new, prefix, 'coverage') -%></td> + <td class="right value"><%= format(new, prefix, 'coverage', :span => true) -%></td> <td><%= message(prefix + 'coverage_viewer.by') -%></td> <td colspan="2"></td> <td class="sep"></td> |