Module: MapHelper
- Defined in:
- app/helpers/map_helper.rb
Instance Method Summary collapse
-
#map_image(location, width = 500, height = 275, zoom = 15) ⇒ Object
Return a google map image for a given location.
-
#map_link(address, text = "map") ⇒ Object
Return a Google Map link based on an address.
Instance Method Details
#map_image(location, width = 500, height = 275, zoom = 15) ⇒ Object
Return a google map image for a given location
15 16 17 |
# File 'app/helpers/map_helper.rb', line 15 def map_image location, width=500, height=275, zoom=15 image_tag("http://maps.googleapis.com/maps/api/staticmap?center=#{location.latitude},#{location.longitude}&zoom=#{zoom}&size=#{width}x#{height}&markers=color:blue%7Clabel:1%7C#{location.latitude},#{location.longitude}&sensor=false", :class => "map_image") end |
#map_link(address, text = "map") ⇒ Object
Return a Google Map link based on an address
7 8 9 10 11 12 |
# File 'app/helpers/map_helper.rb', line 7 def map_link address, text="map" return if address.nil? link_to "https://maps.google.com/?q=#{address}", :class => "map-link", :title => "View in Google Maps", :target => "_blank" do "(#{text})" end end |