1 class BrowseController < ApplicationController
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]
11 when browser.ie? && browser.version.to_i < 8 then 100
12 when browser.ie? && browser.version.to_i < 9 then 500
19 @relation = Relation.find(params[:id])
20 @next = Relation.visible.where("id > ?", @relation.id).order("id ASC").first
21 @prev = Relation.visible.where("id < ?", @relation.id).order("id DESC").first
22 rescue ActiveRecord::RecordNotFound
23 render :action => "not_found", :status => :not_found
28 @relation = Relation.find(params[:id])
29 rescue ActiveRecord::RecordNotFound
30 render :action => "not_found", :status => :not_found
35 @way = Way.find(params[:id], :include => [:way_tags, {:changeset => :user}, {:nodes => [:node_tags, {:ways => :way_tags}]}, :containing_relation_members])
36 @next = Way.visible.where("id > ?", @way.id).order("id ASC").first
37 @prev = Way.visible.where("id < ?", @way.id).order("id DESC").first
39 # Used for edit link, takes approx middle node of way
40 @midnode = @way.nodes[@way.nodes.length/2]
41 rescue ActiveRecord::RecordNotFound
42 render :action => "not_found", :status => :not_found
47 @way = Way.find(params[:id], :include => [:way_tags, {:old_ways => {:changeset => :user}}])
48 rescue ActiveRecord::RecordNotFound
49 render :action => "not_found", :status => :not_found
54 @node = Node.find(params[:id])
55 @next = Node.visible.where("id > ?", @node.id).order("id ASC").first
56 @prev = Node.visible.where("id < ?", @node.id).order("id DESC").first
57 rescue ActiveRecord::RecordNotFound
58 render :action => "not_found", :status => :not_found
63 @node = Node.find(params[:id])
64 rescue ActiveRecord::RecordNotFound
65 render :action => "not_found", :status => :not_found
71 @changeset = Changeset.find(params[:id])
72 @node_pages, @nodes = paginate(:old_nodes, :conditions => {:changeset_id => @changeset.id}, :per_page => 20, :parameter => 'node_page')
73 @way_pages, @ways = paginate(:old_ways, :conditions => {:changeset_id => @changeset.id}, :per_page => 20, :parameter => 'way_page')
74 @relation_pages, @relations = paginate(:old_relations, :conditions => {:changeset_id => @changeset.id}, :per_page => 20, :parameter => 'relation_page')
76 @title = "#{I18n.t('browse.changeset.title')} | #{@changeset.id}"
77 @next = Changeset.where("id > ?", @changeset.id).order("id ASC").first
78 @prev = Changeset.where("id < ?", @changeset.id).order("id DESC").first
80 if @changeset.user.data_public?
81 @next_by_user = Changeset.where("user_id = ? AND id > ?", @changeset.user_id, @changeset.id).order("id ASC").first
82 @prev_by_user = Changeset.where("user_id = ? AND id < ?", @changeset.user_id, @changeset.id).order("id DESC").first
84 rescue ActiveRecord::RecordNotFound
85 render :action => "not_found", :status => :not_found