Sha256: 3a0127b328e0afa7276ec87a81e7ca7426a82916c0dba005d9f5543f1509bc23

Contents?: true

Size: 1.43 KB

Versions: 13

Compression:

Stored size: 1.43 KB

Contents

<div id='<%=@uuid%>' style='width:<%=@map_width%>px;height:<%=@map_height%>px;border:solid 1px black;'></div>
<script type='text/javascript'>
  //we do not want to load google libraries more than once.
  window.loadMap_<%=@uuid%> = function(){
    var myOptions = {
      zoom: <%=@zoom%>,
      mapTypeId: google.maps.MapTypeId.<%=@map_type%>
    }

    var map_<%=@uuid%> = new google.maps.Map(document.getElementById('<%=@uuid%>'), myOptions);
    var dropPins = <%=raw @drop_pins.to_json%>;
    window.codeAddress(dropPins,map_<%=@uuid%>)
  }

  if(!window.mapJsLoaded){
    new OnDemandLoadByAjax().load('http://maps.google.com/maps/api/js?sensor=false&callback=loadMap_<%=@uuid%>');
    window.mapJsLoaded = true;
  }
  else{
    setTimeout(loadMap_<%=@uuid%>,1000);
  }

  window.codeAddress = function(dropPins, map){
    var geocoder = new google.maps.Geocoder();
    Ext.each(dropPins,function(dropPin){
      geocoder.geocode( { 'address': dropPin['address']}, function(results, status) {
        if (status == google.maps.GeocoderStatus.OK) {
          map.setCenter(results[0].geometry.location);
          new google.maps.Marker({
            map: map,
            animation: google.maps.Animation.DROP,
            position: results[0].geometry.location,
            title:dropPin['title']
          });
        } else {
          alert("Geocode was not successful for the following reason: " + status);
        }
      });
    });
  }
</script>

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
knitkit-2.1.15 app/widgets/google_map/views/index.html.erb
knitkit-2.1.14 app/widgets/google_map/views/index.html.erb
knitkit-2.1.13 app/widgets/google_map/views/index.html.erb
knitkit-2.1.12 app/widgets/google_map/views/index.html.erb
knitkit-2.1.11 app/widgets/google_map/views/index.html.erb
knitkit-2.1.10 app/widgets/google_map/views/index.html.erb
knitkit-2.1.9 app/widgets/google_map/views/index.html.erb
knitkit-2.1.8 app/widgets/google_map/views/index.html.erb
knitkit-2.1.7 app/widgets/google_map/views/index.html.erb
knitkit-2.1.6 app/widgets/google_map/views/index.html.erb
knitkit-2.1.5 app/widgets/google_map/views/index.html.erb
knitkit-2.1.4 app/widgets/google_map/views/index.html.erb
knitkit-2.1.3 app/widgets/google_map/views/index.html.erb