Remove "\/" from escaped JavaScript to prevent test errors.

We were getting annoying "couldn't close <p> with </script>" messages
when running tests, because escape_javascript was turning </p> into
<\/p>. We fixed this by gsub'ing \/ to / after calling
escape_javascript. What could possibly go wrong? :-)
This commit is contained in:
Miles Gould
2013-08-31 16:07:27 +01:00
parent 4701bd1b2e
commit 71ea2b0485

View File

@@ -14,10 +14,10 @@
- Member.located.each do |m|
- popup = render :partial => 'members/popover', :locals => { :member => m }
- popup.gsub!(/\n/, "") # Linebreaks in strings break JavaScript
- popup = escape_javascript(popup).gsub(/\\\//, "/")
:javascript
marker = new L.Marker(new L.LatLng(#{m.latitude}, #{m.longitude}));
marker.bindPopup('<p>#{link_to m, m}</p> #{ escape_javascript(popup) }').openPopup();
marker.bindPopup('<p>#{link_to m, m}</p> #{ popup }').openPopup();
map.addLayer(marker);
%h3