| Module | GmapHelper |
| In: |
lib/gmap_helper.rb
|
Generates a google-map in your rhtml
module ApplicationHelper
include GmapHelper
<html>
<head>
<%= header("12345-ABCDEF-your-api-key-from-google") %>
</head>
<body>
<%= gmap :option=>value, :option2=>value, .. %>
Generates a google-map in your rhtml
Usage:
<%= gmap({options}) %>
:large large controls :small small controls :zoom zoom in and out :type select satellite/map view
example :controls=>[:small,:zoom,:type]
:background_color html-style backgroundColor, a string like 'white', 'red', or '#fff') :border_top :border_top => true for a gray top border :height :height=>50 for a 50px high bar. default to 25px
gmap(:mapname=>"my_map", :width=>"50", :height=>"120")
gmap(:width=>"500", :height=>"500", :type=>:satellite, :point=>[-122.14944, 37.441944])
gmap(:mapname=>"foo", :white_div=>{:background_color=>'black', :height=>'40'})
Show a link to reset a map to its initial centering <%= gmap__reset_to_center(‘your_map_name’, {:zoom=>5, :text=>’reset map!’}) renders as <a href=’#’ onclick=’(some javascript)’>reset map!</a>