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.preload(:way_tags, :containing_relation_members, :changeset => :user, :nodes => [:node_tags, :ways => :way_tags]).find(params[:id])
31 @next = Way.visible.where("id > ?", @way.id).order(:id => :asc).first
32 @prev = Way.visible.where("id < ?", @way.id).order(:id => :desc).first
33 rescue ActiveRecord::RecordNotFound
34 render :action => "not_found", :status => :not_found
39 @way = Way.preload(:way_tags, :old_ways => { :changeset => :user }).find(params[:id])
40 rescue ActiveRecord::RecordNotFound
41 render :action => "not_found", :status => :not_found
46 @node = Node.find(params[:id])
47 @next = Node.visible.where("id > ?", @node.id).order(:id => :asc).first
48 @prev = Node.visible.where("id < ?", @node.id).order(:id => :desc).first
49 rescue ActiveRecord::RecordNotFound
50 render :action => "not_found", :status => :not_found
55 @node = Node.find(params[:id])
56 rescue ActiveRecord::RecordNotFound
57 render :action => "not_found", :status => :not_found
63 @changeset = Changeset.find(params[:id])
64 @node_pages, @nodes = paginate(:old_nodes, :conditions => {:changeset_id => @changeset.id}, :per_page => 20, :parameter => 'node_page')
65 @way_pages, @ways = paginate(:old_ways, :conditions => {:changeset_id => @changeset.id}, :per_page => 20, :parameter => 'way_page')
66 @relation_pages, @relations = paginate(:old_relations, :conditions => {:changeset_id => @changeset.id}, :per_page => 20, :parameter => 'relation_page')
68 @title = "#{I18n.t('browse.changeset.title')} | #{@changeset.id}"
69 @next = Changeset.where("id > ?", @changeset.id).order(:id => :asc).first
70 @prev = Changeset.where("id < ?", @changeset.id).order(:id => :desc).first
72 if @changeset.user.data_public?
73 @next_by_user = @changeset.user.changesets.where("id > ?", @changeset.id).order(:id => :asc).first
74 @prev_by_user = @changeset.user.changesets.where("id < ?", @changeset.id).order(:id => :desc).first
76 rescue ActiveRecord::RecordNotFound
77 render :action => "not_found", :status => :not_found
82 @note = Note.find(params[:id])
83 @title = "#{I18n.t('browse.note.title')} | #{@note.id}"
84 @next = Note.visible.where("id > ?", @note.id).order(:id => :asc).first
85 @prev = Note.visible.where("id < ?", @note.id).order(:id => :desc).first
86 rescue ActiveRecord::RecordNotFound
87 render :action => "not_found", :status => :not_found