From 84701fd752cba8d48aa98a63c171c574d599622d Mon Sep 17 00:00:00 2001 From: simonbrandhof Date: Fri, 18 Mar 2011 10:53:21 +0100 Subject: [PATCH] Filters page : change the rendering of coverage on new code --- sonar-server/src/main/webapp/WEB-INF/app/models/metric.rb | 8 ++++++++ .../main/webapp/WEB-INF/app/views/filters/_list.html.erb | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/metric.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/metric.rb index d4bb9b2f58e..43411eb8b8d 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/metric.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/metric.rb @@ -202,6 +202,14 @@ class Metric < ActiveRecord::Base enabled && !hidden && numeric? && !domain.blank? end + # temporary method since 2.7. Will replace it by a field in database. + def on_new_code? + @on_new_code ||= + begin + key.start_with?('new_') + end + end + def to_xml(options={}) xml = Builder::XmlMarkup.new xml.metric do diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_list.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_list.html.erb index 0534200ef9b..a09b2851798 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_list.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_list.html.erb @@ -100,7 +100,7 @@ measure = @filter_context.measure(snapshot, column.metric) %> <% if column.variation %> - <%= format_variation(measure, :index => @filter_context.period_index, :style => 'light') -%> + <%= format_variation(measure, :index => @filter_context.period_index, :style => (column.metric.on_new_code? ? 'none' : 'light')) -%> <% else %> <%= format_measure(measure) -%> <% if @filter_context.selected_period? %> -- 2.39.5