diff options
author | luxagraf <sng@luxagraf.net> | 2019-02-18 15:21:42 -0600 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2019-02-18 15:21:42 -0600 |
commit | e7af8a1e0f71d38b7e83a22a822fb9d971a41ec2 (patch) | |
tree | e424d7d4e9031c9d3d09e629ce331bf882bb392c | |
parent | 5da1a1e66a38c0d7185a90424d0bb9f3c3c7875d (diff) |
redid sightings design and moved all location defered things to location
objects
22 files changed, 392 insertions, 89 deletions
diff --git a/app/jrnl/migrations/0028_auto_20190218_1614.py b/app/jrnl/migrations/0028_auto_20190218_1614.py new file mode 100644 index 0000000..aff2331 --- /dev/null +++ b/app/jrnl/migrations/0028_auto_20190218_1614.py @@ -0,0 +1,33 @@ +# Generated by Django 2.1.5 on 2019-02-18 16:14 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0027_entry_country_slug'), + ] + + operations = [ + migrations.RemoveField( + model_name='entry', + name='country_name', + ), + migrations.RemoveField( + model_name='entry', + name='country_slug', + ), + migrations.RemoveField( + model_name='entry', + name='location_name', + ), + migrations.RemoveField( + model_name='entry', + name='region_name', + ), + migrations.RemoveField( + model_name='entry', + name='state_name', + ), + ] diff --git a/app/jrnl/models.py b/app/jrnl/models.py index dca4cd4..6c334ae 100644 --- a/app/jrnl/models.py +++ b/app/jrnl/models.py @@ -45,11 +45,6 @@ class Entry(models.Model): enable_comments = models.BooleanField(default=False) point = models.PointField(null=True, blank=True) location = models.ForeignKey(Location, on_delete=models.CASCADE, null=True, blank=True) - location_name = models.CharField(max_length=200, blank=True, null=True) - state_name = models.CharField(max_length=200, blank=True, null=True) - country_name = models.CharField(max_length=200, blank=True, null=True) - country_slug = models.CharField(max_length=200, blank=True, null=True) - region_name = models.CharField(max_length=200, blank=True, null=True) PUB_STATUS = ( (0, 'Draft'), (1, 'Published'), @@ -177,11 +172,6 @@ class Entry(models.Model): self.location = Location.objects.filter(geometry__contains=self.point).get() except Location.DoesNotExist: raise forms.ValidationError("There is no location associated with that point, add it: %sadmin/locations/location/add/" % (settings.BASE_URL)) - self.location_name = self.location.name - self.state_name = self.location.state.name - self.country_name = self.location.state.country.name - self.country_slug = self.location.state.country.slug - self.region_name = self.location.state.country.lux_region.name if created and not self.featured_image: self.featured_image = LuxImage.objects.latest() old = type(self).objects.get(pk=self.pk) if self.pk else None diff --git a/app/jrnl/views.py b/app/jrnl/views.py index d1c4159..95b5c64 100644 --- a/app/jrnl/views.py +++ b/app/jrnl/views.py @@ -23,7 +23,7 @@ class EntryList(PaginatedListView): def get_queryset(self): queryset = super(EntryList, self).get_queryset() print(queryset) - return queryset.filter(status__exact=1).order_by('-pub_date').select_related('location').prefetch_related('featured_image') + return queryset.filter(status__exact=1).order_by('-pub_date').prefetch_related('location').prefetch_related('featured_image') class EntryCountryList(PaginatedListView): @@ -115,7 +115,7 @@ class HomepageList(ListView): def get_queryset(self): queryset = super(HomepageList, self).get_queryset() self.home = self.get_home() - return queryset.filter(status__exact=1).order_by('-pub_date').exclude().select_related('location').select_related('featured_image')[1:9] + return queryset.filter(status__exact=1).order_by('-pub_date').exclude().select_related('location').select_related('featured_image')[2:10] def get_template_names(self): return ['%s' % self.home.template_name] diff --git a/app/locations/migrations/0016_auto_20190217_1847.py b/app/locations/migrations/0016_auto_20190217_1847.py new file mode 100644 index 0000000..162b489 --- /dev/null +++ b/app/locations/migrations/0016_auto_20190217_1847.py @@ -0,0 +1,33 @@ +# Generated by Django 2.1.5 on 2019-02-17 18:47 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('locations', '0015_luxcheckin'), + ] + + operations = [ + migrations.AddField( + model_name='location', + name='country_name', + field=models.CharField(blank=True, max_length=50), + ), + migrations.AddField( + model_name='location', + name='country_slug', + field=models.CharField(blank=True, max_length=50), + ), + migrations.AddField( + model_name='location', + name='region_name', + field=models.CharField(blank=True, max_length=50), + ), + migrations.AddField( + model_name='location', + name='state_name', + field=models.CharField(blank=True, max_length=50), + ), + ] diff --git a/app/locations/migrations/0017_auto_20190217_1849.py b/app/locations/migrations/0017_auto_20190217_1849.py new file mode 100644 index 0000000..39f3e6f --- /dev/null +++ b/app/locations/migrations/0017_auto_20190217_1849.py @@ -0,0 +1,23 @@ +# Generated by Django 2.1.5 on 2019-02-17 18:49 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('locations', '0016_auto_20190217_1847'), + ] + + operations = [ + migrations.AddField( + model_name='location', + name='region_slug', + field=models.CharField(blank=True, max_length=50), + ), + migrations.AddField( + model_name='location', + name='state_slug', + field=models.CharField(blank=True, max_length=50), + ), + ] diff --git a/app/locations/models.py b/app/locations/models.py index 203e175..6e8db7c 100644 --- a/app/locations/models.py +++ b/app/locations/models.py @@ -128,6 +128,12 @@ class Location(models.Model): pub_date = models.DateTimeField('Date published') geometry = models.MultiPolygonField(srid=4326) parent = models.ForeignKey('self', on_delete=models.CASCADE, blank=True, null=True) + state_name = models.CharField(max_length=50, blank=True) + state_slug = models.CharField(max_length=50, blank=True) + country_name = models.CharField(max_length=50, blank=True) + 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) class Meta: ordering = ('-pub_date',) @@ -137,10 +143,10 @@ class Location(models.Model): return self.name def comma_name(self): - if self.state.country.name == "United States": - return self.state + if self.country_name == "United States": + return self.state_name else: - return self.state.country + return self.country_name @property def get_previous_admin_url(self): @@ -155,8 +161,16 @@ class Location(models.Model): return '' def get_absolute_url(self): - return "/locations/%s/%s/%s/" % (self.state.country.slug, self.state.slug, self.slug) + return "/locations/%s/%s/%s/" % (self.country_slug, self.state_slug, self.slug) + def save(self, *args, **kwargs): + self.state_name = self.state.name + self.state_slug = self.state.slug + self.country_name = self.state.country.name + 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 + super(Location, self).save() class Route(models.Model): """Model to hold routes for longer trips""" diff --git a/app/sightings/admin.py b/app/sightings/admin.py index d95dd72..fcbc2ca 100644 --- a/app/sightings/admin.py +++ b/app/sightings/admin.py @@ -1,7 +1,7 @@ import copy from django.contrib import admin from django.contrib.gis.admin import OSMGeoAdmin -from .models import APClass, AP, Sighting +from .models import APClass, AP, Sighting, FieldNote from photos.forms import GalleryForm from utils.util import get_latlon @@ -96,3 +96,35 @@ class SightingAdmin(OSMGeoAdmin): class Media: js = ('next-prev-links.js',) + +@admin.register(FieldNote) +class FieldNoteAdmin(admin.ModelAdmin): + form = LGEntryForm + + def get_form(self, request, obj=None, **kwargs): + form = super(FieldNoteAdmin, self).get_form(request, obj, **kwargs) + form.base_fields['sighting'].label_from_instance = lambda obj: "{} - {} - {}".format(obj.ap_common_name, obj.pub_date.strftime("%Y-%b-%d"), obj.location_name) + return form + + list_display = ('pk', 'ap_common_name', 'sighting_pub_date', 'sighting_location') + fieldsets = ( + ('', { + 'fields': ( + 'sighting', + 'body_markdown', + ), + 'classes': ( + 'show', + 'extrapretty', + 'wide' + ) + } + ), + ) + + class Media: + js = ('image-loader.js', 'next-prev-links.js') + css = { + "all": ("my_styles.css",) + } + diff --git a/app/sightings/migrations/0008_auto_20190217_1441.py b/app/sightings/migrations/0008_auto_20190217_1441.py new file mode 100644 index 0000000..8b9389e --- /dev/null +++ b/app/sightings/migrations/0008_auto_20190217_1441.py @@ -0,0 +1,38 @@ +# Generated by Django 2.1.5 on 2019-02-17 14:41 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('sightings', '0007_merge_20180708_1047'), + ] + + operations = [ + migrations.AddField( + model_name='sighting', + name='country_name', + field=models.CharField(blank=True, max_length=200), + ), + migrations.AddField( + model_name='sighting', + name='country_slug', + field=models.CharField(blank=True, max_length=200), + ), + migrations.AddField( + model_name='sighting', + name='location_name', + field=models.CharField(blank=True, max_length=200), + ), + migrations.AddField( + model_name='sighting', + name='region_name', + field=models.CharField(blank=True, max_length=200), + ), + migrations.AddField( + model_name='sighting', + name='state_name', + field=models.CharField(blank=True, max_length=200), + ), + ] diff --git a/app/sightings/migrations/0009_fieldnote.py b/app/sightings/migrations/0009_fieldnote.py new file mode 100644 index 0000000..2365936 --- /dev/null +++ b/app/sightings/migrations/0009_fieldnote.py @@ -0,0 +1,26 @@ +# Generated by Django 2.1.5 on 2019-02-17 16:15 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('sightings', '0008_auto_20190217_1441'), + ] + + operations = [ + migrations.CreateModel( + name='FieldNote', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('body_html', models.TextField(blank=True, null=True)), + ('body_markdown', models.TextField(blank=True, null=True)), + ('sighting', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='sightings.Sighting')), + ], + options={ + 'ordering': ['sighting__pub_date'], + }, + ), + ] diff --git a/app/sightings/migrations/0010_auto_20190217_1647.py b/app/sightings/migrations/0010_auto_20190217_1647.py new file mode 100644 index 0000000..7427918 --- /dev/null +++ b/app/sightings/migrations/0010_auto_20190217_1647.py @@ -0,0 +1,25 @@ +# Generated by Django 2.1.5 on 2019-02-17 16:47 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('sightings', '0009_fieldnote'), + ] + + operations = [ + migrations.AlterField( + model_name='fieldnote', + name='body_html', + field=models.TextField(blank=True, default=''), + preserve_default=False, + ), + migrations.AlterField( + model_name='fieldnote', + name='body_markdown', + field=models.TextField(blank=True, default=''), + preserve_default=False, + ), + ] diff --git a/app/sightings/migrations/0011_auto_20190217_1702.py b/app/sightings/migrations/0011_auto_20190217_1702.py new file mode 100644 index 0000000..efe7cce --- /dev/null +++ b/app/sightings/migrations/0011_auto_20190217_1702.py @@ -0,0 +1,29 @@ +# Generated by Django 2.1.5 on 2019-02-17 17:02 + +import datetime +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('sightings', '0010_auto_20190217_1647'), + ] + + operations = [ + migrations.AlterModelOptions( + name='fieldnote', + options={'ordering': ['sighting_pub_date']}, + ), + migrations.AddField( + model_name='fieldnote', + name='ap_common_name', + field=models.CharField(blank=True, max_length=200), + ), + migrations.AddField( + model_name='fieldnote', + name='sighting_pub_date', + field=models.DateTimeField(blank=True, default=datetime.datetime(2019, 2, 17, 17, 2, 51, 82998), verbose_name='Date'), + preserve_default=False, + ), + ] diff --git a/app/sightings/migrations/0012_sighting_ap_common_name.py b/app/sightings/migrations/0012_sighting_ap_common_name.py new file mode 100644 index 0000000..a931b30 --- /dev/null +++ b/app/sightings/migrations/0012_sighting_ap_common_name.py @@ -0,0 +1,18 @@ +# Generated by Django 2.1.5 on 2019-02-17 17:12 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('sightings', '0011_auto_20190217_1702'), + ] + + operations = [ + migrations.AddField( + model_name='sighting', + name='ap_common_name', + field=models.CharField(blank=True, max_length=200), + ), + ] diff --git a/app/sightings/migrations/0013_fieldnote_sighting_location.py b/app/sightings/migrations/0013_fieldnote_sighting_location.py new file mode 100644 index 0000000..ef8990d --- /dev/null +++ b/app/sightings/migrations/0013_fieldnote_sighting_location.py @@ -0,0 +1,18 @@ +# Generated by Django 2.1.5 on 2019-02-17 18:31 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('sightings', '0012_sighting_ap_common_name'), + ] + + operations = [ + migrations.AddField( + model_name='fieldnote', + name='sighting_location', + field=models.CharField(blank=True, max_length=200), + ), + ] diff --git a/app/sightings/models.py b/app/sightings/models.py index fe09f39..5723776 100644 --- a/app/sightings/models.py +++ b/app/sightings/models.py @@ -130,6 +130,12 @@ class Sighting(models.Model): point = models.PointField(blank=True) location = models.ForeignKey(Location, on_delete=models.CASCADE, blank=True) pub_date = models.DateTimeField('Date', default=timezone.now) + location_name = models.CharField(max_length=200, blank=True) + state_name = models.CharField(max_length=200, blank=True) + country_name = models.CharField(max_length=200, blank=True) + country_slug = models.CharField(max_length=200, blank=True) + region_name = models.CharField(max_length=200, blank=True) + ap_common_name = models.CharField(max_length=200, blank=True) # seen_by = models.ManyToManyField(User) # images = models.ManyToManyField(LuxImage, blank=True) # audio = models.ManyToManyField(BirdAudio, blank=True) @@ -183,7 +189,7 @@ class Sighting(models.Model): return reverse("sightings:detail", kwargs={"slug": self.ap.slug}) def __str__(self): - return self.ap.common_name + return self.ap_common_name def save(self, *args, **kwargs): if not self.point: @@ -194,44 +200,34 @@ class Sighting(models.Model): ).get() except Location.DoesNotExist: raise forms.ValidationError("There is no location associated with that point, add it: %sadmin/locations/location/add/" % (settings.BASE_URL)) + self.ap_common_name = self.ap.common_name + self.location_name = self.location.name + self.state_name = self.location.state.name + self.country_name = self.location.state.country.name + self.country_slug = self.location.state.country.slug + self.region_name = self.location.state.country.lux_region.name super(Sighting, self).save() -""" -Migration from Birds to abstract: -apclass = OLDAPClass.objects.all() -for b in apclass: - NewAPClass.objects.create( - common_name = b.common_name, - scientific_name = b.scientific_name, - kind = 1 - ) - -ap = OLDAP.objects.all() -for b in ap: - apnew = NewAPClass.objects.get(scientific_name=b.apclass.scientific_name) - print(ap) - NewAP.objects.create( - common_name = b.common_name, - scientific_name = b.scientific_name, - code = b.code, - apclass = apnew, - image = b.image, - image_credit = b.image_credit, - ) - print(t) - -oldsighting = OLDSighting.objects.all() -for bird in oldsighting: - ap = NEWAP.objects.get(scientific_name=bird.ap.scientific_name) - s = NEWSighting.objects.create( - ap = ap, - point = bird.point, - location = bird.location, - date = bird.date, - ) - for t in bird.images.all(): - s.images.add(t) - for t in bird.seen_by.all(): - s.seen_by.add(t) -""" +class FieldNote(models.Model): + sighting = models.ForeignKey(Sighting, on_delete=models.CASCADE) + body_html = models.TextField(blank=True) + body_markdown = models.TextField(blank=True) + # these are only used to speed up admin + sighting_pub_date = models.DateTimeField('Date', blank=True) + sighting_location = models.CharField(max_length=200, blank=True) + ap_common_name = models.CharField(max_length=200, blank=True) + + class Meta: + ordering = ["sighting_pub_date", ] + + def __str__(self): + return '%s %s' % (self.ap_common_name, self.pk) + + def save(self, *args, **kwargs): + self.sighting_pub_date = self.sighting.pub_date + self.ap_common_name = self.sighting.ap.common_name + self.sighting_location = self.sighting.location_name + md = render_images(self.body_markdown) + self.body_html = markdown_to_html(md) + super(FieldNote, self).save() diff --git a/app/sightings/views.py b/app/sightings/views.py index c90e5c1..3170b77 100644 --- a/app/sightings/views.py +++ b/app/sightings/views.py @@ -2,15 +2,14 @@ from django.views.generic.detail import DetailView from django.views.generic import ListView from django.contrib.auth.models import User from utils.views import PaginatedListView -from .models import AP, Sighting +from .models import AP, Sighting, FieldNote class SightingListView(PaginatedListView): - template_name = 'archives/sightings.html' def get_queryset(self): qs_ids = Sighting.objects.order_by('ap__id', '-pub_date').distinct('ap').values_list('id', flat=True) - return Sighting.objects.filter(id__in=qs_ids).order_by('-pub_date') + return Sighting.objects.filter(id__in=qs_ids).order_by('-pub_date').prefetch_related('ap') class LifeListView(ListView): @@ -37,22 +36,20 @@ class SightingListUserView(PaginatedListView): class SightingDetailView(DetailView): model = AP - template_name = "details/sighting.html" - slug_field = "slug" def get_context_data(self, **kwargs): # Call the base implementation first to get a context context = super(SightingDetailView, self).get_context_data(**kwargs) + context['field_notes'] = FieldNote.objects.filter( + sighting__ap__slug=self.kwargs['slug'] + ) + context['sighting'] = Sighting.objects.filter( + ap__slug=self.kwargs['slug'] + ).prefetch_related('location') #try: # context['recording'] = SightingAudio.objects.get( # ap__slug=self.kwargs['slug'] # ) #except SightingAudio.DoesNotExist: # pass - try: - context['sighting'] = Sighting.objects.filter( - ap__slug=self.kwargs['slug'] - ) - except Sighting.DoesNotExist: - pass return context diff --git a/design/sass/_details.scss b/design/sass/_details.scss index 6c86a86..cf453ea 100644 --- a/design/sass/_details.scss +++ b/design/sass/_details.scss @@ -26,7 +26,14 @@ line-height: 1; margin-top: .5rem; } + .post-subtitle-segundo { + @include fancy_sans; + @include smcaps; + @include fontsize(13); + font-weight: bold; + color: #999; + } .post-location { margin-top: 1rem; padding-top: 1rem; @@ -141,6 +148,24 @@ padding-bottom: 2.6rem; border-top: 1px solid #efefef; } +header.tight { + margin-bottom: 3rem; + * { + margin: 0; + text-align: center; + } + h1 { + margin-bottom: 1rem; + } + h2 { + display: inline-block; + border-top: 1px solid darken(#efefef, 10); + padding-top: 1rem; + } + h3 { + margin-top: .35rem; + } +} h4.post-source { @include fontsize(14); @include smcaps; diff --git a/design/templates/archives/homepage-light.html b/design/templates/archives/homepage-light.html index 26ff437..00243aa 100644 --- a/design/templates/archives/homepage-light.html +++ b/design/templates/archives/homepage-light.html @@ -31,7 +31,7 @@ <p class="p-author author hide" itemprop="author">Scott Gilbertson</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.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}}{%endif%}</span> + <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>, {{object.location.state_name}}}, <span class="p-country-name">U.S.</span>{%else%}<span class="p-region">{{object.location.name|smartypants|safe}}</span>, {{object.location.country_name}}{%endif%}</span> <span class="p-summary" itemprop="description"> {{homepage.tag_line|safe|smartypants}} </span> @@ -46,7 +46,7 @@ <h1 class="homepage-section-header">About Luxagraf</h1> <img src="/media/img/usa-resize.svg" alt="map of travels" class="homepage-map-img" /> <p>After nearly two years exploring the U.S. in our home, a 1969 Dodge Travco RV, we left the states to spend the winter in Mexico.</p> - <p>We left our former home in Athens, GA in the Spring of 2017. We were most recently in <span class="p-location h-adr adr " itemprop="contentLocation" itemscope itemtype="http://schema.org/Place"> {% if location.country_name == "United States" %}<span class="p-locality locality">{{location.location_name|smartypants|safe}}</span>, {{location.location.state.code|safe}}{%else%}<span class="p-region">{{location.location_name|smartypants|safe}}</span>, {{location.country_name|safe}}</a>{%endif%}</span>. The map <span class="addafter"><span class="subcontent">above</span></span> has a rough sketch of our route to date. You can read about our adventures in the <a href="/jrnl/">journal</a> section. There's more about us on the <a href="/about">about page</a> </p> + <p>We left our former home in Athens, GA in the Spring of 2017. We were most recently in <span class="p-location h-adr adr " itemprop="contentLocation" itemscope itemtype="http://schema.org/Place"> {% if location.country_name == "United States" %}<span class="p-locality locality">{{location.location_name|smartypants|safe}}</span>, {{location.location.comma_name|safe}}{%else%}<span class="p-region">{{location.location_name|smartypants|safe}}</span>, {{location.country_name|safe}}</a>{%endif%}</span>. The map <span class="addafter"><span class="subcontent">above</span></span> has a rough sketch of our route to date. You can read about our adventures in the <a href="/jrnl/">journal</a> section. There's more about us on the <a href="/about">about page</a> </p> </section> <section class="recent-popular"> <div class="recent"> @@ -64,7 +64,7 @@ <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.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.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.country.slug}}/" title="travel writing from {{object.country_name}}">{{object.country_name}}</a>{%endif%} + {% 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> </p> </article> {% endfor %} @@ -85,7 +85,7 @@ <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.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.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.country.slug}}/" title="travel writing from {{object.country_name}}">{{object.country_name}}</a>{%endif%} + {% 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.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.country.slug}}/" title="travel writing from {{object.location.country_name}}">{{object.location.country_name}}</a>{%endif%} </span> </p> </article> {% endfor %} diff --git a/design/templates/essays/essay_detail.html b/design/templates/essays/essay_detail.html index 780c80c..34f5d78 100644 --- a/design/templates/essays/essay_detail.html +++ b/design/templates/essays/essay_detail.html @@ -2,7 +2,7 @@ {% load typogrify_tags %} {% load comments %} -{% block pagetitle %}{{object.title|title|smartypants|safe}} - Luxagraf, Writing{%comment%}{% if object.country_name == "United States" %}{{object.location_name|smartypants|safe}}, {{object.state_name}}{%else%}{{object.location_name|smartypants|safe}}, {{object.country_name}}{%endif%}{%endcomment%}{% endblock %} +{% block pagetitle %}{{object.title|title|smartypants|safe}} - Luxagraf, Essays{% endblock %} {% block metadescription %}{% autoescape on %}{{object.meta_description|striptags|safe}}{% endautoescape %}{% endblock %} {%block extrahead%} diff --git a/design/templates/jrnl/entry_detail.html b/design/templates/jrnl/entry_detail.html index 3e75017..4e84103 100644 --- a/design/templates/jrnl/entry_detail.html +++ b/design/templates/jrnl/entry_detail.html @@ -2,14 +2,14 @@ {% load typogrify_tags %} {% load comments %} -{% block pagetitle %}{{object.title|title|smartypants|safe}} - Luxagraf, Writing{%comment%}{% if object.country_name == "United States" %}{{object.location_name|smartypants|safe}}, {{object.state_name}}{%else%}{{object.location_name|smartypants|safe}}, {{object.country_name}}{%endif%}{%endcomment%}{% endblock %} +{% block pagetitle %}{{object.title|title|smartypants|safe}} - Luxagraf, Writing{%comment%}{% if object.location.country_name == "United States" %}{{object.location.name|smartypants|safe}}, {{object.location.state_name}}{%else%}{{object.location.name|smartypants|safe}}, {{object.location.country_name}}{%endif%}{%endcomment%}{% endblock %} {% block metadescription %}{% autoescape on %}{{object.meta_description|striptags|safe}}{% endautoescape %}{% endblock %} {%block extrahead%} <link rel="canonical" href="https://luxagraf.net{{object.get_absolute_url}}" /> <meta name="ICBM" content="{{object.latitude}}, {{object.longitude}}" /> <meta name="geo.position" content="{{object.latitude}}; {{object.longitude}}" /> - <meta name="geo.placename" content="{% if object.country_name == "United States" %}{{object.location.name|smartypants|safe}}, {{object.state.name}}{%else%}{{object.location.name|smartypants|safe}}, {{object.country_name}}{%endif%}"> + <meta name="geo.placename" content="{% if object.location.country_name == "United States" %}{{object.location.name|smartypants|safe}}, {{object.state.name}}{%else%}{{object.location.name|smartypants|safe}}, {{object.location.country_name}}{%endif%}"> <meta name="geo.region" content="{{object.country.iso2}}{%if object.state.code != '' %}-{{object.state.code}}{%endif%}"> <meta property="og:type" content="article" /> <meta property="og:title" content="{{object.title|safe}}" /> @@ -40,7 +40,7 @@ class="detail {%if t == 1 or t == 3 or t == 5 %}double{%else%}single{%endif%}{%i <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> <aside class="p-location h-adr adr post-location" itemprop="contentLocation" itemscope itemtype="http://schema.org/Place"> - {% if object.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.state_name|safe}}</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.country_slug}}/" title="travel writing from {{object.country_name}}">{{object.country_name|safe}}</a>{%endif%} + {% 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.state_name|safe}}</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|safe}}</a>{%endif%} {% with object.get_template_name_display as t %}{%if t == "single" or t == "single-dark" %} – <a href="" onclick="showMap({{object.latitude}}, {{object.longitude}}, { type:'point', lat:'{{object.latitude}}', lon:'{{object.longitude}}'}); return false;" title="see a map">Map</a>{%endif%}{%endwith%} </aside> <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> diff --git a/design/templates/jrnl/entry_list.html b/design/templates/jrnl/entry_list.html index 0295f8f..2201e34 100644 --- a/design/templates/jrnl/entry_list.html +++ b/design/templates/jrnl/entry_list.html @@ -26,7 +26,7 @@ <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.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.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.country_slug}}/" title="travel writing from {{object.country_name}}">{{object.country_name}}</a>{%endif%} + {% 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}} diff --git a/design/templates/details/sighting.html b/design/templates/sightings/ap_detail.html index 1af2433..154d7ac 100644 --- a/design/templates/details/sighting.html +++ b/design/templates/sightings/ap_detail.html @@ -9,15 +9,18 @@ {% 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="{% url 'sightings:list' %}" title="See all" itemprop="url"><span itemprop="title">Dialogues</span></a></li> + <li><a href="{% url 'sightings:list' %}" title="See all" itemprop="url"><span itemprop="title">Dialogues</span></a>→ </li> + <li><span itemprop="title">{{object.common_name}}</span></li> </ul> -<main> -<article> -<h1>{{object.common_name}}</h1> -<h2 class="sci">{{object.scientific_name}}</h2> -<h3 class="sci">Family {{object.apclass.scientific_name}} ({{object.apclass}})</h3> - {{object.body_html|safe|smartypants|widont}} + <main> + <article> + <header class="tight"> + <h1 class="hed">{{object.common_name}}</h1> + <h2 class="post-subtitle">{{object.scientific_name}}</h2> + <h3 class="post-subtitle-segundo">Family {{object.apclass.scientific_name}} ({{object.apclass}})</h3> + </header> + {% if object.body_html %}{{object.body_html|safe|smartypants|widont}}{%endif%} {%if recording %} <div class="audio-figure"> <audio autoplay="autoplay" controls="controls"> @@ -26,14 +29,17 @@ <small>Audio recorded by {{recording.recorder}} on {{recording.pub_date|date:"F j, Y"}} in {{recording.location}}. <a href="{{recording.link}}">© {{recording.copyright}}</a></small> </div> {%endif%} -<div class="entry-footer" id="endnode"> - <aside id="locations"> + {% if field_notes %} + <h4>Field Notes</h4>{% for note in field_notes %} + {{note.body_html|safe|smartypants}} + <p class="post-subtitle-segundo">– <a href="{{note.sighting.location.get_absolute_url}}">{{note.sighting.location}}</a>, {{note.sighting.location.comma_name}}, {{note.sighting.pub_date|date:"M Y"}}</p> + <hr /> + {%endfor%} +{%endif%} <h5>Seen at</h5> <ul>{%for sight in sighting %} <li><a href="{{sight.location.get_absolute_url}}">{{sight.location}}</a>, {{sight.location.comma_name}}, {{sight.pub_date|date:"M Y"}}</li> - {%endfor%}</ul> - </aside> -</div> + {%endfor%} </article> </main> {% endblock %} diff --git a/design/templates/archives/sightings.html b/design/templates/sightings/sighting_list.html index 3eb8ef6..3ae33e5 100644 --- a/design/templates/archives/sightings.html +++ b/design/templates/sightings/sighting_list.html @@ -25,7 +25,7 @@ <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%} + {% 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 %} |