Skip to content

Commit

Permalink
WIP Support for query-based map embeds
Browse files Browse the repository at this point in the history
  • Loading branch information
ffont committed Feb 7, 2024
1 parent eafe53f commit 30a1dc8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion geotags/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import logging
import math
import struct
import urllib.parse

from django.conf import settings
from django.core.cache import cache
Expand Down Expand Up @@ -199,7 +200,8 @@ def _get_geotags_query_params(request):
'zoom': request.GET.get('z', None),
'username': request.GET.get('username', None),
'pack': request.GET.get('pack', None),
'tag': request.GET.get('tag', None)
'tag': request.GET.get('tag', None),
'query_params': urllib.parse.unquote(request.GET['qp']) if 'qp' in request.GET else None # This is used for map embeds based on general queries
}


Expand Down
4 changes: 3 additions & 1 deletion templates/embeds/geotags_box_iframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
var center_lon;
var zoom;

{% if username %}
{% if query_params %}
url = '{% url "geotags-for-query-barray" %}?{{ query_params|safe }}';
{% elif username %}
url = '{% url "geotags-for-user-barray" username %}?embed=1';
{% elif pack %}
url = '{% url "geotags-for-pack-barray" pack %}?embed=1';
Expand Down

0 comments on commit 30a1dc8

Please sign in to comment.