summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2016-12-28 11:09:19 -0500
committerluxagraf <sng@luxagraf.net>2016-12-28 11:09:19 -0500
commit7c30454db6b0643f8c3c1ff597ff8839845ad288 (patch)
tree9a906564b8af6ccad6d45ce5708fe173f10434dc
parentc9f8147ce58f95399cd84d9123a782e700d51c93 (diff)
rewrote pages builder to handle essays
-rw-r--r--app/builder/base.py2
-rw-r--r--app/builder/views.py10
-rw-r--r--app/pages/build.py27
-rw-r--r--design/templates/archives/essays.html22
4 files changed, 55 insertions, 6 deletions
diff --git a/app/builder/base.py b/app/builder/base.py
index 67a259e..f18523f 100644
--- a/app/builder/base.py
+++ b/app/builder/base.py
@@ -14,7 +14,7 @@ class _FileWriter(object):
"""
Given a path and text object; write the page to disc
"""
- def __init__(self, path, text_object, ext='html', filename='index', base_path=settings.FLATFILES_ROOT):
+ def __init__(self, path, text_object, ext='html', filename='index', base_path=settings.NFLATFILES_ROOT):
self.path = '%s%s' % (base_path, path)
if not os.path.isdir(self.path):
os.makedirs(self.path)
diff --git a/app/builder/views.py b/app/builder/views.py
index 1b537bd..1875a91 100644
--- a/app/builder/views.py
+++ b/app/builder/views.py
@@ -1,6 +1,6 @@
from django.shortcuts import render_to_response
from django.template import RequestContext
-from builder.base import BuildWriting, BuildWritingFeed, BuildMap, BuildPhotos, BuildProjects, BuildSitemap, BuildPages
+from builder.base import BuildWriting, BuildWritingFeed, BuildMap, BuildPhotos, BuildProjects, BuildSitemap
from src.build import builder as src_builder
from jrnl.build import archive_builder, detail_builder, home_builder, rss_builder, amp_builder
from resume.build import builder as resume_builder
@@ -9,12 +9,12 @@ from birds.build import builder as bird_builder
from photos.build import builder as photo_builder
from figments.build import builder as figments_builder
from notes.build import builder as notes_builder
+from pages.build import builder as page_builder
options = {
'writing': BuildWriting,
'photo_galleries': BuildPhotos,
'projects': BuildProjects,
- 'pages': BuildPages,
'map': BuildMap,
'feed': BuildWritingFeed,
'sitemap': BuildSitemap,
@@ -57,9 +57,9 @@ def do_build(request):
elif section == 'notes':
context = {'message': 'Writing notes to Disk'}
notes_builder()
- elif section == 'buildamp':
- context = {'message': 'Writing detail amp pages to Disk'}
- amp_builder()
+ elif section == 'pages':
+ context = {'message': 'Writing Pages to Disk'}
+ page_builder()
else:
options[section]().build()
context = {'message': 'Writing %s to Disk' % section}
diff --git a/app/pages/build.py b/app/pages/build.py
new file mode 100644
index 0000000..94719a2
--- /dev/null
+++ b/app/pages/build.py
@@ -0,0 +1,27 @@
+from django.template.loader import render_to_string
+from django.template import Context
+from django.core.urlresolvers import reverse
+from django.conf import settings
+
+from builder.base import BuildNew
+
+
+class BuildPages(BuildNew):
+ def build(self):
+ self.build_detail_view()
+ self.build_essays()
+ print("building pages")
+
+ def build_essays(self):
+ qs = self.model.objects.filter(path="essays")
+ c = Context({'object_list': qs, 'MEDIA_URL': settings.BAKED_MEDIA_URL, 'IMAGES_URL': settings.BAKED_IMAGES_URL})
+ t = render_to_string('archives/essays.html', c).encode('utf-8')
+ self.write_file('essays/', t)
+
+ def get_model_queryset(self):
+ return self.model.objects.all()
+
+
+def builder():
+ j = BuildPages("pages", "Page")
+ j.build()
diff --git a/design/templates/archives/essays.html b/design/templates/archives/essays.html
new file mode 100644
index 0000000..e5b1178
--- /dev/null
+++ b/design/templates/archives/essays.html
@@ -0,0 +1,22 @@
+{% extends 'base.html' %}
+{% load typogrify_tags %}
+{% load comments %}
+
+{% block pagetitle %}essay - archive{% endblock %}
+
+{% block metadescription %}luxagraf essays - thoughts things that aren't strictly travel related.{% 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>Essays</li>
+ </ul>
+ <main role="main" id="essay-archive" class="src-archive">
+ <h1 class="topic-hed">Essays </h1>
+ <h3 class="latest">Stuff that isn't really travel related</h3>
+ {% for object in object_list %}
+ <article class="h-entry hentry {% cycle 'odd' 'even' %} {% cycle 'first' 'second' 'third' %}" itemscope itemType="http://schema.org/Article">
+ <h2><a href="{{object.get_absolute_url}}">{{object.title|safe|smartypants|widont}}</a></h2>
+ <p>{{object.meta_description|safe|smartypants|widont}} <a href="{{object.get_absolute_url}}">Read&nbsp;more.</a></p>
+ </article>
+ {%endfor%}
+ </main>
+{%endblock%}