summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2015-12-07 22:12:41 -0500
committerluxagraf <sng@luxagraf.net>2015-12-07 22:12:41 -0500
commitabbe348602df0d4c32a1bad0960107d7eadc59a7 (patch)
tree06d865a0bdb5591c54bf8cfd07a2f94da72f5ebe
parent5dc9b251a29c79fdd0dafc9ef79318e8f213cb3a (diff)
finished up resume section
-rw-r--r--app/resume/build.py13
-rw-r--r--app/resume/urls.py11
-rw-r--r--app/resume/views.py13
-rw-r--r--design/sass/_resume.scss5
-rw-r--r--design/templates/archives/resume-pubs-by-pub.html24
-rw-r--r--design/templates/archives/resume-pubs.html5
6 files changed, 67 insertions, 4 deletions
diff --git a/app/resume/build.py b/app/resume/build.py
index 9d6ad60..964aba9 100644
--- a/app/resume/build.py
+++ b/app/resume/build.py
@@ -3,6 +3,8 @@ from django.core.urlresolvers import reverse
from builder.base import BuildNew
from pages.models import Page
+from .models import Publisher
+
class BuildResume(BuildNew):
@@ -10,8 +12,9 @@ class BuildResume(BuildNew):
self.build_detail_view()
self.build_list_view(
base_path=reverse("resume:live_redirect"),
- paginate_by=8
+ paginate_by=9999
)
+ self.build_publisher_list()
def get_model_queryset(self):
return self.model.objects.all()
@@ -26,6 +29,14 @@ class BuildResume(BuildNew):
print(path, slug)
self.write_file(path, response.content, filename=slug)
+ def build_publisher_list(self):
+ publishers = Publisher.objects.all()
+ for publisher in publishers:
+ self.build_list_view(
+ base_path=reverse("resume:live_publisher_redirect", kwargs={'publisher': publisher.slug, }),
+ paginate_by=9999
+ )
+
def build_pages(self):
'''
build out /resume and /resume/cv
diff --git a/app/resume/urls.py b/app/resume/urls.py
index 791f834..0d8b40a 100644
--- a/app/resume/urls.py
+++ b/app/resume/urls.py
@@ -12,10 +12,21 @@ urlpatterns = [
name='list',
),
url(
+ r'pubs/(?P<publisher>[-\w]+)/(?P<page>\d+)/$',
+ views.ByPublisherListView.as_view(),
+ name='list_by_publisher',
+ ),
+ url(
r'pubs/(?P<publisher>[-\w]+)/(?P<slug>[-\w]+)$',
views.PubItemDetailView.as_view(),
name='detail',
),
+ # redirect /slug/ to /slug/1/ for live server
+ url(
+ r'pubs/(?P<publisher>[-\w]+)/$',
+ RedirectView.as_view(url="/resume/pubs/%(publisher)s/1/", permanent=False),
+ name="live_publisher_redirect"
+ ),
url(
r'pubs/$',
RedirectView.as_view(url="/resume/pubs/1/", permanent=False),
diff --git a/app/resume/views.py b/app/resume/views.py
index d7230f7..15acf14 100644
--- a/app/resume/views.py
+++ b/app/resume/views.py
@@ -19,6 +19,19 @@ class PublisherListView(PaginatedListView):
return context
+class ByPublisherListView(PaginatedListView):
+ template_name = 'archives/resume-pubs-by-pub.html'
+
+ def get_queryset(self):
+ print(self.kwargs['publisher'])
+ return PubItem.objects.filter(publisher__slug=self.kwargs['publisher'])
+
+ def get_context_data(self, **kwargs):
+ # Call the base implementation first to get a context
+ context = super(ByPublisherListView, self).get_context_data(**kwargs)
+ context['publisher'] = Publisher.objects.get(slug=self.kwargs['publisher'])
+ return context
+
class PubItemDetailView(DetailView):
model = PubItem
template_name = "details/resume.html"
diff --git a/design/sass/_resume.scss b/design/sass/_resume.scss
index 157e88f..b66ecbe 100644
--- a/design/sass/_resume.scss
+++ b/design/sass/_resume.scss
@@ -122,7 +122,10 @@
content: "\00a0 \00a0"
}
}
-
+.publisher {
+ margin-top: 1em;
+ margin-bottom: 1em;
+}
.pub-title {
margin-bottom: 1.75em;
a {
diff --git a/design/templates/archives/resume-pubs-by-pub.html b/design/templates/archives/resume-pubs-by-pub.html
new file mode 100644
index 0000000..2313b48
--- /dev/null
+++ b/design/templates/archives/resume-pubs-by-pub.html
@@ -0,0 +1,24 @@
+{% extends 'base.html' %}
+{% load typogrify_tags %}
+{% load html5_datetime %}
+{% load pagination_tags %}
+{% block pagetitle %} Publications | Resume{% endblock %}
+{% block metadescription %} {% endblock %}
+{%block bodyid%}class="resume" id="publications-archive"{%endblock%}
+
+{% 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="/resume/">Resume</a> &rarr; </li>
+ <li><a href="/resume/pubs/">Publications</a> &rarr; </li>
+ <li>{{publisher}}</li>
+ </ul>
+ <main role="main">
+ <h1 class="entry-title publisher">Stories published in {{publisher}}</h1>
+ <ul class="publications-list">{% for object in object_list %}
+ <li class="pub-title"><h3><a href="{{object.get_absolute_url}}">{{object.title|amp|smartypants|widont|safe}}</a></h3>
+ <time class="dt-published published dt-updated" datetime="{{object.pub_date|date:'c'}}" itemprop="datePublished">{{object.pub_date|date:"F"}} <span>{{object.pub_date|date:"j, Y"}}</span></time>
+ </li>{% endfor %}
+ </ul>
+ </main>
+{% endblock %}
diff --git a/design/templates/archives/resume-pubs.html b/design/templates/archives/resume-pubs.html
index 16270b3..b0d914f 100644
--- a/design/templates/archives/resume-pubs.html
+++ b/design/templates/archives/resume-pubs.html
@@ -18,7 +18,7 @@
<nav class="toc"><ul>{% for publisher in pub_list %}
<li><a href="#{{publisher.name|slugify}}">{{publisher.name}}</a></li>{%endfor%}
</ul></nav>
- <ul class="publications-list">{% regroup object_list|dictsort:"publisher_id" by publisher.name as pub_list %}{% for pub in pub_list %}
+ <ul class="publications-list">{% regroup object_list|dictsort:"publisher_id" by publisher.name as pub_list %}{% for pub in pub_list %}{%if forloop.counter < 15 %}
<li>
<h2 id="{{pub.grouper|slugify}}">{{ pub.grouper }}</h2>
<ul>{% for object in pub.list %}
@@ -26,7 +26,8 @@
<time class="dt-published published dt-updated" datetime="{{object.pub_date|date:'c'}}" itemprop="datePublished">{{object.pub_date|date:"F"}} <span>{{object.pub_date|date:"j, Y"}}</span></time>
</li>{% endfor %}
</ul>
- </li>{% endfor %}
+ <a href="{% url "resume:live_publisher_redirect" pub.grouper|slugify %}">View all articles published by {{pub.grouper}}</a>
+ </li>{% endif %}{% endfor %}
</ul>
</main>
{% endblock %}