]> git.openstreetmap.org Git - rails.git/blobdiff - app/helpers/changesets_helper.rb
Move changeset data to a helper
[rails.git] / app / helpers / changesets_helper.rb
index ae953c5833c59c59e2b135d342f0d2c7aa2f21e5..4605658f65c0a3f1f0202cd70b7e3934adad9f96 100644 (file)
@@ -41,4 +41,20 @@ module ChangesetsHelper
       t "changesets.index.title"
     end
   end
+
+  def changeset_data(changeset)
+    changeset_data = { :id => changeset.id }
+
+    if changeset.bbox_valid?
+      bbox = changeset.bbox.to_unscaled
+      changeset_data[:bbox] = {
+        :minlon => bbox.min_lon,
+        :minlat => bbox.min_lat,
+        :maxlon => bbox.max_lon,
+        :maxlat => bbox.max_lat
+      }
+    end
+
+    changeset_data
+  end
 end