]> source.dussan.org Git - sonarqube.git/commitdiff
Do not display violations viewer on modules/directories if there are no violations
authorsimonbrandhof <simon.brandhof@gmail.com>
Fri, 6 May 2011 12:41:02 +0000 (14:41 +0200)
committersimonbrandhof <simon.brandhof@gmail.com>
Fri, 6 May 2011 12:41:02 +0000 (14:41 +0200)
sonar-server/src/main/webapp/WEB-INF/app/controllers/drilldown_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/models/drilldown.rb

index a64ef97622f7f07b91372c36dca51b75df212703..ab1a1d13d01db4f386d1d6017e3cf89da18dc556 100644 (file)
@@ -114,7 +114,7 @@ class DrilldownController < ApplicationController
       @highlighted_resource=@project
     end
 
-    @display_viewers=display_violation_viewers?(@snapshot)
+    @display_viewers=display_violation_viewers?(@drilldown.highlighted_snapshot || @snapshot)
   end
 
   private
index dc527ee5340d11703f39980ad2e314928374ea38..c7eec4c6bad42f641dd8dcbb2980b5a621aa913a 100644 (file)
@@ -18,7 +18,7 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02
 #
 class Drilldown
-  attr_reader :snapshot, :columns, :metric, :resource
+  attr_reader :snapshot, :columns, :metric, :resource, :highlighted_resource, :highlighted_snapshot
 
   def initialize(resource, metric, selected_resource_ids, options={})
     @resource=resource
@@ -31,14 +31,13 @@ class Drilldown
       snapshot = (column ? column.next_snapshot : @snapshot)
       column=DrilldownColumn.new(snapshot, metric, Project::SCOPES[index], selected_resource_ids, options)
       @columns<<column if column.display?
-      @highlighted_resource=column.selected_snapshot.project if column.selected_snapshot
+      if column.selected_snapshot
+        @highlighted_snapshot=column.selected_snapshot
+        @highlighted_resource=column.selected_snapshot.project         
+      end
     end
   end
 
-  def highlighted_resource
-    @highlighted_resource
-  end
-
   def display_value?
     ProjectMeasure.exists?(["snapshot_id=? and metric_id=? and value is not null", @snapshot.id, @metric.id])
   end