]> git.openstreetmap.org Git - rails.git/commitdiff
Patch classes on the locate control
authorMarco Antonio Frias Butrón <marcoantoniofrias@gmail.com>
Sun, 16 Oct 2016 20:26:19 +0000 (16:26 -0400)
committerTom Hughes <tom@compton.nu>
Mon, 17 Oct 2016 10:00:01 +0000 (11:00 +0100)
This patches the map on the user page in the same way as the main map.

Closes #1328

app/assets/javascripts/user.js

index e8ad3324d0ccc2b01e5a4e3b388b39f0d47f6603..7e7e7c8032a6cbab6d9018d7d0ee888eb0dd0df2 100644 (file)
@@ -12,14 +12,25 @@ $(document).ready(function () {
     L.OSM.zoom({position: position})
       .addTo(map);
 
     L.OSM.zoom({position: position})
       .addTo(map);
 
-    L.control.locate({
+    var locate = L.control.locate({
       position: position,
       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);
 
       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');
+
     if (OSM.home) {
       map.setView([OSM.home.lat, OSM.home.lon], 12);
     } else {
     if (OSM.home) {
       map.setView([OSM.home.lat, OSM.home.lon], 12);
     } else {