feat: Add basic map
This commit is contained in:
parent
080c590d9e
commit
cb1c3e52da
6
src/fellchensammlung/static/fellchensammlung/leaflet.js
Normal file
6
src/fellchensammlung/static/fellchensammlung/leaflet.js
Normal file
File diff suppressed because one or more lines are too long
@ -8,6 +8,7 @@
|
||||
<!-- Add additional CSS in static file -->
|
||||
{% load static %}
|
||||
<link rel="stylesheet" href="{% static 'fellchensammlung/css/styles.css' %}">
|
||||
<link href="{% static 'fellchensammlung/css/leaflet.css' %}" rel="stylesheet" type="text/css">
|
||||
<link href="{% static 'fontawesomefree/css/fontawesome.css' %}" rel="stylesheet" type="text/css">
|
||||
<link href="{% static 'fontawesomefree/css/brands.css' %}" rel="stylesheet" type="text/css">
|
||||
<link href="{% static 'fontawesomefree/css/solid.css' %}" rel="stylesheet" type="text/css">
|
||||
|
7
src/fellchensammlung/templates/fellchensammlung/map.html
Normal file
7
src/fellchensammlung/templates/fellchensammlung/map.html
Normal file
@ -0,0 +1,7 @@
|
||||
{% extends "fellchensammlung/base_generic.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block content %}
|
||||
<h1>{% translate 'Karte' %}</h1>
|
||||
{% include "fellchensammlung/partials/partial-map.html" %}
|
||||
{% endblock %}
|
@ -0,0 +1,29 @@
|
||||
{% load static %}
|
||||
<div id="map"></div>
|
||||
|
||||
<script src="{% static 'fellchensammlung/leaflet.js' %}"></script>
|
||||
<script>
|
||||
// Initialize the map and set its view to the desired geographical coordinates and zoom level
|
||||
var map = L.map('map').setView([51.505, -0.09], 13);
|
||||
|
||||
// Add the OpenStreetMap tile layer
|
||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
maxZoom: 19,
|
||||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
||||
}).addTo(map);
|
||||
|
||||
// Example coordinates for markers
|
||||
var markers = [
|
||||
{coords: [51.5, -0.09], popup: "Marker 1"},
|
||||
{coords: [51.515, -0.1], popup: "Marker 2"},
|
||||
{coords: [51.52, -0.12], popup: "Marker 3"}
|
||||
];
|
||||
|
||||
// Loop through the marker coordinates and add them to the map
|
||||
markers.forEach(function (marker) {
|
||||
L.marker(marker.coords).addTo(map)
|
||||
.bindPopup(marker.popup)
|
||||
.openPopup();
|
||||
});
|
||||
</script>
|
||||
|
@ -27,6 +27,8 @@ urlpatterns = [
|
||||
|
||||
# ex: /search/
|
||||
path("suchen/", views.search, name="search"),
|
||||
# ex: /map/
|
||||
path("map/", views.map, name="map"),
|
||||
# ex: /vermitteln/
|
||||
path("vermitteln/", views.add_adoption_notice, name="add-adoption"),
|
||||
|
||||
|
@ -38,7 +38,8 @@ def fail_if_user_not_owner_or_trust_level(user, django_object, trust_level=User.
|
||||
|
||||
def index(request):
|
||||
"""View function for home page of site."""
|
||||
latest_adoption_list = AdoptionNotice.objects.filter(adoptionnoticestatus__major_status=AdoptionNoticeStatus.ACTIVE).order_by("-created_at")[:5]
|
||||
latest_adoption_list = AdoptionNotice.objects.filter(
|
||||
adoptionnoticestatus__major_status=AdoptionNoticeStatus.ACTIVE).order_by("-created_at")[:5]
|
||||
active_adoptions = [adoption for adoption in latest_adoption_list if adoption.is_active]
|
||||
language_code = translation.get_language()
|
||||
lang = Language.objects.get(languagecode=language_code)
|
||||
@ -395,6 +396,10 @@ def modqueue(request):
|
||||
return render(request, 'fellchensammlung/modqueue.html', context=context)
|
||||
|
||||
|
||||
def map(request):
|
||||
return render(request, 'fellchensammlung/map.html')
|
||||
|
||||
|
||||
def metrics(request):
|
||||
data = gather_metrics_data()
|
||||
return JsonResponse(data)
|
||||
|
Loading…
Reference in New Issue
Block a user