From 6494747882358cc1506ae442c89eed3db1de94a4 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Mon, 9 Sep 2013 15:44:53 +0100 Subject: [PATCH] Centre editors correctly when note=N is specified --- app/controllers/site_controller.rb | 4 ++++ app/views/site/_id.html.erb | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/app/controllers/site_controller.rb b/app/controllers/site_controller.rb index 94cc64754..280f39fd8 100644 --- a/app/controllers/site_controller.rb +++ b/app/controllers/site_controller.rb @@ -53,6 +53,10 @@ class SiteController < ApplicationController bbox = Way.find(params[:way]).bbox.to_unscaled @lat = bbox.centre_lat @lon = bbox.centre_lon + elsif params[:note] + note = Note.find(params[:note]) + @lat = note.lat + @lon = note.lon elsif params[:gpx] trace = Trace.visible_to(@user).find(params[:gpx]) @lat = trace.latitude diff --git a/app/views/site/_id.html.erb b/app/views/site/_id.html.erb index 5a0a7a432..059009a0c 100644 --- a/app/views/site/_id.html.erb +++ b/app/views/site/_id.html.erb @@ -9,7 +9,11 @@ if (mapParams.object) { params.id = mapParams.object.type[0] + mapParams.object.id; } else { +<% if @lat && @lon -%> + params.map = '16/<%= @lon %>/<%= @lat %>'; +<% else -%> params.map = (mapParams.zoom || 17) + '/' + mapParams.lon + '/' + mapParams.lat; +<% end -%> } var hashParams = OSM.params(location.hash.substring(1)); -- 2.39.5