diff options
Diffstat (limited to 'app/planner')
-rw-r--r-- | app/planner/templates/planner/base.html | 1 | ||||
-rw-r--r-- | app/planner/templates/planner/idea-list.html | 35 | ||||
-rw-r--r-- | app/planner/templates/planner/list.html | 2 | ||||
-rw-r--r-- | app/planner/urls.py | 11 | ||||
-rw-r--r-- | app/planner/views.py | 11 |
5 files changed, 58 insertions, 2 deletions
diff --git a/app/planner/templates/planner/base.html b/app/planner/templates/planner/base.html index 4de5ce7..b465910 100644 --- a/app/planner/templates/planner/base.html +++ b/app/planner/templates/planner/base.html @@ -15,6 +15,7 @@ <nav> <span class="nav-item"><a href="{% url 'luxplanner:list' %}">Home</a></span> <span class="nav-item"><a href="{% url 'luxplanner:create' %}">Add Camp</a></span> + <span class="nav-item"><a href="{% url 'luxplanner:ideacreate' %}">Add Idea</a></span> </nav> {% block content %} {% endblock %} diff --git a/app/planner/templates/planner/idea-list.html b/app/planner/templates/planner/idea-list.html new file mode 100644 index 0000000..1a3007c --- /dev/null +++ b/app/planner/templates/planner/idea-list.html @@ -0,0 +1,35 @@ +{% extends 'planner/base.html' %} +{% load typogrify_tags %} +{% block pagetitle %}Luxagraf - Camping{% endblock %} + {% block content %} + <div id="mapid" class="idea-map"></div> + <div class=""> + {% for object in object_list %} + <article> + <h3 class="campname">{{object.name}} <small><a href="{% url 'luxplanner:update' object.pk %}">edit</a></small></h3> + <div class="notes">{{object.notes_html|safe|urlize}}</div> + <ul class="icons"> + {% if object.has_water %}<li class="water">water</li>{% endif %} + {% if object.has_dump %}<li class="water">dump</li>{% endif %} + {% if object.has_electric %}<li class="water">electric</li>{% endif %} + </ul> + </article>{% endfor %} + </div> + {% endblock %} + + {% block js %} + + <link rel="stylesheet" href="/media/js/leaflet-1.7.1/leaflet.css" integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A==" /> +<script src="/media/js/leaflet-1.7.1/leaflet.js" integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="></script> + <script> + + var mymap = L.map('mapid').setView([51.505, -0.09], 13); + + L.tileLayer('https://tile.thunderforest.com/outdoors/{z}/{x}/{y}.png?apikey=c9a9f0c5edfd4ce2948f49b51f533ad2', { + maxZoom: 18, + attribution: 'Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, ' + + 'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>', + }).addTo(mymap); + +</script> +{% endblock %} diff --git a/app/planner/templates/planner/list.html b/app/planner/templates/planner/list.html index ce7650e..2fffe59 100644 --- a/app/planner/templates/planner/list.html +++ b/app/planner/templates/planner/list.html @@ -16,7 +16,7 @@ {% if object.has_electric %}<li class="water">electric</li>{% endif %} </article>{% endfor %} </div> - <div id="mapid" ></div> + <div id="mapid" class="camp-map"></div> {% endblock %} {% block js %} diff --git a/app/planner/urls.py b/app/planner/urls.py index 2ccedc3..75b60ba 100644 --- a/app/planner/urls.py +++ b/app/planner/urls.py @@ -6,6 +6,17 @@ app_name = "luxplanner" urlpatterns = [ path( + r'ideas', + views.CampIdeaListView.as_view(), + {'page':1}, + name="idealist" + ), + path( + r'ideas/add', + views.PlannerModelFormView.as_view(), + name="ideacreate" + ), + path( r'camp/add', views.PlannerModelFormView.as_view(), name="create" diff --git a/app/planner/views.py b/app/planner/views.py index ea862ad..a23047f 100644 --- a/app/planner/views.py +++ b/app/planner/views.py @@ -6,7 +6,7 @@ from django.utils import timezone from django.conf import settings from utils.views import PaginatedListView -from .models import Camp +from .models import Camp, CampIdea class PlannerListView(PaginatedListView): @@ -64,3 +64,12 @@ class PlannerUpdateView(UpdateView): success_url = '/planner/' template_name = 'planner/update_form.html' + +class CampIdeaListView(PaginatedListView): + model = CampIdea + template_name = 'planner/idea-list.html' + + def get_context_data(self, **kwargs): + # Call the base implementation first to get a context + context = super(CampIdeaListView, self).get_context_data(**kwargs) + return context |