aboutsummaryrefslogtreecommitdiff
path: root/app/helpers/leaflet_helper.rb
blob: 6ca03f3a22c21fe743b82fb2dd8802a56ab9339b (plain)
1
2
3
4
5
6
7
8
9
10
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