Created
March 5, 2014 15:21
-
-
Save jurgens/9369303 to your computer and use it in GitHub Desktop.
show single point on a google map
This file contains hidden or 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
class InitMap | |
constructor: (element, data) -> | |
latlng = new google.maps.LatLng(data.lat, data.long) | |
options = | |
zoom: 12 | |
center: latlng | |
mapTypeId: google.maps.MapTypeId.ROADMAP | |
map = new google.maps.Map(element, options) | |
marker = new google.maps.Marker( | |
position: latlng | |
clickable: true | |
center: latlng | |
map: map | |
) | |
info_window = new google.maps.InfoWindow() | |
info_html = "" | |
info_html = "<strong>" + data.title + " " + data.price + "</strong><br>" if data.title.length > 0 | |
info_html += data.address | |
info_window.setContent info_html | |
info_window.open map, marker | |
window.init_map = InitMap; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
= javascript_include_tag 'http://maps.googleapis.com/maps/api/js?sensor=false'