X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/c8d4e4eee3835e9b92fe7cb62c22a07fa2f95f5d..c6cde2653b8dbcd3345348b33619b2240f1cc905:/app/controllers/site_controller.rb?ds=inline diff --git a/app/controllers/site_controller.rb b/app/controllers/site_controller.rb index c16daf37f..3b0a19cf9 100644 --- a/app/controllers/site_controller.rb +++ b/app/controllers/site_controller.rb @@ -8,9 +8,20 @@ class SiteController < ApplicationController before_filter :require_oauth, :only => [:index] def index + anchor = [] + if params[:lat] && params[:lon] - params[:anchor] = "#{params.delete(:zoom) || 5}/#{params.delete(:lat)}/#{params.delete(:lon)}" - redirect_to params + anchor << "map=#{params.delete(:zoom) || 5}/#{params.delete(:lat)}/#{params.delete(:lon)}" + end + + if params[:layers] + anchor << "layers=#{params.delete(:layers)}" + elsif params.delete(:notes) == 'yes' + anchor << "layers=N" + end + + if anchor.present? + redirect_to params.merge(:anchor => anchor.join('&')) return end @@ -31,7 +42,7 @@ class SiteController < ApplicationController new_params[:controller] = 'site' new_params[:action] = 'index' - new_params[:anchor] = "#{zoom}/#{lat}/#{lon}" + new_params[:anchor] = "map=#{zoom}/#{lat}/#{lon}" redirect_to new_params end