I’m using meijer’s geosearch in a leaflet map. It was working fine but I’ve suddenly broken it and I don’t know how. The maps still appears, but the search box doen’t appear in the map. The code that breaks the app is:
new L.Control.GeoSearch({
provider: new L.GeoSearch.Provider.OpenStreetMap(),
showMarker: false,
position: 'topright',
retainZoomLevel: false
}).addTo(map);
``
I don’t think it can find the geosearch js or css files, even though I’ve clearly included them in application.html.erb:
<%= stylesheet_link_tag "leaflet.css" %>
<%= javascript_include_tag "leaflet.js" %>
<%= stylesheet_link_tag "l.geosearch.css" %>
<%= javascript_include_tag "l.control.geosearch.js" %>
<%= javascript_include_tag "l.geosearch.provider.openstreetmap.js" %>
``
I think the turning point might have been when I typed bundle exec rake assets:precompile
at the command line (I also did RAILS_ENV=production bundle exec rake assets:precompile
). Why would that break geosearch?
I have deleted my public/assets folder, but that didn’t make any difference.
Also, the console doesn’t show any complaints about broken geosearch.js files or not finding them. I am, as usual, baffled.