]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/browse_controller.rb
Merge branch 'master' into openstreetbugs
[rails.git] / app / controllers / browse_controller.rb
index 5c7912d154ec12a73769c6a41d8ee9de4e5021db..d9b18769c37b934d8f77038c5884ee23418c9fe3 100644 (file)
@@ -78,13 +78,28 @@ class BrowseController < ApplicationController
     render :action => "not_found", :status => :not_found
   end
 
+  def bug
+    @type = "bug"
+    @bug = MapBug.find(params[:id])
+    @next = MapBug.find(:first, :order => "id ASC", :conditions => [ "status != 'hidden' AND id > :id", { :id => @bug.id }] )
+    @prev = MapBug.find(:first, :order => "id DESC", :conditions => [ "status != 'hidden' AND id < :id", { :id => @bug.id }] )
+  rescue ActiveRecord::RecordNotFound
+    render :action => "not_found", :status => :not_found
+  end
+
 private
 
   def timeout
     SystemTimer.timeout_after(30) do
       yield
     end
+  rescue ActionView::TemplateError => ex
+    if ex.original_exception.is_a?(Timeout::Error)
+      render :action => "timeout"
+    else
+      raise
+    end
   rescue Timeout::Error
-    render :action => "timeout", :status => :request_timeout
+    render :action => "timeout"
   end
 end