summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/jrnl/admin.py10
-rw-r--r--app/jrnl/migrations/0006_auto_20160715_0703.py37
-rw-r--r--app/jrnl/migrations/0007_delete_postimage.py18
-rw-r--r--app/jrnl/models.py18
-rw-r--r--design/sass/_writing_details.scss10
-rw-r--r--design/templates/admin/jrnl/change_form.html5
-rw-r--r--design/templates/archives/homepage.html8
7 files changed, 74 insertions, 32 deletions
diff --git a/app/jrnl/admin.py b/app/jrnl/admin.py
index d493053..54a1046 100644
--- a/app/jrnl/admin.py
+++ b/app/jrnl/admin.py
@@ -3,7 +3,9 @@ from django import forms
from django.contrib.gis.admin import OSMGeoAdmin
from utils.widgets import AdminImageWidget, LGEntryForm
-from .models import Entry, EntryAside, PostImage, HomepageCurrator, EntryTitleSong
+from .models import Entry, EntryAside, HomepageCurrator, EntryTitleSong
+
+from photos.forms import GalleryForm
class EntryAsideInline(admin.TabularInline):
@@ -76,16 +78,12 @@ class EntryAdmin(OSMGeoAdmin):
openlayers_url = '/static/admin/js/OpenLayers.js'
-class PostImageAdmin(admin.ModelAdmin):
- list_display = ('title', 'post_image')
-
-
class HomepageCurratorAdmin(admin.ModelAdmin):
+ form = GalleryForm
filter_horizontal = ('entry_list',)
pass
-admin.site.register(PostImage, PostImageAdmin)
admin.site.register(EntryAside, EntryAsideAdmin)
admin.site.register(Entry, EntryAdmin)
admin.site.register(HomepageCurrator, HomepageCurratorAdmin)
diff --git a/app/jrnl/migrations/0006_auto_20160715_0703.py b/app/jrnl/migrations/0006_auto_20160715_0703.py
new file mode 100644
index 0000000..42efc43
--- /dev/null
+++ b/app/jrnl/migrations/0006_auto_20160715_0703.py
@@ -0,0 +1,37 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.7 on 2016-07-15 07:03
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import jrnl.models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('photos', '0010_auto_20160517_0906'),
+ ('jrnl', '0005_auto_20160514_2151'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='homepagecurrator',
+ name='images',
+ field=models.ManyToManyField(to='photos.LuxImage'),
+ ),
+ migrations.AlterField(
+ model_name='entry',
+ name='image',
+ field=models.FileField(blank=True, help_text='should be 205px high by 364px wide', null=True, upload_to=jrnl.models.get_upload_path),
+ ),
+ migrations.AlterField(
+ model_name='entry',
+ name='template_name',
+ field=models.IntegerField(choices=[(0, 'single'), (1, 'double'), (2, 'single-dark'), (3, 'double-dark'), (4, 'single-black'), (5, 'double-black')], default=0),
+ ),
+ migrations.AlterField(
+ model_name='postimage',
+ name='image',
+ field=models.ImageField(upload_to='/home/lxf/Sites/luxagraf/site/media/images/2016'),
+ ),
+ ]
diff --git a/app/jrnl/migrations/0007_delete_postimage.py b/app/jrnl/migrations/0007_delete_postimage.py
new file mode 100644
index 0000000..cc481e8
--- /dev/null
+++ b/app/jrnl/migrations/0007_delete_postimage.py
@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.7 on 2016-07-15 07:05
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('jrnl', '0006_auto_20160715_0703'),
+ ]
+
+ operations = [
+ migrations.DeleteModel(
+ name='PostImage',
+ ),
+ ]
diff --git a/app/jrnl/models.py b/app/jrnl/models.py
index 874da74..da6d947 100644
--- a/app/jrnl/models.py
+++ b/app/jrnl/models.py
@@ -76,23 +76,6 @@ def extract_images(s):
return imgs
-class PostImage(models.Model):
- title = models.CharField(max_length=100)
- image = models.ImageField(upload_to="%s/%s" % (settings.IMAGES_ROOT, datetime.datetime.today().strftime("%Y")))
-
- def __unicode__(self):
- return self.title
-
- def post_image(self):
- return format_html('<img src="%s%s" alt="%s" class="postpic"/>' % (
- settings.IMAGES_URL,
- self.image.url.split('images')[1].split('/', 1)[1],
- self.title)
- )
-
- post_image.allow_tags = True
-
-
class Entry(models.Model):
title = models.CharField(max_length=200)
slug = models.SlugField(unique_for_date='pub_date')
@@ -247,6 +230,7 @@ class EntryAside(models.Model):
class HomepageCurrator(models.Model):
alt_text = models.CharField(max_length=200)
image_base_url = models.CharField(max_length=200)
+ images = models.ManyToManyField(LuxImage)
tag_line = models.CharField(max_length=200)
banner = models.ForeignKey(Entry, related_name="banner")
entry_list = models.ManyToManyField(Entry)
diff --git a/design/sass/_writing_details.scss b/design/sass/_writing_details.scss
index 8acc70b..82f1376 100644
--- a/design/sass/_writing_details.scss
+++ b/design/sass/_writing_details.scss
@@ -246,8 +246,8 @@ img.picwide {
}
@include breakpoint(delta) {
margin-left: -245px;
- width: 1170px;
- max-width: 1170px;
+ width: 1140px;
+ max-width: 1140px;
}
}
.picwide figcaption {
@@ -257,17 +257,17 @@ img.picwide {
@include generic_sans;
@include breakpoint(gamma) {
text-align: right;
- margin-left: -140px;
width: 960px;
max-width: 960px;
}
@include breakpoint(delta) {
- margin-left: -245px;
- margin-top: -10px;
width: 1170px;
max-width: 1170px;
}
}
+figure.picwide > img.picwide {
+ margin: auto !important;
+}
.picwide960 {
clear: both;
margin: 1em 0;
diff --git a/design/templates/admin/jrnl/change_form.html b/design/templates/admin/jrnl/change_form.html
index 13d3790..880e9c9 100644
--- a/design/templates/admin/jrnl/change_form.html
+++ b/design/templates/admin/jrnl/change_form.html
@@ -12,6 +12,11 @@ $(function(){
$('#id_body_markdown').each(function(){
$(this).after('<iframe frameborder="0" style="border: #dddddd 1px solid;margin-left: 20px;width:330px; height:720px;" src="/luximages/insert/?textarea='+this.id+'"></iframe>');
});
+ $('#id_images').css('width', '500px').css('height', '400px');
+ $('#id_images option').each(function(){
+ $(this).attr('style', 'background: url('+$(this).text().split("qq")[1]+') no-repeat; background-size: 120px 80px; height: 80px; padding-left: 125px; line-height: 80px; margin-bottom: 4px; padding-bottom: 5px;border-bottom: #eee 1px solid;');
+ $(this).html($(this).text().split("qq")[0] + ' &ndash; <a href="/admin/photos/luximage/'+ $(this).text().split("qq")[2]+'/change/">edit</a>')
+ });
});
</script>
diff --git a/design/templates/archives/homepage.html b/design/templates/archives/homepage.html
index 98d9937..1a1a406 100644
--- a/design/templates/archives/homepage.html
+++ b/design/templates/archives/homepage.html
@@ -1,4 +1,5 @@
{% extends 'base.html' %}
+{% load get_image_by_size %}
{% load typogrify_tags %}
{%block htmlclass%}class="black"{%endblock%}
{% block sitename %}
@@ -11,11 +12,10 @@
<article class="h-entry hentry" itemscope itemType="http://schema.org/Article">
<div class="post--image">
<a href="{{object.get_absolute_url}}" title="{{object.title}}">
+ {%for image in homepage.images.all%}
<img class="u-photo post-image homepage--hero" itemprop="image" sizes="(max-width: 960px) 100vw"
- srcset="{{IMAGES_URL}}{% now "Y"%}/{{homepage.image_base_url}}-640.jpg 640w,
- {{IMAGES_URL}}{% now "Y"%}/{{homepage.image_base_url}}.jpg 1140w,
- {{IMAGES_URL}}{% now "Y"%}/{{homepage.image_base_url}}-2280.jpg 2280w"
- src="{{IMAGES_URL}}{% now "Y"%}/{{homepage.image_base_url}}.jpg" alt="{{homepage.alt_text}}">
+srcset="{% for size in image.sizes.all%}{% get_image_by_size image size %} {{size}}w{% if forloop.last%}"{%else%}, {%endif%}{%endfor%}
+ {% for size in image.sizes.all%}{%if not forloop.first and not forloop.last%}src="{% get_image_by_size image size %}"{%endif%}{%endfor%} alt="{{image.alt}} photographed by {% if image.photo_credit_source %}{{image.photo_credit_source}}{%else%}luxagraf{%endif%}">{%endfor%}
</a>
</div>
<div class="hero--wrapper">