aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2011-05-06 14:41:02 +0200
committersimonbrandhof <simon.brandhof@gmail.com>2011-05-06 14:41:02 +0200
commitbecf970b28e8a285ccedf17c3da48c77b22c4d06 (patch)
treebb3c86020f0224e0603c35fafc16652177c404b9
parentcbea221c569d0edcd18f311a004e5e2dca80af51 (diff)
downloadsonarqube-becf970b28e8a285ccedf17c3da48c77b22c4d06.tar.gz
sonarqube-becf970b28e8a285ccedf17c3da48c77b22c4d06.zip
Do not display violations viewer on modules/directories if there are no violations
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/drilldown_controller.rb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/drilldown.rb11
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<<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