diff options
23 files changed, 748 insertions, 4 deletions
diff --git a/app/essays/migrations/0010_essay_field_notes.py b/app/essays/migrations/0010_essay_field_notes.py new file mode 100644 index 0000000..ca15b38 --- /dev/null +++ b/app/essays/migrations/0010_essay_field_notes.py @@ -0,0 +1,19 @@ +# Generated by Django 2.1.7 on 2019-07-04 09:03 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('fieldnotes', '0002_auto_20190303_1222'), + ('essays', '0009_merge_20190414_1500'), + ] + + operations = [ + migrations.AddField( + model_name='essay', + name='field_notes', + field=models.ManyToManyField(blank=True, to='fieldnotes.FieldNote'), + ), + ] diff --git a/app/guides/__init__.py b/app/guides/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/app/guides/__init__.py diff --git a/app/guides/admin.py b/app/guides/admin.py new file mode 100644 index 0000000..e424385 --- /dev/null +++ b/app/guides/admin.py @@ -0,0 +1,50 @@ +from django.contrib import admin + +from utils.widgets import LGEntryForm + +from .models import Guide + +@admin.register(Guide) +class GuideAdmin(admin.ModelAdmin): + form = LGEntryForm + list_display = ('title', 'pub_date', 'enable_comments', 'status') + list_filter = ('pub_date', 'enable_comments', 'status') + prepopulated_fields = {"slug": ('title',)} + fieldsets = ( + ('Entry', { + 'fields': ( + 'title', + ('sub_title', 'category'), + 'body_markdown', + ('pub_date', 'status'), + 'meta_description', + 'dek', + 'tags', + 'preamble_markdown', + 'featured_image', + 'has_video', + ('slug', 'enable_comments'), + ), + 'classes': ( + 'show', + 'extrapretty', + 'wide' + ) + }), + ('meta', { + 'fields': ( + 'point', + 'afterword', + ('field_notes', 'books'), + ('essays', 'jrnl'), + ), + 'classes': ( + 'hide', + 'extrapretty', + 'wide' + ) + }), + ) + + class Media: + js = ('image-loader.js', 'next-prev-links.js') diff --git a/app/guides/build.py b/app/guides/build.py new file mode 100644 index 0000000..392e991 --- /dev/null +++ b/app/guides/build.py @@ -0,0 +1,22 @@ +import os +from builder.base import BuildNew +from django.urls import reverse +from . import models + + +class BuildEssays(BuildNew): + + def build(self): + self.build_list_view() + self.build_detail_view() + # These are the unique classes for this model: + #self.build_feed("src:feed") + + def build_list_view(self): + response = self.client.get('/essays/') + self.write_file('essays/', response.content) + + +def essaybuilder(): + j = BuildEssays("essays", "essay") + j.build() diff --git a/app/guides/migrations/0001_initial.py b/app/guides/migrations/0001_initial.py new file mode 100644 index 0000000..833dfbe --- /dev/null +++ b/app/guides/migrations/0001_initial.py @@ -0,0 +1,60 @@ +# Generated by Django 2.1.7 on 2019-07-04 09:03 + +import django.contrib.gis.db.models.fields +from django.db import migrations, models +import django.db.models.deletion +import taggit.managers + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('jrnl', '0043_auto_20190704_0903'), + ('books', '0009_book_afflink'), + ('photos', '0019_auto_20190704_0903'), + ('fieldnotes', '0002_auto_20190303_1222'), + ('locations', '0018_auto_20190414_2124'), + ('essays', '0010_essay_field_notes'), + ('taxonomy', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='Guide', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=200)), + ('sub_title', models.CharField(blank=True, max_length=200)), + ('dek', models.TextField(blank=True)), + ('preamble_markdown', models.TextField(blank=True)), + ('preamble_html', models.TextField(blank=True)), + ('slug', models.SlugField(unique_for_date='pub_date')), + ('body_html', models.TextField(blank=True)), + ('body_markdown', models.TextField()), + ('pub_date', models.DateTimeField(verbose_name='Date published')), + ('last_updated', models.DateTimeField(auto_now=True)), + ('enable_comments', models.BooleanField(default=False)), + ('status', models.IntegerField(choices=[(0, 'Draft'), (1, 'Published')], default=0)), + ('meta_description', models.CharField(blank=True, max_length=256, null=True)), + ('has_video', models.BooleanField(blank=True, default=False)), + ('point', django.contrib.gis.db.models.fields.PointField(blank=True, null=True, srid=4326)), + ('afterword', models.TextField(blank=True)), + ('afterword_html', models.TextField(blank=True)), + ('books', models.ManyToManyField(blank=True, to='books.Book')), + ('category', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='taxonomy.Category')), + ('essays', models.ManyToManyField(blank=True, to='essays.Essay')), + ('featured_image', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='photos.LuxImage')), + ('field_notes', models.ManyToManyField(blank=True, to='fieldnotes.FieldNote')), + ('jrnl', models.ManyToManyField(blank=True, to='jrnl.Entry')), + ('location', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='locations.Location')), + ('tags', taggit.managers.TaggableManager(blank=True, help_text='Topics Covered', through='taxonomy.TaggedItems', to='taxonomy.LuxTag', verbose_name='Tags')), + ], + options={ + 'verbose_name_plural': 'Guides', + 'ordering': ('-pub_date',), + 'get_latest_by': 'pub_date', + }, + ), + ] diff --git a/app/guides/migrations/__init__.py b/app/guides/migrations/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/app/guides/migrations/__init__.py diff --git a/app/guides/models.py b/app/guides/models.py new file mode 100644 index 0000000..1583bee --- /dev/null +++ b/app/guides/models.py @@ -0,0 +1,88 @@ +from django.contrib.gis.db import models +from django.urls import reverse +from django.contrib.sitemaps import Sitemap +import datetime +from itertools import chain + +from taggit.managers import TaggableManager + +from taxonomy.models import TaggedItems, Category +from utils.util import render_images, markdown_to_html +from fieldnotes.models import FieldNote +from books.models import Book +from locations.models import Location +from photos.models import LuxImage +from essays.models import Essay +from jrnl.models import Entry + + +class Guide(models.Model): + title = models.CharField(max_length=200) + sub_title = models.CharField(max_length=200, blank=True) + dek = models.TextField(blank=True) + preamble_markdown = models.TextField(blank=True) + preamble_html = models.TextField(blank=True) + slug = models.SlugField(unique_for_date='pub_date') + body_html = models.TextField(blank=True) + body_markdown = models.TextField() + pub_date = models.DateTimeField('Date published') + last_updated = models.DateTimeField(auto_now=True) + enable_comments = models.BooleanField(default=False) + PUB_STATUS = ( + (0, 'Draft'), + (1, 'Published'), + ) + status = models.IntegerField(choices=PUB_STATUS, default=0) + meta_description = models.CharField(max_length=256, null=True, blank=True) + tags = TaggableManager(through=TaggedItems, blank=True, help_text='Topics Covered') + category = models.ForeignKey(Category, on_delete=models.CASCADE) + featured_image = models.ForeignKey(LuxImage, on_delete=models.CASCADE, null=True, blank=True) + has_video = models.BooleanField(blank=True, default=False) + field_notes = models.ManyToManyField(FieldNote, blank=True) + books = models.ManyToManyField(Book, blank=True) + essays = models.ManyToManyField(Essay, blank=True) + jrnl = models.ManyToManyField(Entry, blank=True) + point = models.PointField(null=True, blank=True) + location = models.ForeignKey(Location, on_delete=models.CASCADE, null=True, blank=True) + afterword = models.TextField(blank=True) + afterword_html = models.TextField(blank=True) + + class Meta: + ordering = ('-pub_date',) + get_latest_by = 'pub_date' + verbose_name_plural = 'Guides' + + def __str__(self): + return self.title + + def get_absolute_url(self): + return reverse('guides:detail', kwargs={"category": self.category, "slug": self.slug}) + + def comment_period_open(self): + return self.enable_comments and datetime.datetime.today() - datetime.timedelta(30) <= self.pub_date + + @property + def get_previous_published(self): + return self.get_previous_by_pub_date(status__exact=1) + + @property + def get_next_published(self): + return self.get_next_by_pub_date(status__exact=1) + + def save(self): + md = render_images(self.body_markdown) + self.body_html = markdown_to_html(md) + self.afterword_html = markdown_to_html(self.afterword) + super(Guide, self).save() + + +class GuideSitemap(Sitemap): + changefreq = "never" + priority = 1.0 + protocol = "https" + + def items(self): + return Guide.objects.filter(status=1) + + def lastmod(self, obj): + return obj.pub_date diff --git a/app/guides/urls.py b/app/guides/urls.py new file mode 100644 index 0000000..c91a5b5 --- /dev/null +++ b/app/guides/urls.py @@ -0,0 +1,34 @@ +from django.urls import path, re_path + +from . import views + +app_name = "guides" + +urlpatterns = [ + path( + r'', + views.GuideListView.as_view(), + {'page': 1}, + name="list" + ), + path( + r'<int:page>/', + views.GuideListView.as_view(), + name="list" + ), + path( + r'<str:category>/<str:slug>', + views.GuideDetailView.as_view(), + name="detail" + ), + path( + r'<str:category>/<str:slug>', + views.GuideDetailViewTXT.as_view(), + name="detail-txt" + ), + path( + r'<str:category>', + views.GuideCatListView.as_view(), + name="list-cat" + ), +] diff --git a/app/guides/views.py b/app/guides/views.py new file mode 100644 index 0000000..8b5aeaa --- /dev/null +++ b/app/guides/views.py @@ -0,0 +1,55 @@ +from django.views.generic import ListView +from django.views.generic.detail import DetailView +from django.contrib.syndication.views import Feed + +from utils.views import PaginatedListView + +from .models import Guide + + +class GuideListView(PaginatedListView): + model = Guide + + def get_queryset(self, **kwargs): + qs = Guide.objects.filter(status=1) + return qs + +class GuideCatListView(PaginatedListView): + model = Guide + + def get_queryset(self, **kwargs): + cat = Category.objects.get(slug=self.kwargs['slug']) + qs = Guide.objects.filter(status=1, category=cat) + return qs + +class GuideDetailView(DetailView): + model = Guide + + +class GuideDetailViewTXT(GuideDetailView): + template_name = "essays/entry_detail.txt" + + +''' +class TopicListView(ListView): + template_name = 'archives/src_home.html' + + def queryset(self): + return Post.objects.filter(topics__slug=self.kwargs['slug']) + + def get_context_data(self, **kwargs): + # Call the base implementation first to get a context + context = super(TopicListView, self).get_context_data(**kwargs) + context['topic'] = Topic.objects.get(slug__exact=self.kwargs['slug']) + return context + + +class SrcRSSFeedView(Feed): + title = "luxagraf:src Code and Technology" + link = "/src/" + description = "Latest postings to luxagraf.net/src" + description_template = 'feeds/blog_description.html' + + def items(self): + return Post.objects.filter(status__exact=1).order_by('-pub_date')[:10] +''' diff --git a/app/jrnl/migrations/0042_auto_20190412_1805.py b/app/jrnl/migrations/0042_auto_20190412_1805.py new file mode 100644 index 0000000..71c0d51 --- /dev/null +++ b/app/jrnl/migrations/0042_auto_20190412_1805.py @@ -0,0 +1,24 @@ +# Generated by Django 2.1.7 on 2019-04-12 18:05 + +import django.contrib.postgres.indexes +import django.contrib.postgres.search +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0041_auto_20190315_2240'), + ] + + operations = [ + migrations.AddField( + model_name='entry', + name='search_document', + field=django.contrib.postgres.search.SearchVectorField(null=True), + ), + migrations.AddIndex( + model_name='entry', + index=django.contrib.postgres.indexes.GinIndex(fields=['search_document'], name='jrnl_entry_search__a7a10f_gin'), + ), + ] diff --git a/app/jrnl/migrations/0043_auto_20190704_0903.py b/app/jrnl/migrations/0043_auto_20190704_0903.py new file mode 100644 index 0000000..758499a --- /dev/null +++ b/app/jrnl/migrations/0043_auto_20190704_0903.py @@ -0,0 +1,21 @@ +# Generated by Django 2.1.7 on 2019-07-04 09:03 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0042_auto_20190412_1805'), + ] + + operations = [ + migrations.RemoveIndex( + model_name='entry', + name='jrnl_entry_search__a7a10f_gin', + ), + migrations.RemoveField( + model_name='entry', + name='search_document', + ), + ] diff --git a/app/locations/migrations/0018_auto_20190414_2124.py b/app/locations/migrations/0018_auto_20190414_2124.py new file mode 100644 index 0000000..3d8a02c --- /dev/null +++ b/app/locations/migrations/0018_auto_20190414_2124.py @@ -0,0 +1,23 @@ +# Generated by Django 2.1.7 on 2019-04-14 21:24 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('locations', '0017_auto_20190217_1849'), + ] + + operations = [ + migrations.AddField( + model_name='location', + name='description', + field=models.TextField(blank=True), + ), + migrations.AddField( + model_name='location', + name='description_html', + field=models.TextField(blank=True), + ), + ] diff --git a/app/locations/models.py b/app/locations/models.py index 50fda3d..f160b1f 100644 --- a/app/locations/models.py +++ b/app/locations/models.py @@ -134,6 +134,8 @@ class Location(models.Model): country_slug = models.CharField(max_length=50, blank=True) region_name = models.CharField(max_length=50, blank=True) region_slug = models.CharField(max_length=50, blank=True) + description = models.TextField(blank=True) + description_html = models.TextField(blank=True) class Meta: ordering = ('-pub_date',) @@ -170,6 +172,7 @@ class Location(models.Model): self.country_slug = self.state.country.slug self.region_name = self.state.country.lux_region.name self.region_slug = self.state.country.lux_region.slug + self.description_html = markdown_to_html(self.description) super(Location, self).save() class Route(models.Model): diff --git a/app/photos/migrations/0019_auto_20190704_0903.py b/app/photos/migrations/0019_auto_20190704_0903.py new file mode 100644 index 0000000..833ee69 --- /dev/null +++ b/app/photos/migrations/0019_auto_20190704_0903.py @@ -0,0 +1,17 @@ +# Generated by Django 2.1.7 on 2019-07-04 09:03 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('photos', '0018_auto_20161130_1218'), + ] + + operations = [ + migrations.AlterModelOptions( + name='luximagesize', + options={'ordering': ('-name', 'id'), 'verbose_name_plural': 'Image Sizes'}, + ), + ] diff --git a/app/sightings/models.py b/app/sightings/models.py index 7527615..2a14e85 100644 --- a/app/sightings/models.py +++ b/app/sightings/models.py @@ -201,6 +201,8 @@ class Sighting(models.Model): self.location = Location.objects.filter(geometry__contains=self.point).get() except Location.MultipleObjectsReturned: for l in Location.objects.filter(geometry__contains=self.point): + print(l) + print(l.parent) if l.parent: self.location = l break diff --git a/config/base_urls.py b/config/base_urls.py index 8a699ba..a7b8d04 100644 --- a/config/base_urls.py +++ b/config/base_urls.py @@ -46,6 +46,7 @@ urlpatterns = [ path(r'locations/', include('locations.urls')), path(r'expenses/', include('expenses.urls', namespace='expenses')), path(r'photos/', include('photos.urls')), + path(r'guides/', include('guides.urls')), path(r'book-notes/', include('books.urls')), path(r'people/', include('people.urls')), path(r'dialogues/', include('sightings.urls', namespace='sightings')), @@ -53,7 +54,6 @@ urlpatterns = [ path(r'src/', include('src.urls', namespace='src')), path(r'tools/', include('essays.urls', namespace='tools')), path(r'essays/', include('essays.urls', namespace='essays')), - path(r'figments/', include('figments.urls', namespace='figments')), path(r'work/', include('resume.urls', namespace='resume')), path(r'map', include('locations.urls', namespace='map')), path(r'map/', include('locations.urls', namespace='map')), diff --git a/design/sass/_header.scss b/design/sass/_header.scss index 8070ae7..445a0ad 100644 --- a/design/sass/_header.scss +++ b/design/sass/_header.scss @@ -35,7 +35,7 @@ .sitesubtitle { display: block; margin-top: -8px; - font-family: fancy_serif; + font-family: $fancy_serif; font-style: italic; font-weight: 300; @include fontsize(12); diff --git a/design/sass/_images.scss b/design/sass/_images.scss index faf6e88..4c0951c 100644 --- a/design/sass/_images.scss +++ b/design/sass/_images.scss @@ -1,4 +1,4 @@ -.picwide, .cluster { +.picwide, .cluster, .pic960 { // this clever bit comes from https://css-tricks.com/full-width-containers-limited-width-parents/ // I tweaked it slightly to add a bit of margin width: 96vw; diff --git a/design/templates/essays/essay_list.html b/design/templates/essays/essay_list.html index e201716..9c20abe 100644 --- a/design/templates/essays/essay_list.html +++ b/design/templates/essays/essay_list.html @@ -12,7 +12,7 @@ <div class="essay-intro"> <h2>My various articles and essays collected in one spot.</h2> <p>Topics include travel, writing, photography, free software, culture, and once, Del Taco.</p> - <p>Many essays below were previously published in: <em><a href="https://www.wired.com/author/scott-gilbertson/">Wired</a></em>, <em><a href="https://www.budgettravel.com/article/0902_HTTN_SocialNetwork_5488">Budget Travel</a></em>, <em><a href="https://arstechnica.com/">Ars Technica</a></em>, <em><a href="https://web.archive.org/web/20100904114555/http://one.longshotmag.com/article/going-for-seconds">Longshot Magazine</a>,</em> <em><a href="https://web.archive.org/web/20150506051746/http://1888.center/scott-gilbertson/">The Cost of Paper</a></em> and elsewhere.</a></p> + <p>Many essays below were previously published in: <em><a href="https://www.wired.com/author/scott-gilbertson/">WIRED</a></em>, <em><a href="https://www.budgettravel.com/article/0902_HTTN_SocialNetwork_5488">Budget Travel</a></em>, <em><a href="https://arstechnica.com/">Ars Technica</a></em>, <em><a href="https://web.archive.org/web/20100904114555/http://one.longshotmag.com/article/going-for-seconds">Longshot Magazine</a>,</em> <em><a href="https://web.archive.org/web/20150506051746/http://1888.center/scott-gilbertson/">The Cost of Paper</a></em> and elsewhere.</a></p> </div> <h1 class="topic-hed">Essays</h1> <ul>{% for object in object_list %} diff --git a/design/templates/guides/guide_detail.html b/design/templates/guides/guide_detail.html new file mode 100644 index 0000000..1ef602a --- /dev/null +++ b/design/templates/guides/guide_detail.html @@ -0,0 +1,176 @@ +{% extends 'base.html' %} +{% load typogrify_tags %} +{% load comments %} +{%block htmlclass%}class="detail single"{%endblock%} +{% block pagetitle %}{{object.title|title|smartypants|safe}} - by Scott Gilbertson{% endblock %} + +{% block metadescription %}{% autoescape on %}{{object.meta_description|striptags|safe}}{% endautoescape %}{% endblock %} +{%block extrahead%} +{% if object.has_code %} + <link rel="stylesheet" href="/media/src/solarized.css" type="text/css" media="screen"/> +{%endif %} + <link rel="canonical" href="https://luxagraf.net{{object.get_absolute_url}}" /> + <meta property="og:type" content="article" /> + <meta property="og:title" content="{{object.title|safe}}" /> + <meta property="og:url" content="https://luxagraf.net{{object.get_absolute_url}}" /> + <meta property="og:description" content="{% if object.meta_description %}{{object.meta_description}}{%else%}{{object.sub_title}}{%endif%}" /> + <meta property="article:published_time" content="{{object.pub_date|date:'c'}}" /> + <meta property="article:author" content="Scott Gilbertson" /> + <meta property="og:site_name" content="Luxagraf" /> + <meta property="og:image" content="{{self.get_featured_image}}" /> + <meta property="og:locale" content="en_US" /> + <meta name="twitter:card" content="summary_large_image"/> + <meta name="twitter:description" content="{% if object.meta_description %}{{object.meta_description}}{%else%}{{object.sub_title}}{%endif%}"/> + <meta name="twitter:title" content="{{object.title|safe}}"/> + <meta name="twitter:site" content="@luxagraf"/> + <meta name="twitter:domain" content="luxagraf"/>{% if object.featured_image %} + <meta name="twitter:image:src" content="{{object.featured_image.get_image_url}}"/>{%endif%} + <meta name="twitter:creator" content="@luxagraf"/> +{%endblock%} + +{%block bodyid %}{% if object.get_post_type_display == 'tools' %}class="src"{% endif %}{%endblock%} + +{% block primary %} + <main> + <article class="h-entry hentry {% with object.get_template_name_display as t %}{%if t == "double" or t == "double-dark" %} post--article--double{%endif%}{%endwith%}" itemscope itemType="http://schema.org/Article"> + <header id="header" class="post-header {% with object.get_template_name_display as t %}{%if t == "double" or t == "double-dark" %}post--header--double{%endif%}{%endwith%}"> + <h1 class="p-name entry-title post-title" itemprop="headline">{%if object.template_name == 1 or object.template_name == 3 %}{{object.title|smartypants|safe}}{%else%}{{object.title|smartypants|safe}}{%endif%}</h1> + <h2 class="post-subtitle">{{object.sub_title|smartypants|safe}}</h2> + <div class="post-linewrapper"> + {% if object.originally_published_by %}<h4 class="post-source">Originally Published By: <a href="{{object.originally_published_by_url}}" title="View {{object.title}} on {{object.originally_published_by}}">{{object.originally_published_by}}</a></h4>{%endif%} + {% if object.location %}<div class="p-location h-adr adr post-location" itemprop="contentLocation" itemscope itemtype="http://schema.org/Place"> + <h3 class="h-adr" itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">{% if object.location.country_name == "United States" %}<span class="p-locality locality" itemprop="addressLocality">{{object.location.name|smartypants|safe}}</span>, <a class="p-region region" href="/jrnl/united-states/" title="travel writing from the United States">{{object.location.state_name|safe}}</a>, <span class="p-country-name" itemprop="addressCountry">U.S.</span>{%else%}<span class="p-region" itemprop="addressRegion">{{object.location.name|smartypants|safe}}</span>, <a class="p-country-name country-name" href="/jrnl/{{object.location.country_slug}}/" title="travel writing from {{object.location.country_name}}"><span itemprop="addressCountry">{{object.location.country_name|safe}}</span></a>{%endif%}</h3> + – <a href="" onclick="showMap({{object.latitude}}, {{object.longitude}}, { type:'point', lat:'{{object.latitude}}', lon:'{{object.longitude}}'}); return false;" title="see a map">Map</a> + </div>{%endif%} + <time class="dt-published published dt-updated post-date" datetime="{{object.pub_date|date:'c'}}" itemprop="datePublished">{{object.pub_date|date:"F"}} <span>{{object.pub_date|date:"j, Y"}}</span></time> + <span class="hide" itemprop="author" itemscope itemtype="http://schema.org/Person">by <a class="p-author h-card" href="/about"><span itemprop="name">Scott Gilbertson</span></a></span> + </div> + </header> + <div id="article" class="e-content entry-content post--body post--body--{% with object.template_name as t %}{%if t == 0 or t == 2 %}single{%endif%}{%if t == 1 or t == 3 %}double{%endif%}{%endwith%} post-essay" itemprop="articleBody"> + {% if object.preamble %}<div class="afterward"> + {{object.preamble_html|smartypants|safe}} + </div>{%endif%} + {{object.body_html|safe|smartypants}} + </div> + {% if object.afterword_html %}<div class="afterward"> + <h4>Afterward</h4> + {{object.afterword_html|smartypants|safe}} + </div>{%endif%} + {%if wildlife or object.field_notes.all or object.books.all %}<div class="entry-footer">{%if wildlife %} + <aside id="wildlife"> + <h3>Fauna and Flora</h3> + {% regroup wildlife by ap.apclass.get_kind_display as wildlife_list %} + <ul> + {% for object_list in wildlife_list %} + <li class="grouper">{{object_list.grouper}}<ul> + {% for object in object_list.list %} + <li>{%if object.ap.body_markdown%}<a href="{% url 'sightings:detail' object.ap.slug %}">{{object}}</a>{%else%}{{object}}{%endif%} </li> + {% endfor %}</ul> + {% endfor %}</ul> + </aside> + {% endif %}{%if object.field_notes.all %} + <aside {% if wildlife %}class="margin-left-none" {%endif%}id="field_notes"> + <h3>Field Notes</h3> + <ul>{% for obj in object.field_notes.all %} + <li><a href="{% url 'fieldnotes:detail' year=obj.pub_date.year month=obj.pub_date|date:"m" slug=obj.slug %}">{{obj}}</a></li> + {% endfor %}</ul> + </aside>{% endif %} + {%if object.books.all %} + <aside id="recommended-reading" {%if object.field_notes.all and wildlife %}class="rr-clear{%endif%}" > + <h3>Recommended Reading</h3> + <ul>{% for obj in object.books.all %} + <li><a href="{% url 'books:detail' slug=obj.slug %}"><img src="{{obj.get_small_image_url}}" /></a></li> + {% endfor %}</ul> + </aside>{% endif %} + </div>{%endif%} + </article> + + {% comment %} <div class="mailing-list--wrapper"> + <h5>If you enjoyed this, you should join the mailing list…</h5> + {% include 'mailing_list.html' %} + </div> {% endcomment %} + </main> + {% if object.enable_comments %} +{% get_comment_count for object as comment_count %} +{%if comment_count > 0 %} +<p class="comments--header">{{comment_count}} Comment{{ comment_count|pluralize }}</p> +{% render_comment_list for object %} +{%endif%} +{% render_comment_form for object %} +{% else %} +<p class="comments--header" style="text-align: center">Sorry, comments have been disabled for this post.</p> +{%endif%} +{% endblock %} +{% block js %} +<script type="text/javascript"> +document.addEventListener("DOMContentLoaded", function(event) { + var leaflet = document.createElement('script'); + leaflet.src = "/media/js/leaflet-master/leaflet-mod.js"; + document.body.appendChild(leaflet); + var lightbox = document.createElement('script'); + lightbox.src = "/media/js/lightbox.js"; + document.body.appendChild(lightbox); + leaflet.onload = function(){ + var detail = document.createElement('script'); + detail.src = "/media/js/detail.min.js"; + document.body.appendChild(detail); + {% with object.get_template_name_display as t %}{%if t == "single" or t == "single-dark" %} + detail.onload = function(){ + createMap(); + var open = false; + } + {%endif%}{%endwith%} + } + + lightbox.onload = function() { + var opts= { + //nextOnClick: false, + captions: true, + onload: function(){ + var im = document.getElementById("jslghtbx-contentwrapper"); + var link = im.appendChild(document.createElement('a')) + link.href = im.firstChild.src; + link.innerHTML= "open "; + link.target = "_blank"; + link.setAttribute('class', 'p-link'); + im.appendChild(link); + } + }; + var lightbox = new Lightbox(); + lightbox.load(opts); + } + {% if object.enable_comments %} +{% get_comment_count for object as comment_count %} +{%if comment_count > 0 %} + //delay loading of gravatar images using noscript data-hash attribute + dataattr = document.getElementsByClassName("datahashloader"); + for(var i=0; i<dataattr.length; i++) { + var c = dataattr[i].parentNode; + var img = document.createElement("img"); + img.src = 'https://images.luxagraf.net/gravcache/' + dataattr[i].getAttribute('data-hash') + '.jpg'; + img.className += "gravatar"; + c.insertBefore(img, c.childNodes[3]); + } +{%endif%} +{%endif%} +{% if object.has_video %} +var tester = document.getElementsByClassName("vidauto"); +var wrapper = document.getElementById('wrapper'); +var dist = 100; + +window.onscroll = function() { + for (var i=0; i<tester.length; i++) { + checkVisible(tester[i]) ? tester[i].play() : tester[i].pause(); + } +}; + +function checkVisible(elm) { + var rect = elm.getBoundingClientRect(); + var viewHeight = Math.max(document.documentElement.clientHeight, window.innerHeight); + return !(rect.bottom < 0 || rect.top - viewHeight >= 0); +} +{%endif%} + +}); +</script> +{%endblock%} diff --git a/design/templates/guides/guide_detail.txt b/design/templates/guides/guide_detail.txt new file mode 100644 index 0000000..547ce79 --- /dev/null +++ b/design/templates/guides/guide_detail.txt @@ -0,0 +1,8 @@ +{{object.title|safe}} +{% for letter in object.title %}={%endfor%} + + by Scott Gilbertson + <{{SITE_URL}}{{object.get_absolute_url}}> + {{object.pub_date|date:"l, d F Y"}} + +{{object.body_markdown|safe}} diff --git a/design/templates/guides/guide_list.html b/design/templates/guides/guide_list.html new file mode 100644 index 0000000..43f31b9 --- /dev/null +++ b/design/templates/guides/guide_list.html @@ -0,0 +1,38 @@ +{% extends 'base.html' %} +{% load typogrify_tags %} +{% load html5_datetime %} +{% load pagination_tags %} +{% block pagetitle %}Guides for the perplexed{% endblock %} +{% block metadescription %}Guides for fellow travelers: tools, tips, and tricks to make life on the road easier{% 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>Essays</li> + </ul> + <main role="main" id="essay-archive" class="essay-archive archive-list"> + <div class="essay-intro"> + <h2>Guides for fellow travelers</h2> + <p>Topics include travel, cooking, photography, writing, simplicity, and once, coffee.</p> + </div> + <h1 class="topic-hed">Guides</h1> + {% autopaginate object_list 30 %} + <ul class="fancy-archive-list">{% for object in object_list %} + <li class="h-entry hentry" itemscope itemType="http://schema.org/Article"> + <a href="{{object.get_absolute_url}}" class="u-url"> + <div class="circle-img-wrapper"><img src="{{object.featured_image.get_thumbnail_url}}" alt="{{object.featured_image.alt}}" class="u-photo" /></div> + <span class="date dt-published">{{object.pub_date|date:"F d, Y"}}</span> + <a href="{{object.get_absolute_url}}"> + <h2>{{object.title|safe|smartypants|widont}}</h2> + {% if object.subtitle %}<h3 class="p-summary">{{object.subtitle|safe|smartypants|widont}}</h3>{%endif%} + </a> + {% if object.location %}<h4 class="p-location h-adr post-location" itemprop="geo" itemscope itemtype="http://data-vocabulary.org/Geo"> + <span class="p-locality">{{object.location.name|smartypants|safe}}</span>, + <span class="p-region">{{object.location.state_name}}</span>, + <span class="p-country-name">{{object.location.country_name}}</span> + <data class="p-latitude" value="{{object.latitude}}"></data> + <data class="p-longitude" value="{{object.longitude}}"></data> + </h4>{% endif %} + </li> + {%endfor%}</ul> + </main> +{%endblock%} diff --git a/design/templates/locations/location_detail.html b/design/templates/locations/location_detail.html new file mode 100644 index 0000000..334fa9d --- /dev/null +++ b/design/templates/locations/location_detail.html @@ -0,0 +1,104 @@ +{% extends 'base.html' %} +{% load typogrify_tags %} +{% load get_image_by_size %} +{% load get_image_width %} +{% load pagination_tags %} + +{% block pagetitle %}{{object.name|title|smartypants|safe}} | Luxagraf, a travelogue | {% if object.country_name == "United States" %}{{object.location_name|smartypants|safe}}, {{object.state_name}}{%else%}{{object.location_name|smartypants|safe}}, {{object.country_name}}{%endif%}){% endblock %} + +{% block metadescription %}{{object.meta_description|striptags|safe}}{% endblock %} +{%block extrahead%} + <link rel="canonical" href="http://luxagraf.net{{object.get_absolute_url}}" /> +{%endblock%} +{%block bodyid%}id="location" class="archive"{%endblock%} +{% block primary %} + <main> + <header> + <h1>{{object.name}}</h1> + </header> + + <section> + <h2 class="">Journal entries from {{object.name}}</h2> + <div class="archive-grid">{% for object in entry_list %} + <article class="h-entry hentry archive-card" itemscope itemType="http://schema.org/Article"> + <div class="post-image"> + <a href="{{object.get_absolute_url}}" title="{{object.title}}" class="u-url">{% if object.featured_image %} + {% include "lib/img_archive.html" with image=object.featured_image %} + {%else%} + <img src="{{object.get_image_url}}" alt="{{ object.title }}" class="u-photo post-image" itemprop="image" />{%endif%}</a> + </div> + <h2 class="p-name entry-title post-title" itemprop="headline"><a href="{{object.get_absolute_url}}" class="u-url" title="{%if object.title_keywords%}{{object.title_keywords}}{%else%}{{object.title}}{%endif%}">{{object.title|safe|smartypants|widont}}</a></h2> + <p class="p-author author hide" itemprop="author"><span class="byline-author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Scott Gilbertson</span></span></p> + <time class="dt-published published dt-updated post-date" datetime="{{object.pub_date|date:'c'}}">{{object.pub_date|date:"F"}} <span>{{object.pub_date|date:"j, Y"}}</span></time> + <p class="post-summary"> + <span class="p-location h-adr adr post-location" itemprop="contentLocation" itemscope itemtype="http://schema.org/Place"> + {% if object.location.country_name == "United States" %}<span class="p-locality locality">{{object.location.name|smartypants|safe}}</span>, <a class="p-region region" href="/jrnl/united-states/" title="travel writing from the United States">{{object.location.state_name}}</a>, <span class="p-country-name">U.S.</span>{%else%}<span class="p-region">{{object.location.name|smartypants|safe}}</span>, <a class="p-country-name country-name" href="/jrnl/{{object.location.country_slug}}/" title="travel writing from {{object.location.country_name}}">{{object.location.country_name}}</a>{%endif%} + </span> – + <span class="p-summary" itemprop="description"> + {{object.dek|safe}} + </span> + </p> + </article> {% endfor %} + </div> + </section> + + + + + + + + {% if notes_list %}<section id="field-notes" class="essay-archive archive-list"> + <h3>Field Notes</h3> + <ul class="fancy-archive-list">{% for object in notes_list %} + <li class="h-entry hentry" itemscope itemType="http://schema.org/Article"> + <a href="{{object.get_absolute_url}}" class="u-url"> + {% if object.featured_image %}<div class="circle-img-wrapper"><img src="{{object.featured_image.get_thumbnail_url}}" alt="{{object.featured_image.alt}}" class="u-photo" /></div>{%endif%} + <span class="date dt-published">{{object.pub_date|date:"F d, Y"}}</span> + <a href="{{object.get_absolute_url}}"> + <h2>{{object.title|safe|smartypants|widont}}</h2> + {% if object.subtitle %}<h3 class="p-summary">{{object.subtitle|safe|smartypants|widont}}</h3>{%endif%} + </a> + {% if object.location %}<h4 class="p-location h-adr post-location" itemprop="geo" itemscope itemtype="http://data-vocabulary.org/Geo"> + <span class="p-locality">{{object.location.name|smartypants|safe}}</span>, + <span class="p-region">{{object.location.state_name}}</span>, + <span class="p-country-name">{{object.location.country_name}}</span> + <data class="p-latitude" value="{{object.latitude}}"></data> + <data class="p-longitude" value="{{object.longitude}}"></data> + </h4>{% endif %} + </li> + {%endfor%}</ul> + </section>{% endif %} + + + + {% if sighting_list %} + <section class="sightings dialogue-grid"> + <h2>Birds and Mammals seen {{object}}</h2> {% for object in sighting_list %} + <article class="archive-card">{% if object.ap.image%} + <div class="post--image"> + <a href="{{object.ap.get_absolute_url}}" title="{{object.ap}}"> + {% include "lib/img_archive.html" with image=object.ap.image %} + </a> + </div>{% endif %} + <h2 class="post-title"><a href="{{object.ap.get_absolute_url}}" title="{%if object.title_keywords%}{{object.title_keywords}}{%else%}{{object.ap}}{%endif%}">{{object.ap|safe|smartypants|widont}}</a> (<span class="sci">{{object.ap.scientific_name}}</span>)</h2> + <time class="post-date" datetime="{{object.pub_date|date:'c'}}">Last Seen: {{object.pub_date|date:"F"}} <span>{{object.pub_date|date:"j, Y"}}</span></time> + <div class="post-summary"> + <span class="post-location" itemscope itemtype="http://schema.org/Place"> + {% if object.country_name == "United States" %}<span class="p-locality locality">{{object.location_name|smartypants|safe}}</span>, {{object.state_name}}, <span class="p-country-name">U.S.</span>{%else%}<span class="p-region">{{object.location_name|smartypants|safe}}</span>, {{object.country_name}}</a>{%endif%} + </span> + </div> + </article> {% endfor %} + </section>{%endif%} + + {% comment %} + {% for entry in book_list %}{% if forloop.first %} + <div id="recommended-reading" > + <h3 class="hed">Recommended Reading</h3> + <ul>{% endif %}{% for obj in entry.books.all %} + <li><a href="{% url 'books:detail' slug=obj.slug %}"><img src="{{obj.get_small_image_url}}" /></a></li>{% endfor %} + {% if forloop.last%}</ul> + </div>{%endif%}{% endfor %} + {% endcomment %} + </main> +{% endblock %} |