]> git.openstreetmap.org Git - rails.git/blob - app/controllers/browse_controller.rb
Add history for ways and nodes, split 'last edited by' into a seperate template to...
[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 way_view 
21     begin
22       @way = Way.find(params[:id])
23      
24       @name = @way.tags['name'].to_s 
25       if @name.length == 0:
26         @name = "#" + @way.id.to_s
27       end
28         
29       @title = 'Way | ' + (@name)
30     rescue ActiveRecord::RecordNotFound
31       render :nothing => true, :status => :not_found
32     end
33   end
34   
35   def way_history 
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 History | ' + (@name)
45     rescue ActiveRecord::RecordNotFound
46       render :nothing => true, :status => :not_found
47     end
48   end
49
50   def node_view 
51     begin
52       @node = Node.find(params[:id])
53      
54       @name = @node.tags_as_hash['name'].to_s 
55       if @name.length == 0:
56         @name = "#" + @node.id.to_s
57       end
58         
59       @title = 'Node | ' + (@name)
60     rescue ActiveRecord::RecordNotFound
61       render :nothing => true, :status => :not_found
62     end
63   end
64   def node_history 
65     begin
66       @node = Node.find(params[:id])
67      
68       @name = @node.tags_as_hash['name'].to_s 
69       if @name.length == 0:
70         @name = "#" + @node.id.to_s
71       end
72         
73       @title = 'Node | ' + (@name)
74     rescue ActiveRecord::RecordNotFound
75       render :nothing => true, :status => :not_found
76     end
77   end
78 end