Created
July 26, 2011 08:50
-
-
Save minikomi/1106309 to your computer and use it in GitHub Desktop.
Rough google maps partial
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#map_canvas{:style=>"width: 400px; height: 400px"} | |
%script{:type => "text/javascript", :src=>"http://maps.google.com/maps/api/js?sensor=false"} | |
= javascript_include_tag 'map' | |
:javascript | |
$(document).ready(function(){mappit("#{address}")}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mappit = function(address){ | |
var geocoder, map, myOptions, mapCenterFunc; | |
geocoder = new google.maps.Geocoder(); | |
myOptions = { | |
zoom: 17, | |
mapTypeId: google.maps.MapTypeId.ROADMAP | |
}; | |
mapCenterFunc = geocoder.geocode({address: address}, function(result){ | |
var center, marker; | |
center = result[0].geometry.location; | |
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); | |
map.setCenter(center); | |
marker = new google.maps.Marker({ | |
map: map, | |
position: center | |
}); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment