-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add JavaScript to display Leaflet maps for RDF imports of Place objects.
- Loading branch information
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
apis_ontology/templates/apis_core/apis_entities/abstractentity_form.html
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,39 @@ | ||
{% extends "apis_core/apis_entities/abstractentity_form.html" %} | ||
{% block scriptHeader %} | ||
{{ block.super }} | ||
<script type="text/javascript"> | ||
function showmap(element) { | ||
$('.popover').remove(); | ||
var rect = element.getBoundingClientRect(); | ||
|
||
mapdiv = document.createElement("div"); | ||
mapdiv.classList.add("popover"); | ||
mapdiv.setAttribute("id", "popovermap"); | ||
ptop = rect.top + window.scrollY - 250; | ||
pleft = rect.left + window.scrollX - 550; | ||
$(mapdiv).offset({top: ptop, left: pleft}); | ||
document.body.appendChild(mapdiv); | ||
|
||
if (typeof map != "undefined") { map.off(); map.remove(); } | ||
map = L.map('popovermap', { center: [element.dataset.latitude, element.dataset.longitude], zoom: 7 }); | ||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' }).addTo(map); | ||
L.marker([element.dataset.latitude, element.dataset.longitude]).addTo(map); | ||
|
||
}; | ||
function delmap(element) { | ||
$('.popover').remove(); | ||
} | ||
</script> | ||
<style> | ||
#popovermap { | ||
width: 500px; | ||
height: 500px; | ||
} | ||
</style> | ||
{% endblock %} | ||
{% block col-one %} | ||
{{ block.super }} | ||
{% endblock col-one %} | ||
{% block scripts %} | ||
{{ block.super }} | ||
{% endblock scripts %} |