Topic: Insert HTML with Javascript(Google Maps) on Rails

I'm new on rails, i want to place a code with html and javascript(Google Maps code) into a view on Rails using Slim-Rails. Here is the code of google maps: -> I want to load this code into a view with slim extension. Please, help me

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />

<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0px; padding: 0px }
#map_canvas { height: 100% }
</style>

<script type="text/javascript"
src="http://maps.google.com/maps/api/js?sensor=true">
</script>

<script>
var map;
var center=new google.maps.LatLng(<%= @lat -%>, <%= @lon -%>);

function initialize(){
var mapProp = {
  center:center,
  zoom:16,
  mapTypeId:google.maps.MapTypeId.ROADMAP
  };

  map = new google.maps.Map(document.getElementById("map_canvas"),mapProp);

  google.maps.event.addListener(map, 'click', function(event) {
    placeMarker(event.latLng);
  });
}

function placeMarker(location){
  var marker = new google.maps.Marker({
    position: location,
    map: map,
    draggable:true,
    animation: google.maps.Animation.DROP,
  });
 
  var infowindow = new google.maps.InfoWindow({
    content: 'Latitude: ' + location.lat() + '<br>Longitude: ' + location.lng()
  });
 
  infowindow.open(map,marker);
 
  google.maps.event.addListener(marker, "dblclick", function() {
    marker.setMap(null);
});
}

google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map_canvas" style="width:100%;height:100%;"></div>
</body>
</html>

Last edited by trafalgar (2013-07-29 17:55:28)