]> git.openstreetmap.org Git - rails.git/blob - app/controllers/browse_controller.rb
Add support for relation history.
[rails.git] / app / controllers / browse_controller.rb
1 class BrowseController < ApplicationController
2   before_filter :authorize_web  
3   layout 'site'
4
5   def relation_view 
6     begin
7       @relation = Relation.find(params[:id])
8      
9       @name = @relation.tags['name'].to_s 
10       if @name.length == 0:
11         @name = "#" + @relation.id.to_s
12       end
13         
14       @title = 'Relation | ' + (@name)
15     rescue ActiveRecord::RecordNotFound
16       render :nothing => true, :status => :not_found
17     end
18   end
19   
20   def relation_history
21     begin
22       @relation = Relation.find(params[:id])
23      
24       @name = @relation.tags['name'].to_s 
25       if @name.length == 0:
26         @name = "#" + @relation.id.to_s
27       end
28         
29       @title = 'Relation History | ' + (@name)
30     rescue ActiveRecord::RecordNotFound
31       render :nothing => true, :status => :not_found
32     end
33   end
34   
35   def way_view 
36     begin
37       @way = Way.find(params[:id])
38      
39       @name = @way.tags['name'].to_s 
40       if @name.length == 0:
41         @name = "#" + @way.id.to_s
42       end
43         
44       @title = 'Way | ' + (@name)
45     rescue ActiveRecord::RecordNotFound
46       render :nothing => true, :status => :not_found
47     end
48   end
49   
50   def way_history 
51     begin
52       @way = Way.find(params[:id])
53      
54       @name = @way.tags['name'].to_s 
55       if @name.length == 0:
56         @name = "#" + @way.id.to_s
57       end
58         
59       @title = 'Way History | ' + (@name)
60     rescue ActiveRecord::RecordNotFound
61       render :nothing => true, :status => :not_found
62     end
63   end
64
65   def node_view 
66     begin
67       @node = Node.find(params[:id])
68      
69       @name = @node.tags_as_hash['name'].to_s 
70       if @name.length == 0:
71         @name = "#" + @node.id.to_s
72       end
73         
74       @title = 'Node | ' + (@name)
75     rescue ActiveRecord::RecordNotFound
76       render :nothing => true, :status => :not_found
77     end
78   end
79   
80   def node_history 
81     begin
82       @node = Node.find(params[:id])
83      
84       @name = @node.tags_as_hash['name'].to_s 
85       if @name.length == 0:
86         @name = "#" + @node.id.to_s
87       end
88         
89       @title = 'Node | ' + (@name)
90     rescue ActiveRecord::RecordNotFound
91       render :nothing => true, :status => :not_found
92     end
93   end
94 end