feat: add map to search

This commit is contained in:
moanos [he/him] 2025-01-01 19:48:33 +01:00
parent 2dbd908f4c
commit 3881a4f3b4
3 changed files with 31 additions and 21 deletions

View File

@ -746,6 +746,10 @@ div.announcement {
}
.half {
width: 49%;
}
/************************/
/* GENERAL HIGHLIGHTING */
/************************/

View File

@ -4,26 +4,31 @@
{% block title %}<title>{% translate "Suche" %}</title>{% endblock %}
{% block content %}
<form class="form-search card" method="post">
{% csrf_token %}
<input type="hidden" name="longitude" maxlength="200" id="longitude">
<input type="hidden" name="latitude" maxlength="200" id="latitude">
{{ search_form.as_p }}
<button class="btn" type="submit" value="search" name="search">
<i class="fas fa-search"></i> {% trans 'Suchen' %}
</button>
{% if searched %}
{% if subscribed_search %}
<button class="btn" type="submit" value="{{ subscribed_search.pk }}" name="unsubscribe_to_search">
<i class="fas fa-bell-slash"></i> {% trans 'Suche nicht mehr abonnieren' %}
</button>
{% else %}
<button class="btn" type="submit" name="subscribe_to_search">
<i class="fas fa-bell"></i> {% trans 'Suche abonnieren' %}
</button>
<div class="container-cards">
<form class="form-search card half" method="post">
{% csrf_token %}
<input type="hidden" name="longitude" maxlength="200" id="longitude">
<input type="hidden" name="latitude" maxlength="200" id="latitude">
{{ search_form.as_p }}
<button class="btn" type="submit" value="search" name="search">
<i class="fas fa-search"></i> {% trans 'Suchen' %}
</button>
{% if searched %}
{% if subscribed_search %}
<button class="btn" type="submit" value="{{ subscribed_search.pk }}" name="unsubscribe_to_search">
<i class="fas fa-bell-slash"></i> {% trans 'Suche nicht mehr abonnieren' %}
</button>
{% else %}
<button class="btn" type="submit" name="subscribe_to_search">
<i class="fas fa-bell"></i> {% trans 'Suche abonnieren' %}
</button>
{% endif %}
{% endif %}
{% endif %}
</form>
</form>
<div class="card half">
{% include "fellchensammlung/partials/partial-map.html" %}
</div>
</div>
{% if place_not_found %}
<p class="error">{% translate "Ort nicht gefunden" %}</p>
{% endif %}

View File

@ -199,7 +199,8 @@ def search(request):
"search_form": search.search_form,
"place_not_found": search.place_not_found,
"subscribed_search": subscribed_search,
"searched": searched}
"searched": searched,
"adoption_notices_map": AdoptionNotice.get_active_ANs()}
return render(request, 'fellchensammlung/search.html', context=context)
@ -518,7 +519,7 @@ def updatequeue(request):
def map(request):
adoption_notices = AdoptionNotice.objects.all() #TODO: Filter to active
adoption_notices = AdoptionNotice.get_active_ANs()
context = {"adoption_notices_map": adoption_notices}
return render(request, 'fellchensammlung/map.html', context=context)