1 class BrowseController < ApplicationController
2 layout 'site', :except => [ :start ]
4 before_filter :authorize_web
5 before_filter :set_locale
6 before_filter { |c| c.check_database_readable(true) }
7 around_filter :web_timeout, :except => [:start]
14 @relation = Relation.find(params[:id])
15 @next = Relation.visible.where("id > ?", @relation.id).order("id ASC").first
16 @prev = Relation.visible.where("id < ?", @relation.id).order("id DESC").first
17 rescue ActiveRecord::RecordNotFound
18 render :action => "not_found", :status => :not_found
23 @relation = Relation.find(params[:id])
24 rescue ActiveRecord::RecordNotFound
25 render :action => "not_found", :status => :not_found
30 @way = Way.find(params[:id], :include => [:way_tags, {:changeset => :user}, {:nodes => [:node_tags, {:ways => :way_tags}]}, :containing_relation_members])
31 @next = Way.visible.where("id > ?", @way.id).order("id ASC").first
32 @prev = Way.visible.where("id < ?", @way.id).order("id DESC").first
34 # Used for edit link, takes approx middle node of way
35 @midnode = @way.nodes[@way.nodes.length/2]
36 rescue ActiveRecord::RecordNotFound
37 render :action => "not_found", :status => :not_found
42 @way = Way.find(params[:id], :include => [:way_tags, {:old_ways => {:changeset => :user}}])
43 rescue ActiveRecord::RecordNotFound
44 render :action => "not_found", :status => :not_found
49 @node = Node.find(params[:id])
50 @next = Node.visible.where("id > ?", @node.id).order("id ASC").first
51 @prev = Node.visible.where("id < ?", @node.id).order("id DESC").first
52 rescue ActiveRecord::RecordNotFound
53 render :action => "not_found", :status => :not_found
58 @node = Node.find(params[:id])
59 rescue ActiveRecord::RecordNotFound
60 render :action => "not_found", :status => :not_found
66 @changeset = Changeset.find(params[:id])
67 @node_pages, @nodes = paginate(:old_nodes, :conditions => {:changeset_id => @changeset.id}, :per_page => 20, :parameter => 'node_page')
68 @way_pages, @ways = paginate(:old_ways, :conditions => {:changeset_id => @changeset.id}, :per_page => 20, :parameter => 'way_page')
69 @relation_pages, @relations = paginate(:old_relations, :conditions => {:changeset_id => @changeset.id}, :per_page => 20, :parameter => 'relation_page')
71 @title = "#{I18n.t('browse.changeset.title')} | #{@changeset.id}"
72 @next = Changeset.where("id > ?", @changeset.id).order("id ASC").first
73 @prev = Changeset.where("id < ?", @changeset.id).order("id DESC").first
75 if @changeset.user.data_public?
76 @next_by_user = Changeset.where("user_id = ? AND id > ?", @changeset.user_id, @changeset.id).order("id ASC").first
77 @prev_by_user = Changeset.where("user_id = ? AND id < ?", @changeset.user_id, @changeset.id).order("id DESC").first
79 rescue ActiveRecord::RecordNotFound
80 render :action => "not_found", :status => :not_found