X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/0d3a9ed9cb47ce3b89ea9eaffbb589f9a9ff6d22..554a7c9d47613cf486589f9e5e8023629713c7fe:/app/controllers/browse_controller.rb?ds=inline diff --git a/app/controllers/browse_controller.rb b/app/controllers/browse_controller.rb index 73f0940d8..705078be7 100644 --- a/app/controllers/browse_controller.rb +++ b/app/controllers/browse_controller.rb @@ -1,5 +1,5 @@ class BrowseController < ApplicationController - layout 'site' + layout 'site', :except => [ :start ] before_filter :authorize_web before_filter :set_locale @@ -7,11 +7,6 @@ class BrowseController < ApplicationController around_filter :web_timeout, :except => [:start] def start - @max_features = case - when browser.ie? && browser.version.to_i < 8 then 100 - when browser.ie? && browser.version.to_i < 9 then 500 - else 2000 - end end def relation @@ -32,19 +27,16 @@ class BrowseController < ApplicationController def way @type = "way" - @way = Way.find(params[:id], :include => [:way_tags, {:changeset => :user}, {:nodes => [:node_tags, {:ways => :way_tags}]}, :containing_relation_members]) + @way = Way.preload(:way_tags, :containing_relation_members, :changeset => :user, :nodes => [:node_tags, :ways => :way_tags]).find(params[:id]) @next = Way.visible.where("id > ?", @way.id).order("id ASC").first @prev = Way.visible.where("id < ?", @way.id).order("id DESC").first - - # Used for edit link, takes approx middle node of way - @midnode = @way.nodes[@way.nodes.length/2] rescue ActiveRecord::RecordNotFound render :action => "not_found", :status => :not_found end def way_history @type = "way" - @way = Way.find(params[:id], :include => [:way_tags, {:old_ways => {:changeset => :user}}]) + @way = Way.preload(:way_tags, :old_ways => { :changeset => :user }).find(params[:id]) rescue ActiveRecord::RecordNotFound render :action => "not_found", :status => :not_found end @@ -88,8 +80,9 @@ class BrowseController < ApplicationController def note @type = "note" @note = Note.find(params[:id]) - @next = Note.find(:first, :order => "id ASC", :conditions => [ "status != 'hidden' AND id > :id", { :id => @note.id }] ) - @prev = Note.find(:first, :order => "id DESC", :conditions => [ "status != 'hidden' AND id < :id", { :id => @note.id }] ) + @title = "#{I18n.t('browse.note.title')} | #{@note.id}" + @next = Note.where("status != 'hidden' AND id > ?", @note.id).order(:id).first + @prev = Note.where("status != 'hidden' AND id < ?", @note.id).order(:id => @desc).first rescue ActiveRecord::RecordNotFound render :action => "not_found", :status => :not_found end