diff options
author | luxagraf <sng@luxagraf.net> | 2019-01-23 11:40:13 -0600 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2019-01-23 11:40:13 -0600 |
commit | 98c7a7d7831cb898b764a28907594fdf969045f5 (patch) | |
tree | 4fe911c44c04fe84e4986fca769095afb77e3890 | |
parent | c64a7d332fc39d2da93e412c72c459e8085c4d6d (diff) |
Fixed resume and pub builder
-rw-r--r-- | app/builder/views.py | 5 | ||||
-rw-r--r-- | app/resume/build.py | 49 | ||||
-rw-r--r-- | app/resume/urls.py | 33 | ||||
-rw-r--r-- | design/templates/admin/buttons.html | 1 | ||||
-rw-r--r-- | design/templates/archives/resume-pubs-by-pub.html | 8 | ||||
-rw-r--r-- | design/templates/archives/resume-pubs.html | 4 | ||||
-rw-r--r-- | design/templates/details/pubs.html | 4 | ||||
-rw-r--r-- | design/templates/details/resume.html | 11 |
8 files changed, 73 insertions, 42 deletions
diff --git a/app/builder/views.py b/app/builder/views.py index c708778..d7d3659 100644 --- a/app/builder/views.py +++ b/app/builder/views.py @@ -3,7 +3,7 @@ from django.template import RequestContext 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, map_builder -from resume.build import builder as resume_builder +from resume.build import pub_builder, resume_builder from books.build import builder as book_builder from sightings.build import builder as sightings_builder from photos.build import builder as photo_builder @@ -33,6 +33,9 @@ def do_build(request): elif section == 'resume': context = {'message': 'Writing Resume to Disk'} resume_builder() + elif section == 'pubs': + context = {'message': 'Writing Publications to Disk'} + pub_builder() elif section == 'buildrss': context = {'message': 'Writing RSS to Disk'} rss_builder() diff --git a/app/resume/build.py b/app/resume/build.py index 285521a..4f051d5 100644 --- a/app/resume/build.py +++ b/app/resume/build.py @@ -6,12 +6,15 @@ from pages.models import Page from .models import Publisher -class BuildResume(BuildNew): +class BuildPubs(BuildNew): def build(self): self.build_detail_view() self.build_publisher_list() - self.build_pages() + self.build_list_view( + base_path=reverse("resume:list"), + paginate_by=9999 + ) def get_model_queryset(self): return self.model.objects.all() @@ -19,6 +22,7 @@ class BuildResume(BuildNew): def build_detail_view(self): for obj in self.get_model_queryset(): url = obj.get_absolute_url() + print(url) path, slug = os.path.split(url) path = '%s/' % path # write html @@ -30,27 +34,42 @@ class BuildResume(BuildNew): publishers = Publisher.objects.all() for publisher in publishers: self.build_list_view( - base_path=reverse("resume:live_publisher_redirect", kwargs={'publisher': publisher.slug, }), + base_path=reverse("resume:list_by_publisher", kwargs={'publisher': publisher.slug, }), paginate_by=9999 ) + +class BuildResume(BuildNew): + + def build(self): + self.build_pages() + + def get_model_queryset(self): + return self.model.objects.all() + def build_pages(self): ''' - build out /resume and /resume/cv + build out /work/index.html and work/resume.html ''' - pages = Page.objects.filter(app="resume") + pages = self.get_model_queryset().filter(app="resume", build=True) for obj in pages: - url = obj.get_absolute_url() - path, slug = os.path.split(url) - path = '%s/' % path - # write html - response = self.client.get(url) - if obj.slug == "resume": - path = "/resume/" + path = "work/" + if obj.slug == "profile": + url = '/work/' slug = "index" - print(path, slug) + else: + url = "/%s%s/" % (path, obj.slug) + slug = obj.slug + # write html + response = self.client.get(url, HTTP_HOST='127.0.0.1') self.write_file(path, response.content, filename=slug) -def builder(): - j = BuildResume("resume", "pubitem") + +def pub_builder(): + j = BuildPubs("resume", "pubitem") + j.build() + + +def resume_builder(): + j = BuildResume("pages", "page") j.build() diff --git a/app/resume/urls.py b/app/resume/urls.py index 0086a2b..de95866 100644 --- a/app/resume/urls.py +++ b/app/resume/urls.py @@ -7,16 +7,15 @@ app_name = "resume" urlpatterns = [ path( - r'', - views.PageView.as_view(), - {'path': 'work', 'slug': 'profile'}, - name="pages" + r'pubs/<str:publisher>/<int:page>/', + views.ByPublisherListView.as_view(), + name='list_by_publisher', ), path( - r'<str:slug>/', - views.PageView.as_view(), - {'path': 'work'}, - name="pages" + r'pubs/<str:publisher>/', + views.ByPublisherListView.as_view(), + {'page': 1}, + name='list_by_publisher', ), path( r'pubs/<str:page>/', @@ -30,18 +29,20 @@ urlpatterns = [ name="list" ), path( - r'pubs/<str:publisher>/<int:page>/', - views.ByPublisherListView.as_view(), - name='list_by_publisher', - ), - path( r'pubs/<str:publisher>/<str:slug>', views.PubItemDetailView.as_view(), name='detail', ), path( - r'pubs/(?P<publisher>[-\w]+)/$', - RedirectView.as_view(url="/resume/pubs/%(publisher)s/1/", permanent=False), - name="live_publisher_redirect" + r'<str:slug>/', + views.PageView.as_view(), + {'path': 'work'}, + name="pages" + ), + path( + r'', + views.PageView.as_view(), + {'path': 'work', 'slug': 'profile'}, + name="pages" ), ] diff --git a/design/templates/admin/buttons.html b/design/templates/admin/buttons.html index 3e8980d..d0d4f34 100644 --- a/design/templates/admin/buttons.html +++ b/design/templates/admin/buttons.html @@ -52,6 +52,7 @@ <li class="item"><a href="/admin/build/build?id=projects">Build Project Pages</a></li> <li class="item"><a href="/admin/build/build?id=buildbooks">Build Books</a></li> <li class="item"><a href="/admin/build/build?id=buildsightings">Build Sightings</a></li> + <li class="item"><a href="/admin/build/build?id=pubs">Build Publications</a></li> <li class="item"><a href="/admin/build/build?id=resume">Build Resume</a></li> <li class="item"><a href="/admin/build/build?id=src">Build src</a></li> <li class="item"><a href="/admin/build/build?id=figments">Build Figments</a></li> diff --git a/design/templates/archives/resume-pubs-by-pub.html b/design/templates/archives/resume-pubs-by-pub.html index bb2c624..575313e 100644 --- a/design/templates/archives/resume-pubs-by-pub.html +++ b/design/templates/archives/resume-pubs-by-pub.html @@ -5,17 +5,19 @@ {% block pagetitle %} Publications | Resume{% endblock %} {% block metadescription %} {% endblock %} {%block bodyid%}class="resume" id="publications-archive"{%endblock%} - +{%block htmlclass%}class="detail"{% 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> → </li> - <li><a href="/resume/">Resume</a> → </li> - <li><a href="/resume/pubs/">Publications</a> → </li> + <li><a href="/work/">Work</a> → </li> + <li><a href="/work/pubs/">Publications</a> → </li> <li>{{publisher}}</li> </ul> <main role="main"> <h1 class="entry-title publisher">(Most) Stories published in {{publisher}}</h1> + <article> {{ publisher.body_html|safe|widont|smartypants}} + </article> <hr /> <ul class="publications-list">{% for object in object_list %} <li class="pub-title"><h3><a href="{{object.url}}">{{object.title|amp|smartypants|widont|safe}}</a></h3> diff --git a/design/templates/archives/resume-pubs.html b/design/templates/archives/resume-pubs.html index 332a812..26b4936 100644 --- a/design/templates/archives/resume-pubs.html +++ b/design/templates/archives/resume-pubs.html @@ -9,7 +9,7 @@ {% 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> → </li> - <li><a href="/resume/">Resume</a> → </li> + <li><a href="/work/">Work</a> → </li> <li>Publications</li> </ul> <main> @@ -26,7 +26,7 @@ <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> (<a href="{{object.get_absolute_url}}">local verson</a>) </li>{%endif%}{% endfor %} </ul> - <a href="{% url "resume:live_publisher_redirect" pub.grouper|slugify %}">View all articles published by {{pub.grouper}}</a> + <a href="{% url "resume:list_by_publisher" pub.grouper|slugify %}">View all articles published by {{pub.grouper}}</a> </li>{% endfor %} </ul> </main> diff --git a/design/templates/details/pubs.html b/design/templates/details/pubs.html index ff16bbe..c196a8d 100644 --- a/design/templates/details/pubs.html +++ b/design/templates/details/pubs.html @@ -8,8 +8,8 @@ {% 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> → </li> - <li><a href="/resume">Resume</a>{% if object.title != "Resume" %} → {%endif%}</li> - {% if object.title != "Resume" %}<li><a href="/resume/pubs/">Publications</a></li>{%endif%} + <li><a href="/work">Work</a>{% if object.title != "Resume" %} → {%endif%}</li> + {% if object.title != "Resume" %}<li><a href="/work/pubs/">Publications</a></li>{%endif%} </ul> <main> <article> diff --git a/design/templates/details/resume.html b/design/templates/details/resume.html index 860b03b..1608934 100644 --- a/design/templates/details/resume.html +++ b/design/templates/details/resume.html @@ -3,13 +3,13 @@ {% block pagetitle %}Scott Gilbertson - Curriculum Vitæ{%endblock%} {% block extrahead%} <meta name="twitter:card" content="summary"> - <meta name="twitter:title" content="Curriculum Vitæ"> + <meta name="twitter:title" content="Resume of Scott Gilbertson"> <meta name="twitter:description" content="luxagraf.net is the personal web site of Scott gilbertson."> <meta name="twitter:site:id" content="9469062"> <meta name="twitter:creator:id" content="9469062"> <meta property="og:type" content="article"/> - <meta property="og:title" content="Scott Gilbertson - Curriculum Vitæ"/> - <meta property="og:url" content="http://luxagraf.net/resume/cv"/> + <meta property="og:title" content="Scott Gilbertson - Resume"/> + <meta property="og:url" content="http://luxagraf.net/work/resume/"/> <meta property="og:description" content="luxagraf.net is the personal web site of Scott gilbertson."> <meta property="article:author" content="Scott Gilbertson"/> <meta property="og:site_name" content="luxagraf.net"/> @@ -20,6 +20,11 @@ {%block htmlclass %}class="detail"{%endblock%} {% block primary %} <main role="main" id="content"> + <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> → </li> + <li><a href="/work/">Work</a> → </li> + <li>Resume</li> + </ul> <article class="h-resume"> <div class="h-card head"> <header> |