summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2015-07-21 11:25:38 -0400
committerluxagraf <sng@luxagraf.net>2015-07-21 11:25:38 -0400
commitd17b1b5b59fb3232b849a10a03efa16a6f98acb1 (patch)
treed34ebf957c5767bce995ebb05939db12c2459371
parentd964debb5a3e0814c1b3249bcc4616742e85bae5 (diff)
fixed date based archives
-rw-r--r--app/blog/urls.py4
-rw-r--r--app/blog/views.py18
-rw-r--r--app/builder/base.py5
-rw-r--r--design/sass/_writing_archive.scss40
-rw-r--r--design/templates/archives/writing_date.html22
5 files changed, 76 insertions, 13 deletions
diff --git a/app/blog/urls.py b/app/blog/urls.py
index f792527..eb69873 100644
--- a/app/blog/urls.py
+++ b/app/blog/urls.py
@@ -12,8 +12,8 @@ urlpatterns = patterns('',
urlpatterns = patterns('',
url(r'(?P<year>\d{4})/(?P<month>\d{2})/(?P<slug>[-\w]+)$', 'blog.views.entry_detail'),
- #url(r'(?P<year>\d{4})/(?P<month>\d{2})/$', 'blog.views.date_list', name="blog_by_month"),
- #url(r'(?P<year>\d{4})/$', 'blog.views.date_list', name="blog_by_year"),
+ url(r'(?P<year>\d{4})/(?P<month>\d{2})/$', 'blog.views.date_list', name="blog_by_month"),
+ url(r'(?P<year>\d{4})/$', 'blog.views.date_list', name="blog_by_year"),
(r'(?P<slug>[-\w]+)/(?P<page>\d+)/$', 'blog.views.entry_list_by_area'),
(r'(?P<page>\d+)/$', 'blog.views.entry_list'),
url(r'(?P<slug>[-\w]+)/$', RedirectView.as_view(url="/jrnl/%(slug)s/1/")),
diff --git a/app/blog/views.py b/app/blog/views.py
index be04e6c..c360ef3 100644
--- a/app/blog/views.py
+++ b/app/blog/views.py
@@ -45,6 +45,24 @@ class BlogEntryListView(ListView):
"""
+def date_list(request, year, month=None):
+ import datetime
+ if month:
+ month_name = datetime.datetime.strptime(month,'%m').strftime('%B')
+ context = {
+ 'object_list': Entry.objects.filter(status__exact=1, pub_date__year=year, pub_date__month=month).order_by('pub_date'),
+ 'type': 'monthly',
+ 'year': year,
+ 'month': month_name
+ }
+ else:
+ context = {
+ 'object_list': Entry.objects.filter(status__exact=1, pub_date__year=year).order_by('-pub_date'),
+ 'type': 'year',
+ 'year': year,
+ }
+ return render_to_response("archives/writing_date.html", context, context_instance=RequestContext(request))
+
def entry_list(request, page):
request.page_url = '/jrnl/%d/'
diff --git a/app/builder/base.py b/app/builder/base.py
index 2db5cb3..12d4f68 100644
--- a/app/builder/base.py
+++ b/app/builder/base.py
@@ -132,9 +132,8 @@ class BuildWriting(Build):
month_name = m.strftime('%b')
month_full_name = m.strftime('%B')
qs = entry.objects.filter(status__exact=1, pub_date__year=year,
- pub_date__month=month).order_by('-pub_date')
- c = Context({'type': 'monthly', 'date': '%s %s' % (
- month_full_name, year), 'object_list': qs, })
+ pub_date__month=month).order_by('pub_date')
+ c = Context({'type': 'monthly', 'year': year, 'month': month_full_name, 'object_list': qs, })
t = render_to_string('archives/writing_date.html', c).encode('utf-8')
fpath = 'jrnl/%s/%s/' % (year, month)
self.write_file(fpath, t)
diff --git a/design/sass/_writing_archive.scss b/design/sass/_writing_archive.scss
index c1970c9..7f3e01e 100644
--- a/design/sass/_writing_archive.scss
+++ b/design/sass/_writing_archive.scss
@@ -77,6 +77,46 @@
}
}
+.date-archive {
+ @extends %clearfix;
+ @include constrain_wide();
+ margin: 0 auto;
+ margin-bottom: 9em;
+ max-width: 460px !important;
+ text-align: left;
+}
+.dater {
+ @extends %clearfix;
+ margin-top: 3em;
+ margin-bottom: 3em;
+ span {
+ @include smcaps;
+ @include fontsize(11);
+ font-family: sans-serif;
+ }
+ ul {
+ margin-top: .5em;
+ margin-bottom: 1.5em;
+ li {
+ @extends %clearfix;
+ clear: both;
+ }
+ }
+
+}
+.arc-item {
+ clear: both;
+ margin: 0 auto;
+ a {
+ display: block;
+ float: left;
+ }
+ time {
+ float: right;
+ line-height: 36px;
+ }
+}
+
.pagination {
font-family: "carrois_gothicregular" sans-serif;
text-transform: uppercase;
diff --git a/design/templates/archives/writing_date.html b/design/templates/archives/writing_date.html
index 103d9df..dabe255 100644
--- a/design/templates/archives/writing_date.html
+++ b/design/templates/archives/writing_date.html
@@ -3,22 +3,28 @@
{% load html5_datetime %}
{% block pagetitle %}{{block.super}}: Archive{% endblock %}
{% block bodyid %}id="archive"{%endblock%}
-{% block primary %}
-<p>How did you get here? You URL chopping maniac you. Right on.</p>
-<h1>{% if type == 'year' %}{{date}}, on luxagraf{%else%} Archive: {{date}} {% endif %}</h1>{% if type == 'year' %}
- <ul class="archive">{% regroup object_list by pub_date.month as entries_by_month %}{% for entries in entries_by_month %}
- <li><span>{{ entries.list.0.pub_date|date:"F Y" }}</span>
+
+{% block primary %}<ul class="bl" 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="/jrnl/" title="See all Journal Entries" itemprop="url"><span itemprop="title">Journal</span></a> &rarr;</li>
+ <li>{% if type == 'year' %}{{year}}{%else%}<a href="/jrnl/{{year}}/">{{year}}</a> &rarr;{%endif%}</li>
+ {% if type == 'monthly' %}<li>{{month}}</li>{% endif %}
+ </ul>
+ <main role="main" id="writing-archive" class="archive">
+ <h1>{% if type == 'year' %}{{year}}, on luxagraf{%else%} Archive: {{month}} {{year}} {% endif %}</h1>{% if type == 'year' %}
+ <ul class="date-archive">{% regroup object_list by pub_date.month as entries_by_month %}{% for entries in entries_by_month %}
+ <li class="dater"><span>{{ entries.list.0.pub_date|date:"F Y" }}</span>
<ul>{% for post in entries.list %}
- <li>
+ <li class="arc-item">
<a href="{{post.get_absolute_url}}" title="{{post.title}}">{{post.title|smartypants|widont|safe }}</a>
<time datetime="{{post.pub_date|html5_datetime}}">{{post.pub_date|date:"M d, Y"}}</time>
</li> {% endfor %}
</ul>
</li>{% endfor %}
</ul>{% else %}
- <ul class="archive">{% for post in object_list %}
- <li><a href="{{post.get_absolute_url}}" title="{{post.title}}">{{post.title|smartypants|widont|safe }}</a>
+ <ul class="date-archive">{% for post in object_list %}
+ <li class="arc-item"><a href="{{post.get_absolute_url}}" title="{{post.title}}">{{post.title|smartypants|widont|safe }}</a>
<time datetime="{{post.pub_date|html5_datetime}}">{{post.pub_date|date:"M d, Y"}}</time>
</li> {% endfor %}
</ul>