1 class BrowseController < ApplicationController
4 before_filter :authorize_web
5 before_filter { |c| c.check_database_availability(true) }
11 @changesets = Changeset.find(:all, :order => "closed_at DESC", :conditions => ['closed_at < ?', DateTime.now], :limit=> 20)
16 @relation = Relation.find(params[:id])
18 @name = @relation.tags['name'].to_s
20 @name = "#" + @relation.id.to_s
23 @title = 'Relation | ' + (@name)
24 @next = Relation.find(:first, :order => "id ASC", :conditions => [ "visible = true AND id > :id", { :id => @relation.id }] )
25 @prev = Relation.find(:first, :order => "id DESC", :conditions => [ "visible = true AND id < :id", { :id => @relation.id }] )
26 rescue ActiveRecord::RecordNotFound
28 render :action => "not_found", :status => :not_found
34 @relation = Relation.find(params[:id])
36 @name = @relation.tags['name'].to_s
38 @name = "#" + @relation.id.to_s
41 @title = 'Relation History | ' + (@name)
42 rescue ActiveRecord::RecordNotFound
44 render :action => "not_found", :status => :not_found
50 @way = Way.find(params[:id])
52 @name = @way.tags['name'].to_s
54 @name = "#" + @way.id.to_s
57 @title = 'Way | ' + (@name)
58 @next = Way.find(:first, :order => "id ASC", :conditions => [ "visible = true AND id > :id", { :id => @way.id }] )
59 @prev = Way.find(:first, :order => "id DESC", :conditions => [ "visible = true AND id < :id", { :id => @way.id }] )
60 rescue ActiveRecord::RecordNotFound
62 render :action => "not_found", :status => :not_found
68 @way = Way.find(params[:id])
70 @name = @way.tags['name'].to_s
72 @name = "#" + @way.id.to_s
75 @title = 'Way History | ' + (@name)
76 rescue ActiveRecord::RecordNotFound
78 render :action => "not_found", :status => :not_found
84 @node = Node.find(params[:id])
86 @name = @node.tags_as_hash['name'].to_s
88 @name = "#" + @node.id.to_s
91 @title = 'Node | ' + (@name)
92 @next = Node.find(:first, :order => "id ASC", :conditions => [ "visible = true AND id > :id", { :id => @node.id }] )
93 @prev = Node.find(:first, :order => "id DESC", :conditions => [ "visible = true AND id < :id", { :id => @node.id }] )
94 rescue ActiveRecord::RecordNotFound
96 render :action => "not_found", :status => :not_found
102 @node = Node.find(params[:id])
104 @name = @node.tags_as_hash['name'].to_s
105 if @name.length == 0:
106 @name = "#" + @node.id.to_s
109 @title = 'Node History | ' + (@name)
110 rescue ActiveRecord::RecordNotFound
112 render :action => "not_found", :status => :not_found
118 @changeset = Changeset.find(params[:id])
119 @node_pages, @nodes = paginate(:old_nodes, :conditions => {:changeset_id => @changeset.id}, :per_page => 20, :parameter => 'node_page')
120 @way_pages, @ways = paginate(:old_ways, :conditions => {:changeset_id => @changeset.id}, :per_page => 20, :parameter => 'way_page')
121 @relation_pages, @relations = paginate(:old_relations, :conditions => {:changeset_id => @changeset.id}, :per_page => 20, :parameter => 'relation_page')
123 @title = "Changeset | #{@changeset.id}"
124 @next = Changeset.find(:first, :order => "id ASC", :conditions => [ "id > :id", { :id => @changeset.id }] )
125 @prev = Changeset.find(:first, :order => "id DESC", :conditions => [ "id < :id", { :id => @changeset.id }] )
126 rescue ActiveRecord::RecordNotFound
128 render :action => "not_found", :status => :not_found