From: Tom Hughes Date: Fri, 30 Sep 2016 10:15:18 +0000 (+0100) Subject: Patch classes on the locate control X-Git-Tag: live~4872 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/6d9bddfa4741db3116b6e47ad090c3152f863d21?hp=a1ff77ec56969346ecb5ba978879f5a96f166735 Patch classes on the locate control 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 --- diff --git a/app/assets/javascripts/index.js b/app/assets/javascripts/index.js index 5f84fb056..796a5f4d3 100644 --- a/app/assets/javascripts/index.js +++ b/app/assets/javascripts/index.js @@ -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);