Module: MapHelper

Defined in:
app/helpers/map_helper.rb

Instance Method Summary collapse

Instance Method Details

#address_fields_map(address_fields) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/helpers/map_helper.rb', line 3

def address_fields_map( address_fields )
  json = address_fields.to_gmaps4rails do |address_field, marker|
    marker.title address_field.profileable.title
    if address_field.profileable.kind_of? Group
      marker.picture({
        picture: image_path("img/gmaps_yellow_marker_38.png"),
        width: 22, height: 38
      })
    end
  end
    
  raise 'no json generated from address fields' unless json

  #    marker_size = 32
  #    marker_size = 13 if address_fields.count > 50
  # { marker_width: marker_size, marker_length: marker_size, draggable: true }  },

  marker_options = {}
  gmaps( :markers => { :data => json, :options => marker_options },
         :map_options => { :auto_adjust => true, :auto_zoom => true }
         )
end