Skip to content

Commit

Permalink
feat: add autocomplete template for persons and place
Browse files Browse the repository at this point in the history
This also adds some js to the `abstractentity_form.html` which should be
upstreamed asap
  • Loading branch information
b1rger committed Feb 14, 2024
1 parent b7b6efc commit bbeefbb
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,35 @@
{% block scriptHeader %}
{{ block.super }}
<link rel="stylesheet" href="/static/css/highlighter.css">
<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.lat, element.dataset.lng], zoom: 5 });
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' }).addTo(map);
L.marker([element.dataset.lat, element.dataset.lng]).addTo(map);

};
function delmap(element) {
$('.popover').remove();
}
</script>
<style>
#popovermap {
width: 500px;
height: 500px;
}
</style>
{% endblock %}

{% block col-one %}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ result }} <i>{{ result.professioncategory }}</i> ({% if result.start_date %}{{ result.start_date.year }}{% endif %} - {% if result.end_date %}{{ result.end_date.year }}{% endif %})
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% if result.lng and result.lat %}<a data-lat="{{ result.lat }}" data-lng="{{ result.lng }}" title="Map" onmouseenter="showmap(this);" onmouseout="delmap(this);"><span class="material-symbols-outlined material-symbols-align">location_on</span></a>{% endif %} {{ result }} {% if result.kind %}<i>({{ result.kind }})</i>{% endif %}

0 comments on commit bbeefbb

Please sign in to comment.