aboutsummaryrefslogtreecommitdiff
path: root/app/helpers/leaflet_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers/leaflet_helper.rb')
-rw-r--r--app/helpers/leaflet_helper.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/helpers/leaflet_helper.rb b/app/helpers/leaflet_helper.rb
new file mode 100644
index 0000000..6ca03f3
--- /dev/null
+++ b/app/helpers/leaflet_helper.rb
@@ -0,0 +1,11 @@
+module LeafletHelper
+ def marker_for(resource, options = {})
+ coords = [resource.latitude, resource.longitude]
+
+ "L.marker(#{coords}, #{options}).bindPopup(%s)" % popup_for(resource)
+ end
+
+ def popup_for(resource)
+ render partial: 'resource/popup', locals: { resource: resource }
+ end
+end