From becf970b28e8a285ccedf17c3da48c77b22c4d06 Mon Sep 17 00:00:00 2001 From: simonbrandhof Date: Fri, 6 May 2011 14:41:02 +0200 Subject: [PATCH] Do not display violations viewer on modules/directories if there are no violations --- .../WEB-INF/app/controllers/drilldown_controller.rb | 2 +- .../src/main/webapp/WEB-INF/app/models/drilldown.rb | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/drilldown_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/drilldown_controller.rb index a64ef97622f..ab1a1d13d01 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/drilldown_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/drilldown_controller.rb @@ -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 diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/drilldown.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/drilldown.rb index dc527ee5340..c7eec4c6bad 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/drilldown.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/drilldown.rb @@ -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<