summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/builder/views.py4
-rw-r--r--app/notes/admin.py2
-rw-r--r--app/notes/build.py94
-rw-r--r--app/notes/migrations/0006_auto_20160617_2058.py24
-rw-r--r--app/notes/models.py7
-rw-r--r--design/sass/_notes.scss26
-rw-r--r--design/sass/_writing_details.scss14
-rw-r--r--design/templates/admin/buttons.html1
-rw-r--r--design/templates/archives/notes.html5
-rw-r--r--design/templates/details/note.html32
10 files changed, 118 insertions, 91 deletions
diff --git a/app/builder/views.py b/app/builder/views.py
index dfce406..1b537bd 100644
--- a/app/builder/views.py
+++ b/app/builder/views.py
@@ -8,6 +8,7 @@ from books.build import builder as book_builder
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
options = {
'writing': BuildWriting,
@@ -53,6 +54,9 @@ def do_build(request):
elif section == 'figments':
context = {'message': 'Writing figments to Disk'}
figments_builder()
+ elif section == 'notes':
+ context = {'message': 'Writing notes to Disk'}
+ notes_builder()
elif section == 'buildamp':
context = {'message': 'Writing detail amp pages to Disk'}
amp_builder()
diff --git a/app/notes/admin.py b/app/notes/admin.py
index e84b7a0..e439168 100644
--- a/app/notes/admin.py
+++ b/app/notes/admin.py
@@ -13,7 +13,7 @@ class LuxNoteAdmin(OLAdminBase):
'fields': (
('title', 'slug'),
'body_markdown',
- 'pub_date',
+ ('pub_date', 'status'),
'point'
),
'classes': (
diff --git a/app/notes/build.py b/app/notes/build.py
index 96c4812..499adc6 100644
--- a/app/notes/build.py
+++ b/app/notes/build.py
@@ -1,68 +1,36 @@
-from builder.base import *
-from django.apps import apps
+import os
+from django.core.urlresolvers import reverse
+from builder.base import BuildNew
-class BuildNotes(Build):
- def build(self):
- self.build_archive()
- self.build_archive_year()
- self.build_archive_month()
- self.build_detail_pages()
-
- def queryset(self):
- return self.get_model().objects.all().order_by('-date_created')
+class BuildNotes(BuildNew):
- def get_model(self):
- return apps.get_model('notes', 'note')
-
- def build_detail_pages(self):
+ def build(self):
+ self.build_detail_view()
+ self.build_list_view(
+ base_path=reverse("notes:live_redirect"),
+ paginate_by=24
+ )
+ self.build_year_view("notes:list_year")
+ self.build_month_view("notes:list_month")
+
+ def get_model_queryset(self):
+ return self.model.objects.all()
+
+ def build_detail_view(self):
'''
- Grab all the notes, render them to a template string and write that out to the filesystem
+ write out all the expenses for each trip
'''
- for entry in self.queryset():
- c = Context({'object': entry, 'MEDIA_URL': settings.BAKED_MEDIA_URL, 'IMAGES_URL': settings.BAKED_IMAGES_URL, 'SITE_URL':settings.SITE_URL})
- t = render_to_string('details/note.html', c).encode('utf-8')
- path = 'field-notes/%s/' % (entry.date_created.strftime("%Y/%m").lower())
- self.write_file(path, t, 'html', entry.slug)
- s = render_to_string('details/note.txt', c).encode('utf-8')
- self.write_file(path, s, 'txt', entry.slug)
-
- def build_archive(self):
- path = 'field-notes/'
- c = Context({
- 'object_list': self.queryset(),
- 'MEDIA_URL': settings.BAKED_MEDIA_URL,
- 'IMAGES_URL': settings.BAKED_IMAGES_URL
- })
- t = render_to_string('archives/notes.html', c).encode('utf-8')
- self.write_file(path, t)
-
- def build_archive_year(self):
- note = self.get_model()
- years = note.objects.dates('date_created', 'year')
- for year in years:
- year = year.strftime('%Y')
- qs = note.objects.filter(date_created__year=year).order_by('-date_created')
- c = Context({
- 'year': year,
- 'object_list': qs
- })
- t = render_to_string('archives/notes_date.html', c).encode('utf-8')
- fpath = 'field-notes/%s/' % (year)
- self.write_file(fpath, t)
-
- def build_archive_month(self):
- note = self.get_model()
- months = note.objects.dates('date_created', 'month')
- for m in months:
- year = m.strftime('%Y')
- month = m.strftime('%m')
- qs = note.objects.filter(date_created__year=year, date_created__month=month).order_by('-date_created')
- c = Context({
- 'month': month,
- 'year': year,
- 'object_list': qs,
- })
- t = render_to_string('archives/notes_date.html', c).encode('utf-8')
- fpath = 'field-notes/%s/%s/' % (year, month)
- self.write_file(fpath, t)
+ for obj in self.get_model_queryset():
+ url = obj.get_absolute_url()
+ path, slug = os.path.split(url)
+ path = '%s/' % path
+ # write html
+ response = self.client.get(url)
+ print(path, slug)
+ self.write_file(path, response.content, filename=slug)
+
+
+def builder():
+ j = BuildNotes("notes", "luxnote")
+ j.build()
diff --git a/app/notes/migrations/0006_auto_20160617_2058.py b/app/notes/migrations/0006_auto_20160617_2058.py
new file mode 100644
index 0000000..8d32528
--- /dev/null
+++ b/app/notes/migrations/0006_auto_20160617_2058.py
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9 on 2016-06-17 20:58
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('notes', '0005_auto_20160616_1445'),
+ ]
+
+ operations = [
+ migrations.RemoveField(
+ model_name='luxnote',
+ name='images',
+ ),
+ migrations.AddField(
+ model_name='luxnote',
+ name='status',
+ field=models.IntegerField(choices=[(0, 'Draft'), (1, 'Published')], default=0),
+ ),
+ ]
diff --git a/app/notes/models.py b/app/notes/models.py
index 1acf966..d59b4de 100644
--- a/app/notes/models.py
+++ b/app/notes/models.py
@@ -17,7 +17,6 @@ import markdown
from utils.widgets import markdown_to_html
from daily.models import CheckIn
-from photos.models import LuxImage
from jrnl.models import render_images
@@ -34,7 +33,11 @@ class LuxNote(models.Model):
body_markdown = models.TextField('Note')
point = models.PointField(blank=True, null=True)
location = models.ForeignKey(Location, blank=True, null=True)
- images = models.ManyToManyField(LuxImage, blank=True, null=True)
+ PUB_STATUS = (
+ (0, 'Draft'),
+ (1, 'Published'),
+ )
+ status = models.IntegerField(choices=PUB_STATUS, default=1)
def __str__(self):
return self.title
diff --git a/design/sass/_notes.scss b/design/sass/_notes.scss
index 1357668..27655c7 100644
--- a/design/sass/_notes.scss
+++ b/design/sass/_notes.scss
@@ -1,18 +1,18 @@
//**************** Notes Structure ************************
-.notes main {
+.notes main, .notes--permalink main {
@include constrain_narrow();
margin-top: 1em;
h1 {
margin-bottom: 0;
@include fontsize(28);
@include breakpoint(beta) {
- @include fontsize(36);
+ @include fontsize(28);
text-align: left;
}
}
}
-.notes .h-entry {
+.notes .h-entry, .notes--permalink .h-entry {
@extend %clearfix;
border: none;
padding: 0;
@@ -36,8 +36,26 @@
font-weight: 400;
font-size: 1.5em;
letter-spacing: 0px;
- font-style: italic;
}
+//date-as-headline
+.note--date-hed {
+ margin-bottom: 0;
+ time {
+ text-align: left;
+ font-weight: 400;
+ font-size: 1.5em;
+ letter-spacing: 0px;
+ font-style: italic;
+ text-transform: none;
+ color: $body_font;
+ }
+ a {
+ border: none;
+ text-decoration: none;
+ }
+}
+
+//small date
.note--date {
@include smcaps;
@include fontsize(11);
diff --git a/design/sass/_writing_details.scss b/design/sass/_writing_details.scss
index c94fcaf..8acc70b 100644
--- a/design/sass/_writing_details.scss
+++ b/design/sass/_writing_details.scss
@@ -240,9 +240,9 @@ img.picwide {
clear: both;
margin: 1em 0;
@include breakpoint(gamma) {
- margin-left: -140px;
- width: 960px;
- max-width: 960px;
+ margin-left: -140px;
+ width: 960px;
+ max-width: 960px;
}
@include breakpoint(delta) {
margin-left: -245px;
@@ -254,10 +254,12 @@ img.picwide {
margin-bottom: 2em;
border-bottom: 1px solid #eae6e6;
padding-bottom: .5em;
+ @include generic_sans;
@include breakpoint(gamma) {
- margin-left: -140px;
- width: 960px;
- max-width: 960px;
+ text-align: right;
+ margin-left: -140px;
+ width: 960px;
+ max-width: 960px;
}
@include breakpoint(delta) {
margin-left: -245px;
diff --git a/design/templates/admin/buttons.html b/design/templates/admin/buttons.html
index 777d7e5..54dc7b2 100644
--- a/design/templates/admin/buttons.html
+++ b/design/templates/admin/buttons.html
@@ -43,6 +43,7 @@
<li class="item"><a href="/admin/build/build?id=writingarchives">Build Writing Archives</a></li>
<li class="item"><a href="/admin/build/build?id=homepage">Build Homepage</a></li>
<li class="item"><a href="/admin/build/build?id=buildrss">Build RSS</a></li>
+ <li class="item"><a href="/admin/build/build?id=notes">Build Notes</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=photo_galleries">Build Photo Galleries</a></li>
<li class="item"><a href="/admin/build/build?id=projects">Build Project Pages</a></li>
diff --git a/design/templates/archives/notes.html b/design/templates/archives/notes.html
index 4e8b105..998546f 100644
--- a/design/templates/archives/notes.html
+++ b/design/templates/archives/notes.html
@@ -16,6 +16,7 @@
{% for object in object_list %}
<article class="h-entry">
<h2 class="p-name note--title hide">{{object.title|safe|amp|smartypants}}</h2>
+ <h5 class="note--date-hed"><a class="u-url" href="{{object.get_absolute_url}}" rel="bookmark"><time class="dt-published" datetime="{{object.pub_date|html5_datetime}}">{{object.pub_date|date:"F j, Y"}}</time></a></h5>
<div class="e-content">
{{object.body_html|safe|smartypants}}
</div>
@@ -24,9 +25,9 @@
<data class="u-url" value="https://luxagraf.net/"></data>
</span>
<footer>
- <p class="note--date">
+ {%comment%}<p class="note--date">
<a class="u-url" href="{{object.get_absolute_url}}" rel="bookmark"><time class="dt-published" datetime="{{object.pub_date|html5_datetime}}">{{object.pub_date|date:"F j, Y"}}</time></a>
- </p>{% if object.location %}
+ </p>{%endcomment%}{% if object.location %}
<p class="p-location h-adr note--location bl" 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>,
diff --git a/design/templates/details/note.html b/design/templates/details/note.html
index d866637..a964381 100644
--- a/design/templates/details/note.html
+++ b/design/templates/details/note.html
@@ -23,43 +23,49 @@
</ul>
<main role="main">
<article class="h-entry post--article">
- <h1 class="p-name note--title">{{object.title|safe|amp|smartypants}}</h1>
+ {% if object.title %}<h1 class="p-name note--title">{{object.title|safe|amp|smartypants}}</h1>{%endif%}
<div class="e-content">
- {{object.body_html|safe|amp|smartypants}}
+ {{object.body_html|safe|smartypants}}
</div>
<span class="p-author h-card">
<data class="p-name" value="Scott Gilbertson"></data>
<data class="u-url" value="https://luxagraf.net/"></data>
</span>
- <footer class="note--footer">
- <p class="note--date">
+ <footer>
+ {%comment%}<p class="note--date">
<a class="u-url" href="{{object.get_absolute_url}}" rel="bookmark"><time class="dt-published" datetime="{{object.pub_date|html5_datetime}}">{{object.pub_date|date:"F j, Y"}}</time></a>
- </p>{% if object.location %}
+ </p>{%endcomment%}{% if object.location %}
<p class="p-location h-adr note--location bl" 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}}</span>,
+ <span class="p-region">{{object.location.state.name}}</span>,
<span class="p-country-name">{{object.location.state.country.name}}</span>
<data class="p-latitude" value="{{object.latitude}}"></data>
<data class="p-longitude" value="{{object.longitude}}"></data>
- </p>{% endif %}{% if object.twitter_id %}
+ </p>{% endif %}
+
+ <p class="note--date">
+ <a class="u-url" href="{{object.get_absolute_url}}" rel="bookmark"><time class="dt-published" datetime="{{object.pub_date|html5_datetime}}">{{object.pub_date|date:"F j, Y"}}</time></a>
+ </p>
+ {% comment %} {% if object.twitter_id %}
<ul class="note--actions">
<li><a rel="syndication" class="u-syndication" href="https://twitter.com/luxagraf/status/{{object.twitter_id}}">View on Twitter</a></li>
<li>
- <action do="reply" with="{{SITE_URL}}{{object.get_absolute_url}}"><a href="https://twitter.com/intent/tweet?in_reply_to={{object.twitter_id}}">Reply</a></action>
+ <indie-action do="reply" with="{{SITE_URL}}{{object.get_absolute_url}}"><a href="https://twitter.com/intent/tweet?in_reply_to={{object.twitter_id}}">Reply</a></indie-action>
</li>
<li>
- <action do="post" with="{{SITE_URL}}{{object.get_absolute_url}}">
+ <indie-action do="post" with="{{SITE_URL}}{{object.get_absolute_url}}">
<a href="https://twitter.com/intent/retweet?tweet_id={{object.twitter_id}}">Retweet</a>
- </action>
+ </indie-action>
</li>
<li>
- <action do="bookmark" with="{{SITE_URL}}{{object.get_absolute_url}}">
+ <indie-action do="bookmark" with="{{SITE_URL}}{{object.get_absolute_url}}">
<a href="https://twitter.com/intent/favorite?tweet_id={{object.twitter_id}}">Favourite</a>
- </action>
+ </indie-action>
</li>
- </ul>{% endif %}
+ </ul>{% endif %}{% endcomment %}
</footer>
+
{% with object.get_next_published as next %}
{% with object.get_previous_published as prev %}
<nav id="page-navigation">