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]
10 render :layout => false
15 @relation = Relation.find(params[:id])
16 @next = Relation.visible.where("id > ?", @relation.id).order(:id => :asc).first
17 @prev = Relation.visible.where("id < ?", @relation.id).order(:id => :desc).first
18 rescue ActiveRecord::RecordNotFound
19 render :action => "not_found", :status => :not_found
24 @relation = Relation.find(params[:id])
25 rescue ActiveRecord::RecordNotFound
26 render :action => "not_found", :status => :not_found
31 @way = Way.preload(:way_tags, :containing_relation_members, :changeset => :user, :nodes => [:node_tags, :ways => :way_tags]).find(params[:id])
32 @next = Way.visible.where("id > ?", @way.id).order(:id => :asc).first
33 @prev = Way.visible.where("id < ?", @way.id).order(:id => :desc).first
34 rescue ActiveRecord::RecordNotFound
35 render :action => "not_found", :status => :not_found
40 @way = Way.preload(:way_tags, :old_ways => { :changeset => :user }).find(params[:id])
41 rescue ActiveRecord::RecordNotFound
42 render :action => "not_found", :status => :not_found
47 @node = Node.find(params[:id])
48 @next = Node.visible.where("id > ?", @node.id).order(:id => :asc).first
49 @prev = Node.visible.where("id < ?", @node.id).order(:id => :desc).first
50 rescue ActiveRecord::RecordNotFound
51 render :action => "not_found", :status => :not_found
56 @node = Node.find(params[:id])
57 rescue ActiveRecord::RecordNotFound
58 render :action => "not_found", :status => :not_found
64 @changeset = Changeset.find(params[:id])
65 @node_pages, @nodes = paginate(:old_nodes, :conditions => {:changeset_id => @changeset.id}, :per_page => 20, :parameter => 'node_page')
66 @way_pages, @ways = paginate(:old_ways, :conditions => {:changeset_id => @changeset.id}, :per_page => 20, :parameter => 'way_page')
67 @relation_pages, @relations = paginate(:old_relations, :conditions => {:changeset_id => @changeset.id}, :per_page => 20, :parameter => 'relation_page')
69 @title = "#{I18n.t('browse.changeset.title')} | #{@changeset.id}"
70 @next = Changeset.where("id > ?", @changeset.id).order(:id => :asc).first
71 @prev = Changeset.where("id < ?", @changeset.id).order(:id => :desc).first
73 if @changeset.user.data_public?
74 @next_by_user = @changeset.user.changesets.where("id > ?", @changeset.id).order(:id => :asc).first
75 @prev_by_user = @changeset.user.changesets.where("id < ?", @changeset.id).order(:id => :desc).first
77 rescue ActiveRecord::RecordNotFound
78 render :action => "not_found", :status => :not_found
83 @note = Note.find(params[:id])
84 @title = "#{I18n.t('browse.note.title')} | #{@note.id}"
85 @next = Note.visible.where("id > ?", @note.id).order(:id => :asc).first
86 @prev = Note.visible.where("id < ?", @note.id).order(:id => :desc).first
87 rescue ActiveRecord::RecordNotFound
88 render :action => "not_found", :status => :not_found