Sha256: 9c687a2a8b9e770d7b8e17fb7349aec20f8545586a59f172ffffd7e68670f3f1

Contents?: true

Size: 1.44 KB

Versions: 14

Compression:

Stored size: 1.44 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){
    Compass.ErpApp.Utility.JsLoader.load('http://maps.google.com/maps/api/js?sensor=false&callback=loadMap_<%=@uuid%>', false);
    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

14 entries across 14 versions & 1 rubygems

Version Path
knitkit-2.1.2 app/widgets/google_map/views/index.html.erb
knitkit-2.1.1 app/widgets/google_map/views/index.html.erb
knitkit-2.1.0 app/widgets/google_map/views/index.html.erb
knitkit-2.0.11 app/widgets/google_map/views/index.html.erb
knitkit-2.0.10 app/widgets/google_map/views/index.html.erb
knitkit-2.0.9 app/widgets/google_map/views/index.html.erb
knitkit-2.0.7 app/widgets/google_map/views/index.html.erb
knitkit-2.0.6 app/widgets/google_map/views/index.html.erb
knitkit-2.0.5 app/widgets/google_map/views/index.html.erb
knitkit-2.0.4 app/widgets/google_map/views/index.html.erb
knitkit-2.0.3 app/widgets/google_map/views/index.html.erb
knitkit-2.0.2 app/widgets/google_map/views/index.html.erb
knitkit-2.0.1 app/widgets/google_map/views/index.html.erb
knitkit-2.0.0 app/widgets/google_map/views/index.html.erb