diff --git a/ticdesk/static/style.less b/ticdesk/static/style.less index 3300def463874977096ac16786260bd93015a5f0..c4b2addad79c15a040a971ea25b06492f4eca108 100644 --- a/ticdesk/static/style.less +++ b/ticdesk/static/style.less @@ -54,3 +54,7 @@ img.person-img { .leaflet-container#map { min-height: 700px; } + +.map-popup-img { + height: 150px; +} diff --git a/ticdesk_org/templates/ticdesk_org/map_popup_content.html b/ticdesk_org/templates/ticdesk_org/map_popup_content.html new file mode 100644 index 0000000000000000000000000000000000000000..075c98a8dc96836127a5c9cd44596d90b81f5b03 --- /dev/null +++ b/ticdesk_org/templates/ticdesk_org/map_popup_content.html @@ -0,0 +1,4 @@ +<h3>{{ person.cn }}</h3> +<p> + <img src="{{ person.jpeg_photo__url }}" alt="{{ person.cn }}" class="map-popup-img" /> +</p> diff --git a/ticdesk_org/views.py b/ticdesk_org/views.py index a3426ab577c491be84757ee0277036fce3d8507f..6fb245013a0615f098d3b8332cc222949a25af12 100644 --- a/ticdesk_org/views.py +++ b/ticdesk_org/views.py @@ -1,6 +1,7 @@ from django.apps import apps from django.http import JsonResponse, HttpResponse from django.shortcuts import redirect, render +from django.template.loader import get_template from django.urls import reverse from django_tables2 import RequestConfig @@ -69,10 +70,15 @@ def persons(request, group=None): geojson = [] for person in persons: if person.latitude and person.longitude: + # Generate popup content from template + template = get_template('ticdesk_org/map_popup_content.html') + popup_content = template.render({'person': person}) + + # Add item to pre-GeoJSON structure geojson.append({"type": "Feature", "properties": { "id": person.uid_number, - "popupContent": person.cn + "popupContent": popup_content }, "geometry": { "type": "Point",