]> git.openstreetmap.org Git - rails.git/blob - app/controllers/browse_controller.rb
Remove a rescue, which is stopping a more detailed error message being returned to...
[rails.git] / app / controllers / browse_controller.rb
1 class BrowseController < ApplicationController
2   layout 'site'
3
4   before_filter :authorize_web  
5   before_filter { |c| c.check_database_readable(true) }
6
7   def start 
8   end
9   
10   
11   
12   def relation
13     @relation = Relation.find(params[:id])
14     @next = Relation.find(:first, :order => "id ASC", :conditions => [ "visible = true AND id > :id", { :id => @relation.id }] )
15     @prev = Relation.find(:first, :order => "id DESC", :conditions => [ "visible = true AND id < :id", { :id => @relation.id }] )
16   rescue ActiveRecord::RecordNotFound
17     @type = "relation"
18     render :action => "not_found", :status => :not_found
19   end
20   
21   def relation_history
22     @relation = Relation.find(params[:id])
23   rescue ActiveRecord::RecordNotFound
24     @type = "relation"
25     render :action => "not_found", :status => :not_found
26   end
27   
28   def way
29     @way = Way.find(params[:id])
30     @next = Way.find(:first, :order => "id ASC", :conditions => [ "visible = true AND id > :id", { :id => @way.id }] )
31     @prev = Way.find(:first, :order => "id DESC", :conditions => [ "visible = true AND id < :id", { :id => @way.id }] )
32   rescue ActiveRecord::RecordNotFound
33     @type = "way"
34     render :action => "not_found", :status => :not_found
35   end
36   
37   def way_history
38     @way = Way.find(params[:id])
39   rescue ActiveRecord::RecordNotFound
40     @type = "way"
41     render :action => "not_found", :status => :not_found
42   end
43
44   def node
45     @node = Node.find(params[:id])
46     @next = Node.find(:first, :order => "id ASC", :conditions => [ "visible = true AND id > :id", { :id => @node.id }] )
47     @prev = Node.find(:first, :order => "id DESC", :conditions => [ "visible = true AND id < :id", { :id => @node.id }] )
48   rescue ActiveRecord::RecordNotFound
49     @type = "node"
50     render :action => "not_found", :status => :not_found
51   end
52   
53   def node_history
54     @node = Node.find(params[:id])
55   rescue ActiveRecord::RecordNotFound
56     @type = "way"
57     render :action => "not_found", :status => :not_found
58   end
59   
60   def changeset
61     @changeset = Changeset.find(params[:id])
62     @node_pages, @nodes = paginate(:old_nodes, :conditions => {:changeset_id => @changeset.id}, :per_page => 20, :parameter => 'node_page')
63     @way_pages, @ways = paginate(:old_ways, :conditions => {:changeset_id => @changeset.id}, :per_page => 20, :parameter => 'way_page')
64     @relation_pages, @relations = paginate(:old_relations, :conditions => {:changeset_id => @changeset.id}, :per_page => 20, :parameter => 'relation_page')
65       
66     @title = "Changeset | #{@changeset.id}"
67     @next = Changeset.find(:first, :order => "id ASC", :conditions => [ "id > :id", { :id => @changeset.id }] ) 
68     @prev = Changeset.find(:first, :order => "id DESC", :conditions => [ "id < :id", { :id => @changeset.id }] ) 
69   rescue ActiveRecord::RecordNotFound
70     @type = "changeset"
71     render :action => "not_found", :status => :not_found
72   end
73 end