Fleshing out area templates, add boulder/route detail templates
authorDavid Kerkeslager <kerkeslager@gmail.com>
Fri, 26 Feb 2021 17:33:07 +0000 (12:33 -0500)
committerDavid Kerkeslager <kerkeslager@gmail.com>
Fri, 26 Feb 2021 17:41:16 +0000 (12:41 -0500)
tickle/templates/tickle/area_breadcrumb.html [new file with mode: 0644]
tickle/templates/tickle/area_detail.html
tickle/templates/tickle/area_list_item.html
tickle/templates/tickle/boulder_detail.html [new file with mode: 0644]
tickle/templates/tickle/boulder_list_item.html [new file with mode: 0644]
tickle/templates/tickle/pitch_list_item.html [new file with mode: 0644]
tickle/templates/tickle/route_detail.html [new file with mode: 0644]
tickle/templates/tickle/route_list_item.html [new file with mode: 0644]
tickle/views.py

diff --git a/tickle/templates/tickle/area_breadcrumb.html b/tickle/templates/tickle/area_breadcrumb.html
new file mode 100644 (file)
index 0000000..6255c21
--- /dev/null
@@ -0,0 +1,7 @@
+{% if area.parent %}
+  {% include 'tickle/area_breadcrumb.html' with area=area.parent %} &gt;
+{% else %}
+  <a href='{% url "tickle:area-list" %}'>All</a> &gt;
+{% endif %}
+
+<a href='{% url "tickle:area-detail" pk=area.pk %}'>{{ area.name }}</a>
index b951f76..3e4d4a5 100644 (file)
@@ -1,6 +1,10 @@
 <html>
   <head></head>
   <body>
+    {% if area.parent %}
+      {% include 'tickle/area_breadcrumb.html' with area=area.parent %}
+    {% endif %}
+
     <h1>{{ area.name }}</h1>
 
     {% if area.children.count > 0 %}
       </ul>
     {% endif %}
 
+    <div>
+      {{ area.notes }}
+    </div>
+
     {% if area.boulders.count > 0 %}
       Boulders
       <ul>
         {% for boulder in area.boulders.all %}
-          <li>{{ boulder.name }}</li>
+          <li>{% include 'tickle/boulder_list_item.html' %}</li>
         {% endfor %}
       </ul>
     {% endif %}
@@ -24,7 +32,7 @@
       Routes
       <ul>
         {% for route in area.routes.all %}
-          <li>{{ route.name }}</li>
+          <li>{% include 'tickle/route_list_item.html' %}</li>
         {% endfor %}
       </ul>
     {% endif %}
index de6bfcc..9545c53 100644 (file)
@@ -14,7 +14,7 @@
     Boulders
     <ul>
       {% for boulder in area.boulders.all %}
-        <li>{{ boulder.name }}</li>
+        <li>{% include 'tickle/boulder_list_item.html' %}</li>
       {% endfor %}
     </ul>
   {% endif %}
@@ -23,7 +23,7 @@
     Routes
     <ul>
       {% for route in area.routes.all %}
-        <li>{{ route.name }}</li>
+        <li>{% include 'tickle/route_list_item.html' %}</li>
       {% endfor %}
     </ul>
   {% endif %}
diff --git a/tickle/templates/tickle/boulder_detail.html b/tickle/templates/tickle/boulder_detail.html
new file mode 100644 (file)
index 0000000..b3e2e0d
--- /dev/null
@@ -0,0 +1,12 @@
+<html>
+  <head></head>
+
+  <body>
+    {% include 'tickle/area_breadcrumb.html' with area=boulder.area %}
+    <header>
+      <h1>{{ boulder.name }}</h1>
+      <div>{{ boulder.difficulty }}</div>
+      <div>{{ boulder.notes }}</div>
+    </header>
+  </body>
+</html>
diff --git a/tickle/templates/tickle/boulder_list_item.html b/tickle/templates/tickle/boulder_list_item.html
new file mode 100644 (file)
index 0000000..8b9b5c7
--- /dev/null
@@ -0,0 +1 @@
+<a href='{% url "tickle:boulder-detail" pk=boulder.pk %}'>{{ boulder.name }}</a>
diff --git a/tickle/templates/tickle/pitch_list_item.html b/tickle/templates/tickle/pitch_list_item.html
new file mode 100644 (file)
index 0000000..70e4155
--- /dev/null
@@ -0,0 +1,17 @@
+{% if route.pitches.count > 1 %}
+  <header>
+    <h2>
+      P{{ pitch.order }}
+
+      {% if pitch.name %}
+        {{ pitch.name }}
+      {% endif %}
+    </h2>
+
+    <div>{{ pitch.difficulty }}</div>
+  </header>
+{% endif %}
+
+{% if pitch.notes %}
+  <div>{{ pitch.notes }}</div>
+{% endif %}
diff --git a/tickle/templates/tickle/route_detail.html b/tickle/templates/tickle/route_detail.html
new file mode 100644 (file)
index 0000000..114504b
--- /dev/null
@@ -0,0 +1,22 @@
+<html>
+  <head></head>
+
+  <body>
+    {% include 'tickle/area_breadcrumb.html' with area=route.area %}
+    <header>
+      <h1>{{ route.name }}</h1>
+      <div>{{ route.difficulty }}</div>
+      <div>{{ route.notes }}</div>
+
+      {% if route.pitches.count == 1 %}
+        {% include 'tickle/pitch_list_item.html' with pitch=route.pitches.first %}
+      {% else %}
+        <ul>
+          {% for pitch in route.pitches.all %}
+            <li>{% include 'tickle/pitch_list_item.html' %}</li>
+          {% endfor %}
+        </ul>
+      {% endif %}
+    </header>
+  </body>
+</html>
diff --git a/tickle/templates/tickle/route_list_item.html b/tickle/templates/tickle/route_list_item.html
new file mode 100644 (file)
index 0000000..8c9e101
--- /dev/null
@@ -0,0 +1 @@
+<a href='{% url "tickle:route-detail" pk=route.pk %}'>{{ route.name }}</a>
index 859cfdb..bef2129 100644 (file)
@@ -15,11 +15,11 @@ class AttemptListView(ListView):
 attempt_list = AttemptListView.as_view()
 
 class BoulderDetailView(DetailView):
-    pass
+    model = models.Boulder
 boulder_detail = BoulderDetailView.as_view()
 
 class RouteDetailView(DetailView):
-    pass
+    model = models.Route
 route_detail = RouteDetailView.as_view()
 
 class TodoListView(ListView):