]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-4117 The '%' character is not displayed in Measure Filters on measures relating...
authorJulien Lancelot <julien.lancelot@gmail.com>
Mon, 18 Mar 2013 17:02:27 +0000 (18:02 +0100)
committerJulien Lancelot <julien.lancelot@gmail.com>
Mon, 18 Mar 2013 17:02:27 +0000 (18:02 +0100)
sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb
sonar-server/src/main/webapp/WEB-INF/app/helpers/measures_helper.rb
sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb

index bba7078ee5b55705fe54ec7ca062b31264bf701c..7dd872800431c188f7ba0494cc6a0a813ceaa37b 100644 (file)
@@ -436,6 +436,7 @@ module ApplicationHelper
   # * color: true|false. Default is true.
   # * period: integer between 1 and 5. By default the index is defined by the dashboard variation select-box
   # * style: light|normal|none. Default is normal (parenthesis + bold)
+  # * variation: true|false. Default is true.
   #
   # === Examples
   # format_variation('ncloc')
@@ -455,7 +456,8 @@ module ApplicationHelper
           return m.format_numeric_value(val)
         end
 
-        formatted_val= m.format_numeric_value(val, :variation => true)
+        variation = !options[:variation].nil? ? options[:variation] : true
+        formatted_val= m.format_numeric_value(val, :variation => variation)
         css_class=''
         if options[:color]||true
           css_class='var'
index 14e18b37495a8975f5c3fc61613317a15ff6c89b..0d0b3af4d4f4806d0f93df54a3eabfdbb9fe5fb9 100644 (file)
@@ -38,7 +38,7 @@ module MeasuresHelper
     if column.metric
       measure = row.measure(column.metric)
       if column.period
-        format_variation(measure, :index => column.period, :style => 'light')
+        format_variation(measure, :index => column.period, :style => 'light', :variation => false)
       elsif column.metric.numeric?
         format_measure(measure) + ' ' + trend_icon(measure, :empty => true)
       else
index 2e67489889dae9a83a0ffd5946d993f512b7f75e..1b02d4930629c5ea4b1f8904f1ee55afd5dbc226 100644 (file)
@@ -77,24 +77,24 @@ class ProjectMeasure < ActiveRecord::Base
     end
 
     case metric().val_type
-    when Metric::VALUE_TYPE_INT
-      number_with_precision(value(), :precision => 0)
-    when Metric::VALUE_TYPE_FLOAT
-      number_with_precision(value(), :precision => 1)
-    when Metric::VALUE_TYPE_PERCENT
-      number_to_percentage(value(), {:precision => 1})
-    when Metric::VALUE_TYPE_MILLISEC
-      millisecs_formatted_value( value() )
-    when Metric::VALUE_TYPE_BOOLEAN
-      value() == 1 ? 'Yes' : 'No'
-    when Metric::VALUE_TYPE_LEVEL
-      text_value
-    when Metric::VALUE_TYPE_STRING
-      text_value
-    when Metric::VALUE_TYPE_RATING
-      text_value || value.to_i.to_s
-    else
-      value().to_s
+      when Metric::VALUE_TYPE_INT
+        number_with_precision(value(), :precision => 0)
+      when Metric::VALUE_TYPE_FLOAT
+        number_with_precision(value(), :precision => 1)
+      when Metric::VALUE_TYPE_PERCENT
+        number_to_percentage(value(), {:precision => 1})
+      when Metric::VALUE_TYPE_MILLISEC
+        millisecs_formatted_value( value() )
+      when Metric::VALUE_TYPE_BOOLEAN
+        value() == 1 ? 'Yes' : 'No'
+      when Metric::VALUE_TYPE_LEVEL
+        text_value
+      when Metric::VALUE_TYPE_STRING
+        text_value
+      when Metric::VALUE_TYPE_RATING
+        text_value || value.to_i.to_s
+      else
+        value().to_s
     end
   end
 
@@ -104,20 +104,20 @@ class ProjectMeasure < ActiveRecord::Base
     end
 
     case metric().val_type
-    when Metric::VALUE_TYPE_INT
-      number_with_precision(val, :precision => 0)
-    when Metric::VALUE_TYPE_FLOAT
-      number_with_precision(val, :precision => 1)
-    when Metric::VALUE_TYPE_PERCENT
+      when Metric::VALUE_TYPE_INT
+        number_with_precision(val, :precision => 0)
+      when Metric::VALUE_TYPE_FLOAT
+        number_with_precision(val, :precision => 1)
+      when Metric::VALUE_TYPE_PERCENT
         if (options[:variation]==true)
           number_with_precision(val, :precision => 1)
         else
           number_to_percentage(val, {:precision => 1})
         end
-    when Metric::VALUE_TYPE_MILLISEC
-      millisecs_formatted_value(val)
-    else
-      val.to_s
+      when Metric::VALUE_TYPE_MILLISEC
+        millisecs_formatted_value(val)
+      else
+        val.to_s
     end
   end