]> git.openstreetmap.org Git - rails.git/blob - app/controllers/browse_controller.rb
f69acc158e7ab5ae350ff4e69da442c8c9d29e08
[rails.git] / app / controllers / browse_controller.rb
1 class BrowseController < ApplicationController
2   layout :map_layout
3
4   before_action :authorize_web
5   before_action :set_locale
6   before_action -> { check_database_readable(:need_api => true) }
7   before_action :require_oauth
8   before_action :update_totp, :only => [:query]
9   around_action :web_timeout
10   authorize_resource :class => false
11
12   def relation
13     @type = "relation"
14     @feature = Relation.preload(:relation_tags, :containing_relation_members, :changeset => [:changeset_tags, :user], :relation_members => :member).find(params[:id])
15     render "feature"
16   rescue ActiveRecord::RecordNotFound
17     render :action => "not_found", :status => :not_found
18   end
19
20   def way
21     @type = "way"
22     @feature = Way.preload(:way_tags, :containing_relation_members, :changeset => [:changeset_tags, :user], :nodes => [:node_tags, { :ways => :way_tags }]).find(params[:id])
23     render "feature"
24   rescue ActiveRecord::RecordNotFound
25     render :action => "not_found", :status => :not_found
26   end
27
28   def node
29     @type = "node"
30     @feature = Node.preload(:node_tags, :containing_relation_members, :changeset => [:changeset_tags, :user], :ways => :way_tags).find(params[:id])
31     render "feature"
32   rescue ActiveRecord::RecordNotFound
33     render :action => "not_found", :status => :not_found
34   end
35
36   def query; end
37 end