Module: BHM::GoogleMaps::Helper
- Defined in:
- lib/bhm/google_maps/helper.rb
Instance Method Summary collapse
- #draw_map_of(address, options = {}) ⇒ Object
- #google_maps_url(sensor = false) ⇒ Object
-
#static_map_of_address(address, options = {}) ⇒ Object
Returns an image map with a single address plotted on a single static google map.
-
#static_map_of_addresses(addresses, options = {}) ⇒ Object
Given an array of addresses, will return an image an image tag with a static google map plotting those points.
- #use_gmaps_js ⇒ Object
- #using_gmaps_js? ⇒ Boolean
Instance Method Details
#draw_map_of(address, options = {}) ⇒ Object
19 20 21 22 |
# File 'lib/bhm/google_maps/helper.rb', line 19 def draw_map_of(address, = {}) use_gmaps_js BHM::GoogleMaps::Builder.new(self, address, ).to_html end |
#google_maps_url(sensor = false) ⇒ Object
9 10 11 |
# File 'lib/bhm/google_maps/helper.rb', line 9 def google_maps_url(sensor = false) "http://maps.google.com/maps/api/js?sensor=#{sensor}" end |
#static_map_of_address(address, options = {}) ⇒ Object
Returns an image map with a single address plotted on a single static google map.
31 32 33 |
# File 'lib/bhm/google_maps/helper.rb', line 31 def static_map_of_address(address, = {}) image_tag(BHM::GoogleMaps::StaticMap.for_address(address, ), :alt => BHM::GoogleMaps.address_to_s_proc(address)) end |
#static_map_of_addresses(addresses, options = {}) ⇒ Object
Given an array of addresses, will return an image an image tag with a static google map plotting those points.
26 27 28 |
# File 'lib/bhm/google_maps/helper.rb', line 26 def static_map_of_addresses(addresses, = {}) image_tag(BHM::GoogleMaps::StaticMap.for_addresses(addresses, ), :alt => "#{pluralize addresses.size, "address"} plotted on a map") end |
#use_gmaps_js ⇒ Object
13 14 15 16 17 |
# File 'lib/bhm/google_maps/helper.rb', line 13 def use_gmaps_js return if using_gmaps_js? BHM::GoogleMaps.include_js_proc.call(self) @using_gmaps_js = true end |
#using_gmaps_js? ⇒ Boolean
5 6 7 |
# File 'lib/bhm/google_maps/helper.rb', line 5 def using_gmaps_js? instance_variable_defined?(:@using_gmaps_js) && !!@using_gmaps_js end |