summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2016-02-08 13:18:18 -0500
committerluxagraf <sng@luxagraf.net>2016-02-08 13:18:18 -0500
commitee6db3c3dc4dbe8903265fde6e799872dcd0fc71 (patch)
tree2ed524d3d81438219252a803696f731e6fdd56b3
parentfdb951576ff642d160bd66cba82179fa2ca247d7 (diff)
added note month and year archives
-rw-r--r--app/notes/urls.py11
-rw-r--r--app/notes/views.py16
-rw-r--r--design/sass/_notes.scss1
-rw-r--r--design/templates/archives/notes.html2
-rw-r--r--design/templates/archives/notes_date.html31
-rw-r--r--design/templates/details/note.html6
6 files changed, 47 insertions, 20 deletions
diff --git a/app/notes/urls.py b/app/notes/urls.py
index 00a8cce..0f9fad7 100644
--- a/app/notes/urls.py
+++ b/app/notes/urls.py
@@ -21,7 +21,16 @@ urlpatterns = [
views.NoteDetailView.as_view(),
name="detail"
),
-
+ url(
+ r'^(?P<year>[0-9]{4})/(?P<month>[0-9]{2})/$',
+ views.NoteMonthArchiveView.as_view(month_format='%m'),
+ name="list_month"
+ ),
+ url(
+ r'(?P<year>\d{4})/$',
+ views.NoteYearArchiveView.as_view(),
+ name="list_year"
+ ),
url(
diff --git a/app/notes/views.py b/app/notes/views.py
index b8bc04e..1fbe6f4 100644
--- a/app/notes/views.py
+++ b/app/notes/views.py
@@ -1,5 +1,6 @@
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
+from django.views.generic.dates import YearArchiveView, MonthArchiveView
from django.views.generic.detail import DetailView
from utils.views import PaginatedListView
@@ -29,6 +30,21 @@ class NoteDetailViewAMP(NoteDetailView):
template_name = "details/entry.amp"
+class NoteYearArchiveView(YearArchiveView):
+ queryset = LuxNote.objects.all()
+ date_field = "pub_date"
+ make_object_list = True
+ allow_future = True
+ template_name = "archives/notes_date.html"
+
+
+class NoteMonthArchiveView(MonthArchiveView):
+ queryset = LuxNote.objects.all()
+ date_field = "pub_date"
+ allow_future = True
+ template_name = "archives/notes_date.html"
+
+
"""
Legacy Notes views
"""
diff --git a/design/sass/_notes.scss b/design/sass/_notes.scss
index cdfdb42..1a6d35d 100644
--- a/design/sass/_notes.scss
+++ b/design/sass/_notes.scss
@@ -32,6 +32,7 @@
}
}
.note--title {
+ @include constrain_narrow;
text-align: left;
font-weight: 400;
font-size: 1.5em;
diff --git a/design/templates/archives/notes.html b/design/templates/archives/notes.html
index ed2a7be..9429831 100644
--- a/design/templates/archives/notes.html
+++ b/design/templates/archives/notes.html
@@ -2,7 +2,7 @@
{% load typogrify_tags %}
{% load html5_datetime %}
{% block pagetitle %} Field Notes | luxagraf {% endblock %}
-{% block metadescription %} The LongHandPixels Blog Archive, covering HTML, CSS and other web nerdery.{% endblock %}
+{% block metadescription %} Rough notes and sketches from the field {% endblock %}
{%block bodyid%}class="notes" id="notes-archive"{%endblock%}
{% block primary %}
diff --git a/design/templates/archives/notes_date.html b/design/templates/archives/notes_date.html
index 676a465..345a383 100644
--- a/design/templates/archives/notes_date.html
+++ b/design/templates/archives/notes_date.html
@@ -2,20 +2,21 @@
{% load typogrify_tags %}
{% load html5_datetime %}
{% load month_number_to_name %}
-{% block pagetitle %} Field Notes Published in {% if month %}{{month|month_number_to_name}}{%endif%} {{year}} | luxagraf{% endblock %}
-{% block bodyid %}class="notes" id="archive-{% if month %}{{month|month_number_to_name}}{%endif%}{{year}}"{%endblock%}
+{% block pagetitle %} Field Notes Published in {% if month %}{{month}}{%endif%} {{year}} | luxagraf{% endblock %}
+{% block bodyid %}class="notes" id="archive-{% if month %}{{month}}{%endif%}{{year}}"{%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> &rarr; </li>
<li><a href="/field-notes/" itemprop="url"><span itemprop="title">Field Notes</span></a> &rarr;</li>
- <li>{% if month %}<a href="/field-notes/{{year}}/" title="Field Notes published in {{year}}" itemprop="url">{%endif%}<span itemprop="title">{{year}}</span>{% if month %}</a> &rarr;{%endif%}</li>
- {% if month %}<li itemprop="title">{{month|month_number_to_name}}</li>{%endif%}
+ <li>{% if not month %}{{year|date:"Y"}}{%else%}<a href="/field-notes/{{month|date:"Y"}}/">{{month|date:"Y"}}</a> &rarr;{%endif%}</li>
+ {% if month %}<li itemprop="title">{{month|date:"F"}}</li>{% endif %}
</ul>
<main role="main">
- <h1>Field Notes Published in {% if month %}{{month|month_number_to_name}}{%endif%} {{year}}</h1>{% if month %}{% for object in object_list %}
+
+ <h1>Field Notes Published in {% if not month %}{{year|date:"Y"}}{%else%} {{month|date:"F Y"}}{% endif %}</h1>{% if month %}{% for object in object_list %}</h1>
<article class="h-entry">
- <h2 class="p-name note--title hide">{{object.title|safe|amp|smartypants}}</h2>
+ <h2 class="p-name note--title">{{object.title|safe|amp|smartypants}}</h2>
<div class="e-content">
- {{object.render|safe|amp|smartypants|urlizetrunc:45 }}
+ {{object.body_html|safe|amp|smartypants}}
</div>
<span class="p-author h-card">
<data class="p-name" value="Scott Gilbertson"></data>
@@ -23,11 +24,11 @@
</span>
<footer class="note--footer">
<p class="note--date">
- <a class="u-url" href="{{object.get_absolute_url}}" rel="bookmark"><time class="dt-published" datetime="{{object.date_created|html5_datetime}}">{{object.date_created|date:"F j, Y"}}</time></a>
+ <a class="u-url" href="{{object.get_absolute_url}}" rel="bookmark"><time class="dt-published" datetime="{{object.pub_date|html5_datetime}}">{{object.pub_date|date:"F j, Y"}}</time></a>
</p>{% if object.location %}
<p class="p-location h-adr note--location bl" itemprop="geo" itemscope itemtype="http://data-vocabulary.org/Geo">
<span class="p-locality">{{object.location.name|smartypants|safe}}</span>,
- <span class="p-region">{{object.state_name}}</span>,
+ <span class="p-region">{{object.location.state.name}}</span>,
<span class="p-country-name">{{object.location.state.country.name}}</span>
<data class="p-latitude" value="{{object.latitude}}"></data>
<data class="p-longitude" value="{{object.longitude}}"></data>
@@ -52,21 +53,21 @@
</article>
{% endfor %}
{% else %}
-{% regroup object_list by date_created.month as entries_by_month %}{% for month in entries_by_month %}
+{% regroup object_list by pub_date.month as entries_by_month %}{% for month in entries_by_month %}
<section class="month--divider">
- <h2 class="month--header">{{ month.list.0.date_created|date:"F Y" }}</h2>{% for object in month.list|dictsortreversed:"date_created" %}
+ <h2 class="month--header">{{ month.list.0.pub_date|date:"F Y" }}</h2>{% for object in month.list|dictsortreversed:"pub_date" %}
<article class="h-entry">
- <h2 class="p-name note--title hide">{{object.title|safe|amp|smartypants}}</h2>
+ <h2 class="p-name note--title">{{object.title|safe|amp|smartypants}}</h2>
<div class="e-content">
- {{object.render|safe|amp|smartypants|urlizetrunc:45 }}
+ {{object.body_html|safe|amp|smartypants }}
</div>
<footer class="note--footer">
<p class="note--date">
- <a class="u-url" href="{{object.get_absolute_url}}" rel="bookmark"><time class="dt-published" datetime="{{object.date_created|html5_datetime}}">{{object.date_created|date:"F j, Y"}}</time></a>
+ <a class="u-url" href="{{object.get_absolute_url}}" rel="bookmark"><time class="dt-published" datetime="{{object.pub_date|html5_datetime}}">{{object.pub_date|date:"F j, Y"}}</time></a>
</p>{% if object.location %}
<p class="p-location h-adr note--location bl" itemprop="geo" itemscope itemtype="http://data-vocabulary.org/Geo">
<span class="p-locality">{{object.location.name|smartypants|safe}}</span>,
- <span class="p-region">{{object.state_name}}</span>,
+ <span class="p-region">{{object.location.state.name}}</span>,
<span class="p-country-name">{{object.location.state.country.name}}</span>
<data class="p-latitude" value="{{object.latitude}}"></data>
<data class="p-longitude" value="{{object.longitude}}"></data>
diff --git a/design/templates/details/note.html b/design/templates/details/note.html
index 269d82a..c4847ec 100644
--- a/design/templates/details/note.html
+++ b/design/templates/details/note.html
@@ -2,7 +2,7 @@
{% load typogrify_tags %}
{% load html5_datetime %}
{% load month_number_to_name %}
-{% block pagetitle %}{{object.title|title|smartypants|safe}} - Luxagraf, Notes{% endblock %}
+{% block pagetitle %}{{object.title|title|smartypants|safe}} - Luxagraf, Field Notes{% endblock %}
{% block metadescription %}{{object.body_html|striptags|safe}}{% endblock %}
{%block extrahead%}
@@ -17,8 +17,8 @@
{% block primary %}
<main role="main">
- <article class="h-entry">
- <h1 class="p-name note--title hide">{{object.title|safe|amp|smartypants}}</h1>
+ <article class="h-entry post--article">
+ <h1 class="p-name note--title">{{object.title|safe|amp|smartypants}}</h1>
<div class="e-content">
{{object.body_html|safe|amp|smartypants}}
</div>