From febb56cf6049e4ebfb5ce0960d6400609376ca27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Fri, 15 Jun 2018 11:32:45 +0200 Subject: [PATCH] maps: add possibility to have a map without geolocation button (#24571) --- combo/apps/maps/static/js/combo.map.js | 2 +- combo/apps/maps/templates/maps/map_cell.html | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/combo/apps/maps/static/js/combo.map.js b/combo/apps/maps/static/js/combo.map.js index 53c15ec..24b772d 100644 --- a/combo/apps/maps/static/js/combo.map.js +++ b/combo/apps/maps/static/js/combo.map.js @@ -104,7 +104,7 @@ $(function() { if (map_options.maxZoom != map_options.minZoom) { new L.Control.Zoom({position: map_controls_position}).addTo(map); } - if (L.Control.Gps) { + if (L.Control.Gps && $map_widget.data('include-geoloc-button')) { var gps_control = new L.Control.Gps({position: map_controls_position}); map.addControl(gps_control); } diff --git a/combo/apps/maps/templates/maps/map_cell.html b/combo/apps/maps/templates/maps/map_cell.html index a37a2e9..d7f5279 100644 --- a/combo/apps/maps/templates/maps/map_cell.html +++ b/combo/apps/maps/templates/maps/map_cell.html @@ -6,6 +6,7 @@ data-max-zoom="{{ max_zoom }}" data-init-lat="{{ init_lat }}" data-init-lng="{{ init_lng }}" data-geojson-url="{{ geojson_url }}" data-tile-urltemplate="{{ tile_urltemplate}}" data-map-attribution="{{ map_attribution}}" + data-include-geoloc-button="true" {% if group_markers %}data-group-markers="1"{% endif %} {% if max_bounds.corner1.lat %} data-max-bounds-lat1="{{ max_bounds.corner1.lat }}" -- 2.17.1