-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3986 from GeotrekCE/overlay_leaflet
Add Trail + some translations + change signage group on leaflet overlay (#1300)
- Loading branch information
Showing
7 changed files
with
58 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
$(window).on('entity:map', function (e, data) { | ||
var modelname = 'trail'; | ||
var layername = `${modelname}_layer`; | ||
var url = window.SETTINGS.urls[layername]; | ||
var loaded_trail = false; | ||
var map = data.map; | ||
var style = L.Util.extend({ clickable: false }, | ||
window.SETTINGS.map.styles[modelname] || {}); | ||
// Show trail layer in application maps | ||
var layer = new L.ObjectsLayer(null, { | ||
modelname: modelname, | ||
style: style, | ||
}); | ||
|
||
if (data.modelname != modelname){ | ||
map.layerscontrol.addOverlay(layer, tr('Trails'), tr('Trail')); | ||
}; | ||
|
||
map.on('layeradd', function (e) { | ||
var options = e.layer.options || { 'modelname': 'None' }; | ||
if (! loaded_trail) { | ||
if (options.modelname == modelname && options.modelname != data.modelname) { | ||
e.layer.load(url); | ||
loaded_trail = true; | ||
} | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
{% load static i18n %} | ||
<script type="text/javascript"> | ||
MapEntity.i18n['Paths'] = "{% trans "Paths" %}"; | ||
MapEntity.i18n['Trail'] = "{% trans "Trail" %}"; | ||
MapEntity.i18n['Trails'] = "{% trans "Trails" %}"; | ||
|
||
window.SETTINGS.urls['path_layer'] = "{% url "core:path-drf-list" format="geojson" %}"; | ||
window.SETTINGS.urls['trail_layer'] = "{% url "core:trail-drf-list" format="geojson" %}"; | ||
window.SETTINGS.urls['path_graph'] = "{% url "core:path-drf-graph" %}"; | ||
</script> | ||
<script type="text/javascript" src="{% static "core/main.js" %}"></script> | ||
<script type="text/javascript" src="{% static "core/trail.js" %}"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
{% load static i18n %} | ||
<script type="text/javascript"> | ||
MapEntity.i18n['Dives'] = "{% trans "Dives" %}"; | ||
MapEntity.i18n['Diving'] = "{% trans "Diving" %}"; | ||
window.SETTINGS.urls['dive_layer'] = "{% url "diving:dive-drf-list" format="geojson" %}"; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters