How to I get rid of these double quotes?
Posted
by Danger Angell
on Stack Overflow
See other posts from Stack Overflow
or by Danger Angell
Published on 2010-03-24T18:19:16Z
Indexed on
2010/03/25
0:53 UTC
Read the original article
Hit count: 449
ruby-on-rails
I'm using ym4r to render a Google Map.
Relevant portion of Controller code:
@event.checkpoints.each do |checkpoint|
unless checkpoint.lat.blank?
current_checkpoint = GMarker.new([checkpoint.lat, checkpoint.long],
:title => checkpoint.name,
:info_window => checkpoint.name,
:icon => checkpoint.discipline.icon,
:draggable => false
)
@map.overlay_init(current_checkpoint)
end
It's this line that is hanging me up:
:icon => checkpoint.discipline.icon,
Using this to render the map in the view:
<%= @map.to_html %>
<%= @map.div(:width => 735, :height => 450, :position => 'relative') %>
The javascript that is puking looks like this:
icon : "mtn_biking"
and I need it looking like this:
icon : mtn_biking
This is the HTML generated:
<script type="text/javascript">
var mtn_bike = addOptionsToIcon(new GIcon(),{image : "/images/map/mtn_bike.png",iconSize : new GSize(32,32),iconAnchor : new GPoint(16,32),infoWindowAnchor : new GPoint(16,0)});var map;
window.onload = addCodeToFunction(window.onload,function() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(37.7,-97.3),4);map.addOverlay(addInfoWindowToMarker(new GMarker(new GLatLng(34.9,-82.22),{icon : "mtn_bike",draggable : false,title : "CP1"}),"CP1",{}));
map.addOverlay(addInfoWindowToMarker(new GMarker(new GLatLng(35.9,-83.22),{icon : "flat_water",draggable : false,title : "CP2"}),"CP2",{}));
map.addOverlay(addInfoWindowToMarker(new GMarker(new GLatLng(36.9,-84.22),{icon : "white_water",draggable : false,title : "CP3"}),"CP3",{}));map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
}
});
</script>
the issue is the double quotes in:
icon : "mtn_bike"
icon : "flat_water"
icon : "white_water"
I need a way to get rid of those double quotes in the generated HTML
© Stack Overflow or respective owner