]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/site_controller.rb
Refactor note add/update code
[rails.git] / app / controllers / site_controller.rb
index 015da9e224cd74cfb0bb8135fb1ee722795277d1..606143f4f9ceaaa48fe79c40a1d6def05216f0a9 100644 (file)
@@ -39,6 +39,21 @@ class SiteController < ApplicationController
 
     if editor == "remote"
       render :action => :index
+      return
+    end
+
+    if params[:node]
+      bbox = Node.find(params[:node]).bbox.to_unscaled
+      @lat = bbox.centre_lat
+      @lon = bbox.centre_lon
+    elsif params[:way]
+      bbox = Way.find(params[:way]).bbox.to_unscaled
+      @lat = bbox.centre_lat
+      @lon = bbox.centre_lon
+    elsif params[:gpx]
+      trace = Trace.visible_to(@user).find(params[:gpx])
+      @lat = trace.latitude
+      @lon = trace.longitude
     end
   end