]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/site_controller.rb
Add convenience methods to make ACL use simpler
[rails.git] / app / controllers / site_controller.rb
index 73f38f78c6b0ccf4eee941270940a701e3936eaa..36f57d6c27d26a5003f95e4b66aa0584e6654d4e 100644 (file)
@@ -48,6 +48,19 @@ class SiteController < ApplicationController
         @lat = params['mlat'].to_f
         @zoom = params['zoom'].to_i
 
+      elsif params['bbox']
+        bbox = BoundingBox.from_bbox_params(params)
+
+        @lon = bbox.centre_lon
+        @lat = bbox.centre_lat
+        @zoom = 16
+      elsif params['minlon'] and params['minlat'] and params['maxlon'] and params['maxlat']
+        bbox = BoundingBox.from_lon_lat_params(params)
+
+        @lon = bbox.centre_lon
+        @lat = bbox.centre_lat
+        @zoom = 16
+
       elsif params['gpx']
         @lon = Trace.find(params['gpx']).longitude
         @lat = Trace.find(params['gpx']).latitude
@@ -64,7 +77,7 @@ class SiteController < ApplicationController
         #Currently this results in potlatch starting up at 0,0 (Atlantic ocean).
       end
 
-      @zoom = '14' if @zoom.nil?
+      @zoom = '17' if @zoom.nil?
     end
   end
 end