]> source.dussan.org Git - sonarqube.git/commitdiff
Improve breadcrumb for drilldown pages
authorEvgeny Mandrikov <mandrikov@gmail.com>
Mon, 13 Feb 2012 13:09:32 +0000 (17:09 +0400)
committerEvgeny Mandrikov <mandrikov@gmail.com>
Mon, 13 Feb 2012 13:28:39 +0000 (17:28 +0400)
sonar-server/src/main/webapp/WEB-INF/app/controllers/drilldown_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/models/drilldown.rb

index 700160f9df27ae9a432209b3506aa2060f7ec49b..a194e70a31bdb59fcfe0be31615699c8714d26b6 100644 (file)
@@ -60,7 +60,6 @@ class DrilldownController < ApplicationController
 
     # load data
     @drilldown = Drilldown.new(@project, @metric, selected_rids, options)
-    @snapshot = @drilldown.snapshot
     access_denied unless has_role?(:user, @snapshot)
 
     @highlighted_resource=@drilldown.highlighted_resource
@@ -113,7 +112,6 @@ class DrilldownController < ApplicationController
 
     # load data
     @drilldown = Drilldown.new(@project, @metric, @selected_rids, options)
-    @snapshot=@drilldown.snapshot
     access_denied unless has_role?(:user, @snapshot)
 
     @highlighted_resource=@drilldown.highlighted_resource
@@ -150,6 +148,7 @@ class DrilldownController < ApplicationController
     @project = project_key ? Project.by_key(project_key) : nil
     # For security reasons, we must not return 404 not found. It would be an information that the resource exists.
     not_found("Resource not found") unless @project
+    @snapshot = @project.last_snapshot
   end
 
   def select_metric(metric_key, default_key)
index c6c4198a4c18b0f1d4855fa5001fe40ed10fbcf7..55bebdb4a2c28bc41aabb7b679d24c2c621cfe18 100644 (file)
@@ -22,7 +22,7 @@ class Drilldown
 
   def initialize(resource, metric, selected_resource_ids, options={})
     @resource=resource
-    @snapshot=Snapshot.find(:first, :conditions => {:islast => true, :project_id => resource.id}, :include => [:project])
+    @snapshot=resource.last_snapshot
     @metric=metric
     @columns=[]