1 class BrowseController < ApplicationController
4 before_filter :authorize_web
5 before_filter :set_locale
6 before_filter { |c| c.check_database_readable(true) }
14 @relation = Relation.find(params[:id])
15 @next = Relation.find(:first, :order => "id ASC", :conditions => [ "visible = true AND id > :id", { :id => @relation.id }] )
16 @prev = Relation.find(:first, :order => "id DESC", :conditions => [ "visible = true AND id < :id", { :id => @relation.id }] )
17 rescue ActiveRecord::RecordNotFound
19 render :action => "not_found", :status => :not_found
23 @relation = Relation.find(params[:id])
24 rescue ActiveRecord::RecordNotFound
26 render :action => "not_found", :status => :not_found
30 @relation = Relation.find(params[:id])
31 rescue ActiveRecord::RecordNotFound
33 render :action => "not_found", :status => :not_found
37 @way = Way.find(params[:id], :include => [:way_tags, {:changeset => :user}, {:nodes => [:node_tags, {:ways => :way_tags}]}, :containing_relation_members])
38 @next = Way.find(:first, :order => "id ASC", :conditions => [ "visible = true AND id > :id", { :id => @way.id }] )
39 @prev = Way.find(:first, :order => "id DESC", :conditions => [ "visible = true AND id < :id", { :id => @way.id }] )
41 # Used for edit link, takes approx middle node of way
42 @midnode = @way.nodes[@way.nodes.length/2]
43 rescue ActiveRecord::RecordNotFound
45 render :action => "not_found", :status => :not_found
49 @way = Way.find(params[:id], :include => [:way_tags, {:old_ways => {:changeset => :user}}])
50 rescue ActiveRecord::RecordNotFound
52 render :action => "not_found", :status => :not_found
56 @way = Way.find(params[:id])
57 rescue ActiveRecord::RecordNotFound
59 render :action => "not_found", :status => :not_found
63 @node = Node.find(params[:id])
64 @next = Node.find(:first, :order => "id ASC", :conditions => [ "visible = true AND id > :id", { :id => @node.id }] )
65 @prev = Node.find(:first, :order => "id DESC", :conditions => [ "visible = true AND id < :id", { :id => @node.id }] )
66 rescue ActiveRecord::RecordNotFound
68 render :action => "not_found", :status => :not_found
72 @node = Node.find(params[:id])
73 rescue ActiveRecord::RecordNotFound
75 render :action => "not_found", :status => :not_found
79 @node = Node.find(params[:id])
80 rescue ActiveRecord::RecordNotFound
82 render :action => "not_found", :status => :not_found
86 @changeset = Changeset.find(params[:id])
87 @node_pages, @nodes = paginate(:old_nodes, :conditions => {:changeset_id => @changeset.id}, :per_page => 20, :parameter => 'node_page')
88 @way_pages, @ways = paginate(:old_ways, :conditions => {:changeset_id => @changeset.id}, :per_page => 20, :parameter => 'way_page')
89 @relation_pages, @relations = paginate(:old_relations, :conditions => {:changeset_id => @changeset.id}, :per_page => 20, :parameter => 'relation_page')
91 @title = "#{I18n.t('browse.changeset.title')} | #{@changeset.id}"
92 @next = Changeset.find(:first, :order => "id ASC", :conditions => [ "id > :id", { :id => @changeset.id }] )
93 @prev = Changeset.find(:first, :order => "id DESC", :conditions => [ "id < :id", { :id => @changeset.id }] )
94 rescue ActiveRecord::RecordNotFound
96 render :action => "not_found", :status => :not_found
100 @changeset = Changeset.find(params[:id])
101 rescue ActiveRecord::RecordNotFound
103 render :action => "not_found", :status => :not_found