Patch classes on the locate control
authorTom Hughes <tom@compton.nu>
Fri, 30 Sep 2016 10:15:18 +0000 (11:15 +0100)
committerTom Hughes <tom@compton.nu>
Fri, 30 Sep 2016 10:15:18 +0000 (11:15 +0100)
This replaces the patching of the vendored source that we had been
doing before and which we always forget to apply after updating it.

Fixes #1306

app/assets/javascripts/index.js

index 5f84fb0566e8d34ab601e8ee4379302fe4bb608a..796a5f4d31d85f4ced3929b12cda6f091798cef3 100644 (file)
@@ -95,14 +95,25 @@ $(document).ready(function () {
   L.OSM.zoom({position: position})
     .addTo(map);
 
-  L.control.locate({
+  var locate = L.control.locate({
     position: position,
+    icon: 'icon geolocate',
+    iconLoading: 'icon geolocate',
     strings: {
       title: I18n.t('javascripts.map.locate.title'),
       popup: I18n.t('javascripts.map.locate.popup')
     }
   }).addTo(map);
 
+  var locateContainer = locate.getContainer();
+
+  $(locateContainer)
+    .removeClass('leaflet-control-locate leaflet-bar')
+    .addClass('control-locate')
+    .children("a")
+    .removeClass('leaflet-bar-part leaflet-bar-part-single')
+    .addClass('control-button');
+
   var sidebar = L.OSM.sidebar('#map-ui')
     .addTo(map);