diff options
author | lxf <sng@luxagraf.net> | 2022-01-01 14:15:09 -0500 |
---|---|---|
committer | lxf <sng@luxagraf.net> | 2022-01-01 14:15:09 -0500 |
commit | 00e4023b3db50534296b0f3c808ddd22f01ef484 (patch) | |
tree | 6f72bfd7baf4284c19df483193726fb92eb1963d /app/locations | |
parent | 3fca752fb0613b8c2af2d94b9dca78fdee7a9d46 (diff) |
loc: fixed walk/track changes and updated templates
Diffstat (limited to 'app/locations')
-rw-r--r-- | app/locations/templates/locations/track_detail.html | 77 | ||||
-rw-r--r-- | app/locations/templates/locations/track_list.html | 34 | ||||
-rw-r--r-- | app/locations/templates/locations/walk_detail.html | 76 | ||||
-rw-r--r-- | app/locations/templates/locations/walk_list.html | 40 | ||||
-rw-r--r-- | app/locations/urls.py | 2 | ||||
-rw-r--r-- | app/locations/views.py | 16 | ||||
-rw-r--r-- | app/locations/walk_urls.py | 6 |
7 files changed, 127 insertions, 124 deletions
diff --git a/app/locations/templates/locations/track_detail.html b/app/locations/templates/locations/track_detail.html new file mode 100644 index 0000000..6339852 --- /dev/null +++ b/app/locations/templates/locations/track_detail.html @@ -0,0 +1,77 @@ +{% extends 'base.html' %} +{% load typogrify_tags %} +{%block bodyid%}class="detail"{%endblock%} +{% block breadcrumbs %}{% include "lib/breadcrumbs.html" with breadcrumbs=breadcrumbs %}{% endblock %} +{% block primary %} + <main> + <article class="h-entry hentry entry-content content" itemscope itemType="http://schema.org/BlogPosting"> + <header id="header" class="post-header"> + <h1 class="p-name post-title" itemprop="headline">{{object.title|smartypants|safe}}</h1> + {% if object.subtitle %}<h2 class="post-subtitle">{{object.subtitle|smartypants|safe}}</h2>{%endif%} + <div class="post-dateline"> + {% if object.location %}<div class="p-location h-adr adr post-location" itemprop="contentLocation" itemscope itemtype="http://schema.org/Place"> + <span class="h-adr" itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">{% if object.location.country_name == "United States" %} + <span class="p-locality locality" itemprop="addressLocality">{{object.location.name|smartypants|safe}}</span>, <a class="p-region region" href="/jrnl/united-states/" title="travel writing from the United States">{{object.location.state_name|safe}}</a>, <span class="p-country-name" itemprop="addressCountry">U.S.</span>{%else%} + <span class="p-region" itemprop="addressRegion">{{object.location.name|smartypants|safe}}</span>, <a class="p-country-name country-name" href="/jrnl/{{object.location.country_slug}}/" title="travel writing from {{object.location.country_name}}"><span itemprop="addressCountry">{{object.location.country_name|safe}}</span></a>{%endif%} + </span> + </div>{%endif%} + <time class="dt-published published dt-updated post-date" datetime="{{object.pub_date|date:'c'}}" itemprop="datePublished">{{object.pub_date|date:"F"}} <span>{{object.pub_date|date:"j, Y"}}</span></time> + <span class="hide" itemprop="author" itemscope itemtype="http://schema.org/Person">by <a class="p-author h-card" href="/about"><span itemprop="name">Scott Gilbertson</span></a></span> + </div> + </header> + + <div class="e-content entry-content post-body" itemprop="articleBody"> + <img src="{{object.get_image_url}}" alt="{{object.title}} map" /> + <div class="-cover"> + <dl class="book-metadata"> + {% if object.distance %}<dt>Distance</dt> + <dd>{{object.distance}} miles</dd>{%endif%} + {% if object.duration%}<dt>Duration</dt> + <dd>{{object.duration}} minutes</dd>{%endif%} + + {% if object.rating %}<dt>Rating</dt><dd class="book-stars"> + {% for i in object.ratings_range %}{% if i <= object.get_rating%}★{%else%}☆{%endif%}{%endfor%}</span></dd>{%endif%} + </dl> + <div class="e-content"> + <h5 class="card-smcaps">Notes</h5> + {{object.body_html|safe|smartypants}} + </div> + </div> + + {%if wildlife %}<div class="entry-footer"> + <aside id="wildlife"> + <h3>Fauna and Flora</h3> + {% regroup wildlife by ap.apclass.get_kind_display as wildlife_list %} + <ul> + {% for object_list in wildlife_list %} + <li class="grouper">{{object_list.grouper}}<ul> + {% for object in object_list.list %} + <li>{%if object.ap.body_markdown%}<a href="{% url 'sightings:detail' object.ap.slug %}">{{object}}</a>{%else%}{{object}}{%endif%} </li> + {% endfor %}</ul> + {% endfor %}</ul> + </aside> + {% endif %} + {%if entry_list %} + <aside {% if wildlife %}class="margin-left-none" {%endif%}id="field_notes"> + <h3>Related Posts</h3> + <ul>{% for obj in entry_list %} + <li><a href="{% url 'jrnl:detail' year=obj.pub_date.year month=obj.pub_date|date:"m" slug=obj.slug %}">{{obj}}</a></li> + {% endfor %}</ul> + </aside>{% endif %} + </article> + {% with object.get_next_published as next %} + {% with object.get_previous_published as prev %} + <div class="nav-wrapper"> + <nav id="page-navigation" {%if wildlife or object.field_notes.all or object.books.all %}{%else%}class="page-border-top"{%endif%}> + <ul>{% if prev%} + <li id="prev"><span class="bl">Previous:</span> + <a href="{{ prev.get_absolute_url }}" rel="prev" title=" {{prev.title}}">{{prev.title|safe}}</a> + </li>{%endif%}{% if next%} + <li id="next"><span class="bl">Next:</span> + <a href="{{ next.get_absolute_url }}" rel="next" title=" {{next.title}}">{{next.title|safe}}</a> + </li>{%endif%} + </ul> + </nav>{%endwith%}{%endwith%} + </div> + </main> +{% endblock %} diff --git a/app/locations/templates/locations/track_list.html b/app/locations/templates/locations/track_list.html new file mode 100644 index 0000000..20b36e3 --- /dev/null +++ b/app/locations/templates/locations/track_list.html @@ -0,0 +1,34 @@ +{% extends 'base.html' %} +{% load typogrify_tags %} +{% load html5_datetime %} +{% load pagination_tags %} +{% block pagetitle %}Walks.{% endblock %} +{% block metadescription %}{% endblock %} +{% block breadcrumbs %}{% include "lib/breadcrumbs.html" with breadcrumbs=breadcrumbs %}{% endblock %} + {% block primary %}<main role="main" class="archive-wrapper"> + <div class="archive-intro"> + <h2 class="archive-hed">Walks</h2> + <p>Walks, hikes, forays, whatever you wish to call them, are <a href="/meditation">meditations</a>. So this is not so much a record of physical activity as mental. If you're looking for awesome hikes, there might be some in here, but that's not primarily what I'm writing about when I write about walks.<p> + </div> + {% autopaginate object_list 24 %} + <ul class="archive-list">{% for object in object_list %} + <li class="h-entry hentry archive-list-card" itemscope itemType="http://schema.org/Article"> + {% if object.featured_image %}<a href="{{object.get_absolute_url}}" class="u-url"> + <div class="circle-img-wrapper"><img src="{{object.featured_image.get_thumbnail_url}}" alt="{{object.featured_image.alt}}" class="u-photo" /></div>{%endif%} + <span class="date dt-published card-smcaps">{{object.pub_date|date:"F Y"}}</span> + <span class="date dt-published card-smcaps">{{object.pub_date|date:"F d, Y"}}</span> + <a href="{% url 'locations:track-detail' object.slug %}"> + <h2 class="card-hed">{{object.title|safe|smartypants|widont}}</h2> + <p class="p-summary card-lede">{% if object.subtitle %}{{object.subtitle}}{%else%}{{object.meta_description|safe|smartypants|widont}}{%endif%}</p> + </a> + {% if object.location %}<h4 class="p-location h-adr card-location card-smcaps" itemprop="geo" itemscope itemtype="http://data-vocabulary.org/Geo"> + <span class="p-locality">{{object.location.name|smartypants|safe}}</span>, + <span class="p-region">{{object.location.state_name}}</span>, + <span class="p-country-name">{{object.location.country_name}}</span> + <data class="p-latitude" value="{{object.latitude}}"></data> + <data class="p-longitude" value="{{object.longitude}}"></data> + </h4>{% endif %} + </li> + {%endfor%}</ul> + </main> +{%endblock%} diff --git a/app/locations/templates/locations/walk_detail.html b/app/locations/templates/locations/walk_detail.html deleted file mode 100644 index f36a507..0000000 --- a/app/locations/templates/locations/walk_detail.html +++ /dev/null @@ -1,76 +0,0 @@ -{% extends 'base.html' %} -{% load typogrify_tags %} -{%block bodyid%}class="detail"{%endblock%} -{% block primary %}<ul class="bl crumbs" id="breadcrumbs" itemscope itemtype="http://data-vocabulary.org/Breadcrumb"> - <li><a href="/" title="luxagraf homepage" itemprop="url"><span itemprop="title">Home</span></a> → </li> - <li><a href="/walks/" itemprop="url"><span itemprop="title">Walks</span></a> →</li> - <li><a href="/walks/{{object.pub_date|date:"Y"}}/">{{object.date_walked|date:"Y"}}</a> →</li> - <li>{{object.title}}</li> - </ul> - <main> - <article class="h-entry hentry {% with object.get_template_name_display as t %}{%if t == "double" or t == "double-dark" %} post--article--double{%endif%}{%endwith%}" itemscope itemType="http://schema.org/BlogPosting"> - <header id="header" class="post-header {% with object.get_template_name_display as t %}{%if t == "double" or t == "double-dark" %}post--header--double{%endif%}{%endwith%}"> - <h1 class="p-name entry-title post-title" itemprop="headline">{%if object.template_name == 1 or object.template_name == 3 %}{{object.title|smartypants|safe}}{%else%}{{object.title|smartypants|safe}}{%endif%}</h1> - {% if object.subtitle %}<h2 class="post-subtitle">{{object.subtitle|smartypants|safe}}</h2>{%endif%} - <div class="post-linewrapper"> - {% if object.location %}<div class="p-location h-adr adr post-location" itemprop="contentLocation" itemscope itemtype="http://schema.org/Place"> - <h3 class="h-adr" itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">{% if object.location.country_name == "United States" %}<span class="p-locality locality" itemprop="addressLocality">{{object.location.name|smartypants|safe}}</span>, <a class="p-region region" href="/jrnl/united-states/" title="travel writing from the United States">{{object.location.state_name|safe}}</a>, <span class="p-country-name" itemprop="addressCountry">U.S.</span>{%else%}<span class="p-region" itemprop="addressRegion">{{object.location.name|smartypants|safe}}</span>, <a class="p-country-name country-name" href="/jrnl/{{object.location.country_slug}}/" title="travel writing from {{object.location.country_name}}"><span itemprop="addressCountry">{{object.location.country_name|safe}}</span></a>{%endif%}</h3> - </div>{%endif%} - <time class="dt-published published dt-updated post-date" datetime="{{object.date_walked|date:'c'}}" itemprop="datePublished">{{object.date_walked|date:"F"}} <span>{{object.date_walked|date:"j, Y"}}</span></time> - <span class="hide" itemprop="author" itemscope itemtype="http://schema.org/Person">by <a class="p-author h-card" href="/about"><span itemprop="name">Scott Gilbertson</span></a></span> - </div> - </header> - <img src="{{object.get_image_url}}" alt="{{object.title}} map" /> - - <div class="meta-cover"> - <dl class="book-metadata"> - {% if object.distance %}<dt>Distance</dt> - <dd>{{object.distance}} miles</dd>{%endif%} - {% if object.duration%}<dt>Duration</dt> - <dd>{{object.duration}} minutes</dd>{%endif%} - - {% if object.rating %}<dt>Rating</dt><dd class="book-stars"> - {% for i in object.ratings_range %}{% if i <= object.get_rating%}★{%else%}☆{%endif%}{%endfor%}</span></dd>{%endif%} - </dl> - <div class="e-content"> - <h5>Notes</h5> - {{object.body_html|safe|smartypants}} - </div> - - {%if wildlife %}<div class="entry-footer"> - <aside id="wildlife"> - <h3>Fauna and Flora</h3> - {% regroup wildlife by ap.apclass.get_kind_display as wildlife_list %} - <ul> - {% for object_list in wildlife_list %} - <li class="grouper">{{object_list.grouper}}<ul> - {% for object in object_list.list %} - <li>{%if object.ap.body_markdown%}<a href="{% url 'sightings:detail' object.ap.slug %}">{{object}}</a>{%else%}{{object}}{%endif%} </li> - {% endfor %}</ul> - {% endfor %}</ul> - </aside> - {% endif %} - {%if entry_list %} - <aside {% if wildlife %}class="margin-left-none" {%endif%}id="field_notes"> - <h3>Related Posts</h3> - <ul>{% for obj in entry_list %} - <li><a href="{% url 'jrnl:detail' year=obj.pub_date.year month=obj.pub_date|date:"m" slug=obj.slug %}">{{obj}}</a></li> - {% endfor %}</ul> - </aside>{% endif %} - </article> - {% with object.get_next_published as next %} - {% with object.get_previous_published as prev %} - <div class="nav-wrapper"> - <nav id="page-navigation" {%if wildlife or object.field_notes.all or object.books.all %}{%else%}class="page-border-top"{%endif%}> - <ul>{% if prev%} - <li id="prev"><span class="bl">Previous:</span> - <a href="{{ prev.get_absolute_url }}" rel="prev" title=" {{prev.title}}">{{prev.title|safe}}</a> - </li>{%endif%}{% if next%} - <li id="next"><span class="bl">Next:</span> - <a href="{{ next.get_absolute_url }}" rel="next" title=" {{next.title}}">{{next.title|safe}}</a> - </li>{%endif%} - </ul> - </nav>{%endwith%}{%endwith%} - </div> - </main> -{% endblock %} diff --git a/app/locations/templates/locations/walk_list.html b/app/locations/templates/locations/walk_list.html deleted file mode 100644 index 28d86ec..0000000 --- a/app/locations/templates/locations/walk_list.html +++ /dev/null @@ -1,40 +0,0 @@ -{% extends 'base.html' %} -{% load typogrify_tags %} -{% load html5_datetime %} -{% load pagination_tags %} -{% block pagetitle %}Walks.{% endblock %} -{% block metadescription %}{% endblock %} -{% block breadcrumbs %}<ul class="bl" id="breadcrumbs" itemscope itemtype="http://schema.org/BreadcrumbList"> - <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"> - <a href="/" title="luxagraf homepage" itemprop="item"> - <span itemprop="title">Home</span> - </a> → - </li> - <li itemprop="title">Walks</li> - </ul>{% endblock %} -{% block primary %}<main role="main" id="essay-archive" class="essay-archive archive-list"> - <div class="essay-intro"> - <h2>Walks</h2> - <h3>Walks, hikes, forays, whatever you wish to call them.</h3> - <p>Walking is [meditation](/meditation), particularly the discursive meditation I practice. So this is not so much a record of physical activity as mental. If you're looking for awesome hikes, there might be some in here, but don't expect details. That's not what I'm interested in recording.<p> - </div> - <h1 class="topic-hed">Walks</h1> - {% autopaginate object_list 30 %} - <ul class="fancy-archive-list">{% for object in object_list %} - <li class="h-entry hentry" itemscope itemType="http://schema.org/Article"> - <a href="{{object.get_absolute_url}}" class="u-url"> - <div class="circle-img-wrapper"><img src="{{object.featured_image.get_thumbnail_url}}" alt="{{object.featured_image.alt}}" class="u-photo" /></div> - <span class="date dt-published">{{object.pub_date|date:"F d, Y"}}</span> - <a href="{% url 'walks:walk-detail' object.slug %}"> - <h2>{{object.title|safe|smartypants|widont}}</h2> - {% if object.subtitle %}<h3 class="p-summary">{{object.subtitle|safe|smartypants|widont}}</h3>{%endif%} - </a> - {% if object.location %}<h4 class="p-location h-adr post-location" itemprop="geo" itemscope itemtype="http://data-vocabulary.org/Geo"> - <span class="p-locality">{{object.location.name|smartypants|safe}}</span>, - <span class="p-region">{{object.location.state_name}}</span>, - <span class="p-country-name">{{object.location.country_name}}</span> - </h4>{% endif %} - </li> - {%endfor%}</ul> - </main> -{%endblock%} diff --git a/app/locations/urls.py b/app/locations/urls.py index 1c8c1ed..b949b15 100644 --- a/app/locations/urls.py +++ b/app/locations/urls.py @@ -7,7 +7,7 @@ app_name = "locations" urlpatterns = [ path( r'<str:slug>', - views.TrackDetail.as_view(), + views.TrackDetailView.as_view(), name="track-detail" ), path( diff --git a/app/locations/views.py b/app/locations/views.py index 7487a17..666e9a3 100644 --- a/app/locations/views.py +++ b/app/locations/views.py @@ -100,11 +100,11 @@ class LocationDetail(DetailView): return context -class TrackDetail(DetailView): +class TrackDetailView(DetailView): model = Track def get_context_data(self, **kwargs): - context = super(WalkDetail, self).get_context_data(**kwargs) + context = super(TrackDetailView, self).get_context_data(**kwargs) context['entry_list'] = Post.objects.filter( Q(location=self.get_object().location) | Q(location__in=Location.objects.filter(parent=self.get_object().location)) @@ -113,12 +113,20 @@ class TrackDetail(DetailView): Q(location=self.get_object().location) | Q(location__in=Location.objects.filter(parent=self.get_object().location)) ).order_by('ap_id', 'ap__apclass__kind').distinct("ap") + context['breadcrumbs'] = ("walks",self.object.date_walked.year,self.object.title) return context -class TrackList(PaginatedListView): +class TrackListView(PaginatedListView): """ Return list of Walks """ model = Track - template_name = 'locations/walk_list.html' + + def get_context_data(self, **kwargs): + ''' + Add breadcrumb path + ''' + context = super(TrackListView, self).get_context_data(**kwargs) + context['breadcrumbs'] = ("walks",) + return context diff --git a/app/locations/walk_urls.py b/app/locations/walk_urls.py index f3ed6cc..92b2962 100644 --- a/app/locations/walk_urls.py +++ b/app/locations/walk_urls.py @@ -7,17 +7,17 @@ app_name = "walks" urlpatterns = [ path( r'<str:slug>', - views.TrackDetail.as_view(), + views.TrackDetailView.as_view(), name="track-detail" ), re_path( r'^(?P<page>\d+)/$', - views.TrackList.as_view(), + views.TrackListView.as_view(), name="track-list" ), re_path( r'', - views.TrackList.as_view(), + views.TrackListView.as_view(), {'page':1}, name="track-list" ), |