Skip to content

Commit

Permalink
Merge pull request #33 from arthur-schnitzler/main
Browse files Browse the repository at this point in the history
map for places
  • Loading branch information
csae8092 authored Jan 12, 2024
2 parents b7c5a58 + 44b4335 commit 5c9d121
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 12 deletions.
2 changes: 1 addition & 1 deletion apis_core/apis_entities/detail_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def get(self, request, *args, **kwargs):
RequestConfig(request, paginate={"per_page": 10}).configure(tb_label)
template = select_template(
[
"apis_entities/detail_views/{}_detail_generic.html".format(entity),
"apis_entities/detail_views/{}_detail.html".format(entity),
"apis_entities/detail_views/entity_detail_generic.html",
]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ <h2 class="display-4 text-center">
<small>{{ entity_type }}s</small>
{% endif %}
{{ object }}
</h2>
{% if user.is_authenticated %}
<h2 class="text-center">
{% if object.get_edit_url %}
Expand All @@ -44,7 +45,6 @@ <h2 class="text-center">
{% endif %}
</h2>
{% endif %}
</h2>
</div>
<div class="col-md-2">
{% if object.get_next_url %}
Expand Down Expand Up @@ -146,30 +146,30 @@ <h3 class="text-center">
{% endblock info-table %}
{% block info-metadata %}
<table class="table">
{% if object.collection.all %}
<tr>
<th>
Collection(s)
Uri(s)
</th>
<td>
{% for x in object.collection.all %}
<li>
{{ x }}
</li>
{% for x in object.uri_set.all %}
<a href="{{ x }}">{{ x }}</a> <br />
{% endfor %}
</td>
</tr>
{% endif %}
{% if object.collection.all %}
<tr>
<th>
Uri(s)
Collection(s)
</th>
<td>
{% for x in object.uri_set.all %}
<a href="{{ x }}">{{ x }}</a> <br />
{% for x in object.collection.all %}
<li>
{{ x }}
</li>
{% endfor %}
</td>
</tr>
{% endif %}
{% if object.notes %}
<tr>
<th>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{% extends "apis_entities/detail_views/entity_detail_generic.html" %}

{% block info-table %}
{% if object.lat %}
<div id="map" style="height: 300px;"></div>
<script>
var lat = "{{ object.lat }}".replace(",", ".");
var lng = "{{ object.lng }}".replace(",", ".");
console.log(lat, lng)
var map = L.map('map').setView([lat, lng], 13);
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
}).addTo(map);
var marker = L.marker([lat, lng]).addTo(map);
marker.bindPopup("{{ object.name }}").openPopup();
</script>
{% endif %}
<table class="table">
{% if no_merge_labels %}
<tr>
<th>
Alternative Namen
</th>
<td>
{% for x in no_merge_labels %}
<li class="list-unstyled">
<small>{{ x.label_type }}: </small>{{ x.label }}
</li>
{% endfor %}

</td>
</tr>
{% endif %}
<tr>
<th>
ID
</th>
<td>
{{ object.id }}
</td>
</tr>
<tr>
<th>
Koordinaten
</th>
<td>
{{ object.lat }} {{ object.lng}}
</td>
</tr>
<tr>
<th>Ortstype</th>
<td>{{ object.kind }}</td>
</tr>
</table>

{% endblock info-table %}
6 changes: 6 additions & 0 deletions templates/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,11 @@
<meta name="msapplication-TileColor" content="#da532c">
<meta name="msapplication-config" content="{% static 'img/browserconfig.xml' %}">
<meta name="theme-color" content="#ffffff">
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"
integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="
crossorigin=""/>
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"
integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="
crossorigin=""></script>
{% block scriptHeader %}
{% endblock scriptHeader %}

0 comments on commit 5c9d121

Please sign in to comment.