diff --git a/cms_pages/migrations/0006_auto_20160916_0317.py b/cms_pages/migrations/0006_auto_20160916_0317.py new file mode 100644 index 00000000..77079394 --- /dev/null +++ b/cms_pages/migrations/0006_auto_20160916_0317.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-09-16 03:17 +from __future__ import unicode_literals + +import cms_pages.models +from django.db import migrations +import wagtail.wagtailcore.blocks +import wagtail.wagtailcore.fields +import wagtail.wagtailimages.blocks + + +class Migration(migrations.Migration): + + dependencies = [ + ('cms_pages', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='homepage', + name='body', + field=wagtail.wagtailcore.fields.StreamField([('basic_content', wagtail.wagtailcore.blocks.StructBlock([(b'panel_type', wagtail.wagtailcore.blocks.ChoiceBlock(choices=[('blue_left', 'Left-aligned image, blue-filtered image BG'), ('white_right', 'Right-aligned image, white background')])), (b'heading', wagtail.wagtailcore.blocks.CharBlock(required=True)), (b'inset_illustration', wagtail.wagtailcore.blocks.ChoiceBlock(choices=[('antarctica.svg', 'Antarctica'), ('bridge.svg', 'Bridge'), ('casino.svg', 'Casino'), ('cradle.svg', 'Cradle Mountain'), ('devil.svg', 'Tasmanian Devil'), ('falls.svg', 'Waterfall'), ('hobart.svg', 'Hobart'), ('lavender.svg', 'Lavender'), ('tuz.svg', 'Tuz'), ('wineglass.svg', 'Wineglass')])), (b'background_image', wagtail.wagtailimages.blocks.ImageChooserBlock(help_text="This is used as the background image of a blue-left block. It's not used for white-right.", required=False)), (b'body', wagtail.wagtailcore.blocks.RichTextBlock(required=True)), (b'link', wagtail.wagtailcore.blocks.StructBlock([('page', wagtail.wagtailcore.blocks.PageChooserBlock()), ('title', wagtail.wagtailcore.blocks.CharBlock(required=True))])), (b'external_links', wagtail.wagtailcore.blocks.ListBlock(cms_pages.models.ExternalLinksBlock))])), ('keynotes', wagtail.wagtailcore.blocks.StructBlock([(b'heading', wagtail.wagtailcore.blocks.CharBlock(required=True)), (b'speakers', wagtail.wagtailcore.blocks.ListBlock(cms_pages.models.KeynoteSpeakerBlock))]))]), + ), + ] diff --git a/cms_pages/migrations/0007_auto_20160916_0417.py b/cms_pages/migrations/0007_auto_20160916_0417.py new file mode 100644 index 00000000..28b0db66 --- /dev/null +++ b/cms_pages/migrations/0007_auto_20160916_0417.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-09-16 04:17 +from __future__ import unicode_literals + +from django.db import migrations +import wagtail.wagtailcore.blocks +import wagtail.wagtailcore.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('cms_pages', '0006_auto_20160916_0317'), + ] + + operations = [ + migrations.AlterField( + model_name='contentpage', + name='body', + field=wagtail.wagtailcore.fields.StreamField([('rich_text', wagtail.wagtailcore.blocks.RichTextBlock(required=False))]), + ), + migrations.AlterField( + model_name='newsindexpage', + name='body', + field=wagtail.wagtailcore.fields.StreamField([('rich_text', wagtail.wagtailcore.blocks.RichTextBlock(required=False))]), + ), + migrations.AlterField( + model_name='newspage', + name='body', + field=wagtail.wagtailcore.fields.StreamField([('rich_text', wagtail.wagtailcore.blocks.RichTextBlock(required=False))]), + ), + ] diff --git a/cms_pages/migrations/0008_auto_20160916_0417.py b/cms_pages/migrations/0008_auto_20160916_0417.py new file mode 100644 index 00000000..62847be7 --- /dev/null +++ b/cms_pages/migrations/0008_auto_20160916_0417.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +from wagtail.wagtailcore.rich_text import RichText + + +models = ["ContentPage", "NewsIndexPage", "NewsPage", ] + + +def convert_to_streamfield(apps, schema_editor): + for model_name in models: + _convert_to_streamfield(apps, model_name) + + +def _convert_to_streamfield(apps, model_name): + Model = apps.get_model("cms_pages", model_name) + for page in Model.objects.all(): + if page.body.raw_text and not page.body: + page.body = [('rich_text', RichText(page.body.raw_text))] + page.save() + + +def convert_to_richtext(apps, schema_editor): + for model_name in models: + _convert_to_richtext(apps, model_name) + + +def _convert_to_richtext(apps, model_name): + Model = apps.get_model("cms_pages", model_name) + for page in Model.objects.all(): + if page.body.raw_text is None: + raw_text = ''.join([ + child.value.source for child in page.body + if child.block_type == 'rich_text' + ]) + page.body = raw_text + page.save() + + +class Migration(migrations.Migration): + + dependencies = [ + ('cms_pages', '0007_auto_20160916_0417'), + ] + + operations = [ + migrations.RunPython( + convert_to_streamfield, + convert_to_richtext, + ), + ] diff --git a/cms_pages/migrations/0009_auto_20160916_0503.py b/cms_pages/migrations/0009_auto_20160916_0503.py new file mode 100644 index 00000000..5911ddc3 --- /dev/null +++ b/cms_pages/migrations/0009_auto_20160916_0503.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-09-16 05:03 +from __future__ import unicode_literals + +from django.db import migrations +import wagtail.wagtailcore.blocks +import wagtail.wagtailcore.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('cms_pages', '0008_auto_20160916_0417'), + ] + + operations = [ + migrations.AlterField( + model_name='contentpage', + name='body', + field=wagtail.wagtailcore.fields.StreamField([('rich_text', wagtail.wagtailcore.blocks.RichTextBlock(required=False)), ('raw_html', wagtail.wagtailcore.blocks.RawHTMLBlock(required=False))]), + ), + migrations.AlterField( + model_name='newsindexpage', + name='body', + field=wagtail.wagtailcore.fields.StreamField([('rich_text', wagtail.wagtailcore.blocks.RichTextBlock(required=False)), ('raw_html', wagtail.wagtailcore.blocks.RawHTMLBlock(required=False))]), + ), + migrations.AlterField( + model_name='newspage', + name='body', + field=wagtail.wagtailcore.fields.StreamField([('rich_text', wagtail.wagtailcore.blocks.RichTextBlock(required=False)), ('raw_html', wagtail.wagtailcore.blocks.RawHTMLBlock(required=False))]), + ), + ] diff --git a/cms_pages/migrations/0010_auto_20160916_0729.py b/cms_pages/migrations/0010_auto_20160916_0729.py new file mode 100644 index 00000000..111ea7a9 --- /dev/null +++ b/cms_pages/migrations/0010_auto_20160916_0729.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-09-16 07:29 +from __future__ import unicode_literals + +import cms_pages.models +from django.db import migrations +import wagtail.wagtailcore.blocks +import wagtail.wagtailcore.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('cms_pages', '0009_auto_20160916_0503'), + ] + + operations = [ + migrations.AlterField( + model_name='contentpage', + name='body', + field=wagtail.wagtailcore.fields.StreamField([('rich_text', wagtail.wagtailcore.blocks.RichTextBlock(required=False)), ('raw_html', wagtail.wagtailcore.blocks.RawHTMLBlock(required=False)), ('floating_image', cms_pages.models.FloatingImageBlock()), ('anchor', cms_pages.models.AnchorBlock(help_text='Add a named anchor to this point in the page'))]), + ), + migrations.AlterField( + model_name='newsindexpage', + name='body', + field=wagtail.wagtailcore.fields.StreamField([('rich_text', wagtail.wagtailcore.blocks.RichTextBlock(required=False)), ('raw_html', wagtail.wagtailcore.blocks.RawHTMLBlock(required=False)), ('floating_image', cms_pages.models.FloatingImageBlock()), ('anchor', cms_pages.models.AnchorBlock(help_text='Add a named anchor to this point in the page'))]), + ), + migrations.AlterField( + model_name='newspage', + name='body', + field=wagtail.wagtailcore.fields.StreamField([('rich_text', wagtail.wagtailcore.blocks.RichTextBlock(required=False)), ('raw_html', wagtail.wagtailcore.blocks.RawHTMLBlock(required=False)), ('floating_image', cms_pages.models.FloatingImageBlock()), ('anchor', cms_pages.models.AnchorBlock(help_text='Add a named anchor to this point in the page'))]), + ), + ] diff --git a/cms_pages/migrations/0011_scheduleheaderparagraph_squashed_0012_auto_20160918_0141.py b/cms_pages/migrations/0011_scheduleheaderparagraph_squashed_0012_auto_20160918_0141.py new file mode 100644 index 00000000..6b7cd669 --- /dev/null +++ b/cms_pages/migrations/0011_scheduleheaderparagraph_squashed_0012_auto_20160918_0141.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-09-18 01:56 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + replaces = [(b'cms_pages', '0011_scheduleheaderparagraph'), (b'cms_pages', '0012_auto_20160918_0141')] + + dependencies = [ + ('cms_pages', '0010_auto_20160916_0729'), + ('symposion_schedule', '0002_presentation_unpublish'), + ] + + operations = [ + migrations.CreateModel( + name='ScheduleHeaderParagraph', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('text', models.TextField()), + ('schedule', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='header_paragraph', to='symposion_schedule.Schedule')), + ], + ), + ] diff --git a/cms_pages/migrations/0012_namedheaderparagraph.py b/cms_pages/migrations/0012_namedheaderparagraph.py new file mode 100644 index 00000000..868a20f7 --- /dev/null +++ b/cms_pages/migrations/0012_namedheaderparagraph.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-09-18 02:09 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('cms_pages', '0011_scheduleheaderparagraph_squashed_0012_auto_20160918_0141'), + ] + + operations = [ + migrations.CreateModel( + name='NamedHeaderParagraph', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(help_text='Pass this name to header_paragraph tag.', max_length=64)), + ('text', models.TextField()), + ], + ), + ] diff --git a/cms_pages/migrations/0013_auto_20160918_0358.py b/cms_pages/migrations/0013_auto_20160918_0358.py new file mode 100644 index 00000000..45389ea0 --- /dev/null +++ b/cms_pages/migrations/0013_auto_20160918_0358.py @@ -0,0 +1,108 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-09-18 03:58 +from __future__ import unicode_literals + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion +import taggit.managers +import wagtail.wagtailcore.models +import wagtail.wagtailimages.models +import wagtail.wagtailsearch.index + + +class Migration(migrations.Migration): + + dependencies = [ + ('wagtailcore', '0029_unicode_slugfield_dj19'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('wagtailimages', '0013_make_rendition_upload_callable'), + ('taggit', '0002_auto_20150616_2121'), + ('cms_pages', '0012_namedheaderparagraph'), + ] + + operations = [ + migrations.CreateModel( + name='CustomImage', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=255, verbose_name='title')), + ('file', models.ImageField(height_field='height', upload_to=wagtail.wagtailimages.models.get_upload_to, verbose_name='file', width_field='width')), + ('width', models.IntegerField(editable=False, verbose_name='width')), + ('height', models.IntegerField(editable=False, verbose_name='height')), + ('created_at', models.DateTimeField(auto_now_add=True, db_index=True, verbose_name='created at')), + ('focal_point_x', models.PositiveIntegerField(blank=True, null=True)), + ('focal_point_y', models.PositiveIntegerField(blank=True, null=True)), + ('focal_point_width', models.PositiveIntegerField(blank=True, null=True)), + ('focal_point_height', models.PositiveIntegerField(blank=True, null=True)), + ('file_size', models.PositiveIntegerField(editable=False, null=True)), + ('collection', models.ForeignKey(default=wagtail.wagtailcore.models.get_root_collection_id, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='wagtailcore.Collection', verbose_name='collection')), + ('tags', taggit.managers.TaggableManager(blank=True, help_text=None, through='taggit.TaggedItem', to='taggit.Tag', verbose_name='tags')), + ('uploaded_by_user', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='uploaded by user')), + ], + options={ + 'abstract': False, + }, + bases=(wagtail.wagtailsearch.index.Indexed, models.Model), + ), + migrations.AddField( + model_name='customimage', + name='author', + field=models.CharField(default='', help_text='The name of the author of the work', max_length=255), + preserve_default=False, + ), + migrations.AddField( + model_name='customimage', + name='copyright_year', + field=models.CharField(default='', help_text='The year the image was taken', max_length=64), + preserve_default=False, + ), + migrations.AddField( + model_name='customimage', + name='licence', + field=models.CharField(default='', help_text='The short-form code for the licence (e.g. CC-BY)', max_length=64), + preserve_default=False, + ), + migrations.AddField( + model_name='customimage', + name='source_url', + field=models.URLField(default='', help_text='The URL where you can find the original of this image'), + preserve_default=False, + ), + migrations.CreateModel( + name='CustomRendition', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('file', models.ImageField(height_field='height', upload_to=wagtail.wagtailimages.models.get_rendition_upload_to, width_field='width')), + ('width', models.IntegerField(editable=False)), + ('height', models.IntegerField(editable=False)), + ('focal_point_key', models.CharField(blank=True, default='', editable=False, max_length=255)), + ('filter', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='wagtailimages.Filter')), + ('image', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='renditions', to='cms_pages.CustomImage')), + ], + ), + migrations.AddField( + model_name='contentpage', + name='background_image_CUSTOM', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='cms_pages.CustomImage'), + ), + migrations.AddField( + model_name='newsindexpage', + name='background_image_CUSTOM', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='cms_pages.CustomImage'), + ), + migrations.AddField( + model_name='newspage', + name='background_image_CUSTOM', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='cms_pages.CustomImage'), + ), + migrations.AddField( + model_name='newspage', + name='portrait_image_CUSTOM', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='cms_pages.CustomImage'), + ), + migrations.AlterUniqueTogether( + name='customrendition', + unique_together=set([('image', 'filter', 'focal_point_key')]), + ), + ] diff --git a/cms_pages/migrations/0014_auto_20160918_0358.py b/cms_pages/migrations/0014_auto_20160918_0358.py new file mode 100644 index 00000000..b8a79102 --- /dev/null +++ b/cms_pages/migrations/0014_auto_20160918_0358.py @@ -0,0 +1,76 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-09-18 03:58 +from __future__ import unicode_literals + +from django.db import migrations + + +def image_to_custom_image(apps, schema_editor): + Image = apps.get_model("wagtailimages","Image") + CustomImage = apps.get_model("cms_pages", "CustomImage") + HomePage = apps.get_model("cms_pages", "HomePage") + #tags = TaggableManager(help_text=None, blank=True, verbose_name=_('tags')) + + keys = ( + "title", "file", "width", "height", "created_at", "uploaded_by_user", + "focal_point_y", "focal_point_x", "focal_point_width", + "focal_point_height", "file_size", + ) + + customs = {} + + for image in Image.objects.all(): + kwargs = dict((key, getattr(image, key)) for key in keys) + custom_image = CustomImage(**kwargs) + + # Does this actually work?! + custom_image.tags = image.tags + + custom_image.save() + + customs[image.id] = custom_image + + def swap(customs, block, key): + im = (block.value[key]) + if im is not None: + block.value[key] = customs[im.id] + + # Go through the links. + for page in HomePage.objects.all(): + for block in page.body: + if block.block_type == "basic_content": + swap(customs, block, "background_image") + elif block.block_type == "keynotes": + for keynote in block.value: + swap(customs, keynote, "profile_image") + page.save() + + abstract_content_page_models = ["ContentPage", "NewsIndexPage", "NewsPage"] + + for model in abstract_content_page_models: + Model = apps.get_model("cms_pages", model) + + for page in Model.objects.all(): + for block in page.body: + if block.block_type == "floating_image" and block.value: + block.value = customs[block.value.id] + + if page.background_image: + page.background_image_CUSTOM = customs[page.background_image.id] + + if model == "NewsPage" and page.portrait_image: + page.portrait_image_CUSTOM = customs[page.portrait_image.id] + + page.save() + + Image.objects.all().delete() + +class Migration(migrations.Migration): + + dependencies = [ + ('cms_pages', '0013_auto_20160918_0358'), + ] + + operations = [ + migrations.RunPython(image_to_custom_image), + ] diff --git a/cms_pages/migrations/0015_auto_20160918_0402_squashed_0016_auto_20160918_0403.py b/cms_pages/migrations/0015_auto_20160918_0402_squashed_0016_auto_20160918_0403.py new file mode 100644 index 00000000..70e429e7 --- /dev/null +++ b/cms_pages/migrations/0015_auto_20160918_0402_squashed_0016_auto_20160918_0403.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-09-18 04:05 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + replaces = [(b'cms_pages', '0015_auto_20160918_0402'), (b'cms_pages', '0016_auto_20160918_0403')] + + dependencies = [ + ('cms_pages', '0014_auto_20160918_0358'), + ] + + operations = [ + migrations.RemoveField( + model_name='contentpage', + name='background_image', + ), + migrations.RemoveField( + model_name='newsindexpage', + name='background_image', + ), + migrations.RemoveField( + model_name='newspage', + name='background_image', + ), + migrations.RemoveField( + model_name='newspage', + name='portrait_image', + ), + migrations.RenameField( + model_name='contentpage', + old_name='background_image_CUSTOM', + new_name='background_image', + ), + migrations.RenameField( + model_name='newsindexpage', + old_name='background_image_CUSTOM', + new_name='background_image', + ), + migrations.RenameField( + model_name='newspage', + old_name='background_image_CUSTOM', + new_name='background_image', + ), + migrations.RenameField( + model_name='newspage', + old_name='portrait_image_CUSTOM', + new_name='portrait_image', + ), + ] diff --git a/cms_pages/migrations/0016_auto_20160918_0517.py b/cms_pages/migrations/0016_auto_20160918_0517.py new file mode 100644 index 00000000..66c1742f --- /dev/null +++ b/cms_pages/migrations/0016_auto_20160918_0517.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-09-18 05:17 +from __future__ import unicode_literals + +import cms_pages.models +from django.db import migrations +import wagtail.wagtailcore.blocks +import wagtail.wagtailcore.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('cms_pages', '0015_auto_20160918_0402_squashed_0016_auto_20160918_0403'), + ] + + operations = [ + migrations.AlterField( + model_name='contentpage', + name='body', + field=wagtail.wagtailcore.fields.StreamField([('rich_text', wagtail.wagtailcore.blocks.RichTextBlock(required=False)), ('raw_html', wagtail.wagtailcore.blocks.RawHTMLBlock(required=False)), ('floating_image', cms_pages.models.FloatingImageBlock()), ('anchor', cms_pages.models.AnchorBlock(help_text='Add a named anchor to this point in the page')), ('colophon_image_list', wagtail.wagtailcore.blocks.StructBlock([(b'do_nothing', wagtail.wagtailcore.blocks.BooleanBlock())]))]), + ), + migrations.AlterField( + model_name='newsindexpage', + name='body', + field=wagtail.wagtailcore.fields.StreamField([('rich_text', wagtail.wagtailcore.blocks.RichTextBlock(required=False)), ('raw_html', wagtail.wagtailcore.blocks.RawHTMLBlock(required=False)), ('floating_image', cms_pages.models.FloatingImageBlock()), ('anchor', cms_pages.models.AnchorBlock(help_text='Add a named anchor to this point in the page')), ('colophon_image_list', wagtail.wagtailcore.blocks.StructBlock([(b'do_nothing', wagtail.wagtailcore.blocks.BooleanBlock())]))]), + ), + migrations.AlterField( + model_name='newspage', + name='body', + field=wagtail.wagtailcore.fields.StreamField([('rich_text', wagtail.wagtailcore.blocks.RichTextBlock(required=False)), ('raw_html', wagtail.wagtailcore.blocks.RawHTMLBlock(required=False)), ('floating_image', cms_pages.models.FloatingImageBlock()), ('anchor', cms_pages.models.AnchorBlock(help_text='Add a named anchor to this point in the page')), ('colophon_image_list', wagtail.wagtailcore.blocks.StructBlock([(b'do_nothing', wagtail.wagtailcore.blocks.BooleanBlock())]))]), + ), + ] diff --git a/cms_pages/models.py b/cms_pages/models.py index 1f8fd2d5..2f2733c5 100644 --- a/cms_pages/models.py +++ b/cms_pages/models.py @@ -1,24 +1,40 @@ from __future__ import unicode_literals +from django import forms from django.http import Http404 + from django.db import models +from django.db.models.signals import pre_delete +from django.dispatch import receiver + from django.shortcuts import render +from django.utils.encoding import python_2_unicode_compatible from modelcluster.fields import ParentalKey +from wagtail.wagtailadmin.edit_handlers import InlinePanel +from wagtail.wagtailadmin.edit_handlers import FieldPanel +from wagtail.wagtailadmin.edit_handlers import PageChooserPanel +from wagtail.wagtailadmin.edit_handlers import StreamFieldPanel + from wagtail.wagtailcore import blocks -from wagtail.wagtailimages import blocks as imageblocks from wagtail.wagtailcore.models import Page from wagtail.wagtailcore.models import Orderable from wagtail.wagtailcore.fields import RichTextField from wagtail.wagtailcore.fields import StreamField from wagtail.wagtailcore.url_routing import RouteResult + +from wagtail.wagtailimages import blocks as imageblocks from wagtail.wagtailimages.edit_handlers import ImageChooserPanel -from wagtail.wagtailadmin.edit_handlers import InlinePanel -from wagtail.wagtailadmin.edit_handlers import FieldPanel -from wagtail.wagtailadmin.edit_handlers import PageChooserPanel -from wagtail.wagtailadmin.edit_handlers import StreamFieldPanel +from wagtail.wagtailimages.models import AbstractImage +from wagtail.wagtailimages.models import AbstractRendition +from wagtail.wagtailimages.models import Image + from wagtail.wagtailsearch import index +from wagtail.wagtailsnippets.models import register_snippet + + +from symposion import schedule ILLUSTRATION_ANTARCTICA = "antarctica.svg" ILLUSTRATION_BRIDGE = "bridge.svg" @@ -45,6 +61,29 @@ ILLUSTRATION_TYPES = ( ) +class ExternalLinksBlock(blocks.StructBlock): + + class Meta: + template = "cms_pages/home_page_blocks/external_link.html" + + EXTERNAL_LINK_TWITTER = "twitter" + EXTERNAL_LINK_FACEBOOK = "facebook" + EXTERNAL_LINK_GENERIC = "generic" + + EXTERNAL_LINK_TYPES = ( + (EXTERNAL_LINK_TWITTER, "Twitter"), + (EXTERNAL_LINK_FACEBOOK, "Facebook"), + (EXTERNAL_LINK_GENERIC, "Generic URL"), + ) + + alt = blocks.CharBlock(required=True) + icon = blocks.ChoiceBlock( + choices=EXTERNAL_LINK_TYPES, + required=True, + ) + url = blocks.URLBlock(required=True) + + class BasicContentBlock(blocks.StructBlock): class Meta: @@ -57,16 +96,6 @@ class BasicContentBlock(blocks.StructBlock): (PANEL_WHITE_RIGHT, "Right-aligned image, white background"), ) - EXTERNAL_LINK_TWITTER = "twitter" - EXTERNAL_LINK_FACEBOOK = "facebook" - EXTERNAL_LINK_GENERIC = "generic" - - EXTERNAL_LINK_TYPES = ( - (EXTERNAL_LINK_TWITTER, "Twitter"), - (EXTERNAL_LINK_FACEBOOK, "Facebook"), - (EXTERNAL_LINK_GENERIC, "Generic URL"), - ) - panel_type = blocks.ChoiceBlock( choices=PANEL_TYPES, required=True, @@ -86,22 +115,45 @@ class BasicContentBlock(blocks.StructBlock): ("page", blocks.PageChooserBlock()), ("title", blocks.CharBlock(required=True)), ]) - external_links = blocks.ListBlock( - blocks.StructBlock([ - ("alt", blocks.CharBlock(required=True)), - ("icon", blocks.ChoiceBlock( - choices=EXTERNAL_LINK_TYPES, - required=True, - )), - ("url", blocks.URLBlock(required=True) - )]) + external_links = blocks.ListBlock(ExternalLinksBlock) + + +class PresentationChooserBlock(blocks.ChooserBlock): + target_model = schedule.models.Presentation + widget = forms.Select + + +class KeynoteSpeakerBlock(blocks.StructBlock): + + class Meta: + template = "cms_pages/home_page_blocks/keynote_speaker.html" + + name = blocks.CharBlock(required=True) + body = blocks.RichTextBlock(required=True) + links = blocks.ListBlock(ExternalLinksBlock) + profile_image = imageblocks.ImageChooserBlock( + required=False, + help_text="Profile image for the speaker", ) + presentation = PresentationChooserBlock( + help_text="This speaker's presentation", + ) + + +class KeynotesBlock(blocks.StructBlock): + + class Meta: + template = "cms_pages/home_page_blocks/keynotes.html" + + heading = blocks.CharBlock(required=True) + speakers = blocks.ListBlock(KeynoteSpeakerBlock) + class HomePage(Page): body = StreamField([ ("basic_content", BasicContentBlock()), - # TODO: keynotes + ("keynotes", KeynotesBlock()), # TODO: other bits ]) @@ -111,15 +163,46 @@ class HomePage(Page): # Content pages + +class FloatingImageBlock(imageblocks.ImageChooserBlock): + + class Meta: + template = "cms_pages/content_page_blocks/floating_image.html" + + +class AnchorBlock(blocks.CharBlock): + + class Meta: + template = "cms_pages/content_page_blocks/anchor.html" + + +class ColophonImageListBlock(blocks.StructBlock): + + class Meta: + template = "cms_pages/content_page_blocks/colophon.html" + + do_nothing = blocks.BooleanBlock(required=False) + + class AbstractContentPage(Page): class Meta: abstract = True intro = models.CharField(max_length=250) - body = RichTextField(blank=True) + + body = StreamField([ + ("rich_text", blocks.RichTextBlock(required=False)), + ("raw_html", blocks.RawHTMLBlock(required=False)), + ("floating_image", FloatingImageBlock()), + ("anchor", AnchorBlock( + help_text="Add a named anchor to this point in the page" + )), + ("colophon_image_list", ColophonImageListBlock()), + ]) + background_image = models.ForeignKey( - 'wagtailimages.Image', + 'CustomImage', null=True, blank=True, on_delete=models.SET_NULL, @@ -134,7 +217,7 @@ class AbstractContentPage(Page): content_panels = Page.content_panels + [ ImageChooserPanel('background_image'), FieldPanel('intro'), - FieldPanel('body', classname="full") + StreamFieldPanel('body') ] @@ -195,7 +278,7 @@ class NewsPage(AbstractContentPage): date = models.DateField("Post date") portrait_image = models.ForeignKey( - 'wagtailimages.Image', + 'CustomImage', null=True, blank=True, on_delete=models.SET_NULL, @@ -210,3 +293,93 @@ class NewsPage(AbstractContentPage): FieldPanel('date'), ImageChooserPanel('portrait_image'), ] + + +@register_snippet +@python_2_unicode_compatible +class ScheduleHeaderParagraph(models.Model): + ''' Used to show the paragraph in the header for a schedule page. ''' + schedule = models.OneToOneField( + schedule.models.Schedule, + related_name="header_paragraph", + ) + text = models.TextField() + + panels = [ + FieldPanel('schedule'), + FieldPanel('text'), + ] + + def __str__(self): + return str(self.schedule) + + +@register_snippet +@python_2_unicode_compatible +class NamedHeaderParagraph(models.Model): + ''' Used to show the paragraph in the header for a schedule page. ''' + name = models.CharField( + max_length=64, + help_text="Pass this name to header_paragraph tag.", + ) + text = models.TextField() + + panels = [ + FieldPanel('name'), + FieldPanel('text'), + ] + + def __str__(self): + return str(self.name) + + +# Image models -- copied from wagtail docs + + +class CustomImage(AbstractImage): + # Add any extra fields to image here + + # eg. To add a caption field: + copyright_year = models.CharField( + max_length=64, + help_text="The year the image was taken", + ) + licence = models.CharField( + max_length=64, + help_text="The short-form code for the licence (e.g. CC-BY)", + ) + author = models.CharField( + max_length=255, + help_text="The name of the author of the work", + ) + source_url = models.URLField( + help_text="The URL where you can find the original of this image", + ) + + admin_form_fields = Image.admin_form_fields + ( + "copyright_year", + "licence", + "author", + "source_url", + ) + + +class CustomRendition(AbstractRendition): + image = models.ForeignKey(CustomImage, related_name='renditions') + + class Meta: + unique_together = ( + ('image', 'filter', 'focal_point_key'), + ) + + +# Delete the source image file when an image is deleted +@receiver(pre_delete, sender=CustomImage) +def image_delete(sender, instance, **kwargs): + instance.file.delete(False) + + +# Delete the rendition image file when a rendition is deleted +@receiver(pre_delete, sender=CustomRendition) +def rendition_delete(sender, instance, **kwargs): + instance.file.delete(False) diff --git a/pinaxcon/settings.py b/pinaxcon/settings.py index 9aa64b5c..144468be 100644 --- a/pinaxcon/settings.py +++ b/pinaxcon/settings.py @@ -15,6 +15,13 @@ DATABASES = { } } +CACHES = { + 'default': { + 'BACKEND': 'django.core.cache.backends.dummy.DummyCache', + } +} + + ALLOWED_HOSTS = [] # Local time zone for this installation. Choices can be found here: @@ -26,9 +33,12 @@ ALLOWED_HOSTS = [] # system time zone. TIME_ZONE = "UTC" +# The date format for this installation +DATE_FORMAT = "j F Y" + # Language code for this installation. All choices can be found here: # http://www.i18nguy.com/unicode/language-identifiers.html -LANGUAGE_CODE = "en-us" +LANGUAGE_CODE = "en-au" SITE_ID = int(os.environ.get("SITE_ID", 1)) @@ -235,6 +245,7 @@ THEME_CONTACT_EMAIL = "team@hobart.lca2017.org" AUTHENTICATION_BACKENDS = [ "symposion.teams.backends.TeamPermissionsBackend", "account.auth_backends.UsernameAuthenticationBackend", + "account.auth_backends.EmailAuthenticationBackend", ] CONFERENCE_ID = 1 @@ -249,6 +260,7 @@ PROPOSAL_FORMS = { # Wagtail config WAGTAIL_SITE_NAME = 'linux.conf.au 2017' WAGTAIL_APPEND_SLASH = True +WAGTAILIMAGES_IMAGE_MODEL = 'cms_pages.CustomImage' ATTENDEE_PROFILE_FORM = "pinaxcon.registrasion.forms.ProfileForm" diff --git a/pinaxcon/templates/cms_pages/abstract_content_page.html b/pinaxcon/templates/cms_pages/abstract_content_page.html new file mode 100644 index 00000000..7b771c55 --- /dev/null +++ b/pinaxcon/templates/cms_pages/abstract_content_page.html @@ -0,0 +1,23 @@ +{% extends "lca2017/content_page.html" %} +{% load staticfiles %} +{% load wagtailcore_tags %} +{% load wagtailimages_tags %} +{% load lca2017_tags %} + +{% load sitetree %} +{% load i18n %} + +{% block body_class %}template-content-page{% endblock %} + +{% block head_title %}{{ page.title }}{% endblock %} + +{% if page.background_image %} + {% block header_background_image %}{% image page.background_image width-2000 as background_image %}{{ background_image.url }}{% endblock %} +{% endif %} +{% block header_title %}{{ page.title }}{% endblock %} +{% block header_paragraph %}{{ page.intro }}{% endblock %} +{% block header_inset_image %}{% endblock %} + +{% block content %} + {{ page.body }} +{% endblock %} diff --git a/pinaxcon/templates/cms_pages/content_page.html b/pinaxcon/templates/cms_pages/content_page.html index 25503132..e84ca5e9 100644 --- a/pinaxcon/templates/cms_pages/content_page.html +++ b/pinaxcon/templates/cms_pages/content_page.html @@ -1,21 +1,9 @@ -{% extends "site_base_wagtail.html" %} -{% load staticfiles %} -{% load wagtailcore_tags %} +{% extends "cms_pages/abstract_content_page.html" %} +{% load lca2017_tags %} {% load sitetree %} {% load i18n %} -{% block body_class %}template-blogpage{% endblock %} +{% block body_class %}template-content-page{% endblock %} -{% block head_title %}{{ page.title }}{% endblock %} - -{% block body %} - {% block content %} - {% include "cms_pages/content_page_header_panel.html" %} -
-
- {{ page.body|richtext }} -
-
- {% endblock %} -{% endblock %} +{% block header_inset_image %}{% illustration page.inset_illustration %}{% endblock %} diff --git a/pinaxcon/templates/cms_pages/content_page_blocks/anchor.html b/pinaxcon/templates/cms_pages/content_page_blocks/anchor.html new file mode 100644 index 00000000..5466c85f --- /dev/null +++ b/pinaxcon/templates/cms_pages/content_page_blocks/anchor.html @@ -0,0 +1 @@ + diff --git a/pinaxcon/templates/cms_pages/content_page_blocks/colophon.html b/pinaxcon/templates/cms_pages/content_page_blocks/colophon.html new file mode 100644 index 00000000..4d7a29b0 --- /dev/null +++ b/pinaxcon/templates/cms_pages/content_page_blocks/colophon.html @@ -0,0 +1,10 @@ +{% load lca2017_tags %} + + diff --git a/pinaxcon/templates/cms_pages/content_page_blocks/floating_image.html b/pinaxcon/templates/cms_pages/content_page_blocks/floating_image.html new file mode 100644 index 00000000..f72026f7 --- /dev/null +++ b/pinaxcon/templates/cms_pages/content_page_blocks/floating_image.html @@ -0,0 +1,4 @@ +{% load wagtailimages_tags %} + +{% image value width-800 as img %} +{% include "lca2017/_right_floating_image.html" with image_url=img.url %} diff --git a/pinaxcon/templates/cms_pages/content_page_header_panel.html b/pinaxcon/templates/cms_pages/content_page_header_panel.html deleted file mode 100644 index 0b67c4d3..00000000 --- a/pinaxcon/templates/cms_pages/content_page_header_panel.html +++ /dev/null @@ -1,33 +0,0 @@ -{% load staticfiles %} -{% load wagtailimages_tags %} - -
- {% if page.background_image %} - {% image page.background_image width-2000 as background_image %} -
- {% else %} -
- {% endif %} -
-
-

{{ page.title }}

-

{{ page.intro }}

-
- {% if page.inset_illustration or page.portrait_image %} -
- {% if page.inset_illustration %} -
- -
- {% elif page.portrait_image %} -
- {% image page.portrait_image width-640 as portrait_image %} -
-
- {% endif %} -
- {% endif %} -
-
diff --git a/pinaxcon/templates/cms_pages/home_page_blocks/basic_content_text_and_links.html b/pinaxcon/templates/cms_pages/home_page_blocks/basic_content_text_and_links.html index ba0f866e..68b3b74c 100644 --- a/pinaxcon/templates/cms_pages/home_page_blocks/basic_content_text_and_links.html +++ b/pinaxcon/templates/cms_pages/home_page_blocks/basic_content_text_and_links.html @@ -8,9 +8,7 @@ {{ value.link.title }} {% endif %} {% for link in value.external_links %} - - {% include "cms_pages/home_page_blocks/btn_svg.html" %} - + {{ link }} {% endfor %} diff --git a/pinaxcon/templates/cms_pages/home_page_blocks/external_link.html b/pinaxcon/templates/cms_pages/home_page_blocks/external_link.html new file mode 100644 index 00000000..7e57ec70 --- /dev/null +++ b/pinaxcon/templates/cms_pages/home_page_blocks/external_link.html @@ -0,0 +1,3 @@ + + {% include "cms_pages/home_page_blocks/btn_svg.html" with link=value %} + diff --git a/pinaxcon/templates/cms_pages/home_page_blocks/keynote_speaker.html b/pinaxcon/templates/cms_pages/home_page_blocks/keynote_speaker.html new file mode 100644 index 00000000..39e029e4 --- /dev/null +++ b/pinaxcon/templates/cms_pages/home_page_blocks/keynote_speaker.html @@ -0,0 +1,25 @@ +{% load wagtailcore_tags %} +{% load wagtailimages_tags %} + +{% image value.profile_image width-800 as profile_image %} +
+
+
+
+
+
+
+
+

{{ value.name }}

+ + {{ value.body }} + +
+ Read more + {% for link in value.links %} + {{ link }} + {% endfor %} +
+
+
+
diff --git a/pinaxcon/templates/cms_pages/home_page_blocks/keynotes.html b/pinaxcon/templates/cms_pages/home_page_blocks/keynotes.html new file mode 100644 index 00000000..3e6179d3 --- /dev/null +++ b/pinaxcon/templates/cms_pages/home_page_blocks/keynotes.html @@ -0,0 +1,12 @@ +
+
+
+
+

{{ value.heading }}

+
+
+
+ +{% for speaker in value.speakers %} + {{ speaker }} +{% endfor %} diff --git a/pinaxcon/templates/cms_pages/news_index_page.html b/pinaxcon/templates/cms_pages/news_index_page.html index 517ffd7d..919857d0 100644 --- a/pinaxcon/templates/cms_pages/news_index_page.html +++ b/pinaxcon/templates/cms_pages/news_index_page.html @@ -1,47 +1,45 @@ -{% extends "site_base_wagtail.html" %} +{% extends "cms_pages/abstract_content_page.html" %} {% load staticfiles %} {% load wagtailcore_tags %} {% load wagtailimages_tags %} +{% load lca2017_tags %} {% load sitetree %} {% load i18n %} -{% block body_class %}template-blogpage{% endblock %} - {% block head_title %}{{ page.title }}{% endblock %} +{% block body_class %}template-news-index{% endblock %} -{% block body %} - {% block content %} - {% include "cms_pages/content_page_header_panel.html" %} +{% block inset_image_base %}{% endblock %} - {% if page.child_pages %} - {% for item in page.child_pages %} -
-
-
-
- {% image item.portrait_image width-640 as portrait_image %} -
-
-
-
-

{{ item.title }}

-

{{ item.date|date:"j F Y" }} – {{ item.intro }}

- Read more +{% comment %}We use panels here, so don't need to wrap in a text block{% endcomment %} +{% block content_base %} + {% if page.child_pages %} + {% for item in page.child_pages %} +
+
+
+
+ {% image item.portrait_image width-640 as portrait_image %} +
+
+

{{ item.title }}

+

{{ item.date|date:"j F Y" }} – {{ item.intro }}

+ Read more +
- {% endfor %} -
- {% endif %} - -
-
-

Subscribe

-

View as RSS

-
+ {% endfor %} +
+ {% endif %} - {% endblock %} +
+
+

Subscribe

+

View as RSS

+
+
{% endblock %} diff --git a/pinaxcon/templates/cms_pages/news_index_page.rss b/pinaxcon/templates/cms_pages/news_index_page.rss index 616dcb1f..dd4c5d2b 100644 --- a/pinaxcon/templates/cms_pages/news_index_page.rss +++ b/pinaxcon/templates/cms_pages/news_index_page.rss @@ -24,7 +24,7 @@ {{ item.intro|richtext|force_escape }} </p> <p> - {{ item.body|richtext|force_escape }} + {{ item.body|force_escape }} </p> diff --git a/pinaxcon/templates/cms_pages/news_page.html b/pinaxcon/templates/cms_pages/news_page.html index 720928f6..0d95b02c 100644 --- a/pinaxcon/templates/cms_pages/news_page.html +++ b/pinaxcon/templates/cms_pages/news_page.html @@ -1,4 +1,4 @@ -{% extends "site_base_wagtail.html" %} +{% extends "cms_pages/abstract_content_page.html" %} {% load wagtailcore_tags %} {% load wagtailimages_tags %} @@ -6,18 +6,15 @@ {% load sitetree %} {% load i18n %} -{% block body_class %}template-blogpage{% endblock %} +{% block body_class %}template-newspage{% endblock %} {% block head_title %}{{ page.title }}{% endblock %} -{% block body %} - {% block content %} - {% include "cms_pages/content_page_header_panel.html" %} -
-
-

{{ page.date|date:"j F Y" }}

- {{ page.body|richtext }} -
-
- {% endblock %} +{% if page.portrait_image %} + {% block header_inset_image %}{% image page.portrait_image width-640 as portrait_image %}{{ portrait_image.url }}{% endblock %} +{% endif %} + +{% block content %} +

{{ page.date|date:"j F Y" }}

+ {{ page.body }} {% endblock %} diff --git a/pinaxcon/templates/lca2017/_right_floating_image.html b/pinaxcon/templates/lca2017/_right_floating_image.html new file mode 100644 index 00000000..3177b39f --- /dev/null +++ b/pinaxcon/templates/lca2017/_right_floating_image.html @@ -0,0 +1,5 @@ +
+
+
+
+
diff --git a/pinaxcon/templates/lca2017/content_page.html b/pinaxcon/templates/lca2017/content_page.html new file mode 100644 index 00000000..aa2a8714 --- /dev/null +++ b/pinaxcon/templates/lca2017/content_page.html @@ -0,0 +1,50 @@ +{% extends "site_base_wagtail.html" %} +{% load staticfiles %} +{% load wagtailcore_tags %} + +{% load lca2017_tags %} + + +{% load sitetree %} +{% load i18n %} + +{% block body_class %}template-content-page{% endblock %} + +{% block head_title %}{% endblock %} + +{% block body %} + {% block heading_panel %} +
+ +
+ +
+
+

{% block header_title %}{% endblock %}

+

{% block header_paragraph %}{% endblock %}

+
+ {% block header_inset_image_base %} +
+
+
+
+
+ {% endblock %} +
+ +
+ {% endblock %} + + {% block content_base %} +
+
+ {% block content %} + {% endblock %} +
+
+ {% endblock %} +{% endblock %} + +{% block extra_script %} + +{% endblock %} diff --git a/pinaxcon/templates/site_base.html b/pinaxcon/templates/site_base.html index c0f8dd17..99efe1dc 100755 --- a/pinaxcon/templates/site_base.html +++ b/pinaxcon/templates/site_base.html @@ -92,25 +92,26 @@ {% endblock %} {% block footer_base %} - -
- {% block footer %} - {% comment %} - - - {% endcomment %} + +
+ {% block footer %} + + -

©2016 Linux Australia and linux.conf.au 2017. Linux is a registered trademark of Linus Torvalds. Site design by Takeflight. Image credits can be found on our Colophon.

+

©2016 Linux Australia and linux.conf.au 2017. Linux is a registered trademark of Linus Torvalds. Site design by Takeflight. Image credits can be found on our Colophon.

- {% endblock %} -
+ {% endblock %} +
{% endblock %} {% block scripts %} diff --git a/pinaxcon/templates/symposion/reviews/review_detail.html b/pinaxcon/templates/symposion/reviews/review_detail.html index ced77872..3d8a0d87 100644 --- a/pinaxcon/templates/symposion/reviews/review_detail.html +++ b/pinaxcon/templates/symposion/reviews/review_detail.html @@ -27,6 +27,7 @@
+ {% else %} {% if proposal.result.status == "rejected" %} Rejected diff --git a/pinaxcon/templates/symposion/schedule/_grid.html b/pinaxcon/templates/symposion/schedule/_grid.html index 5df035b0..eac7abd4 100644 --- a/pinaxcon/templates/symposion/schedule/_grid.html +++ b/pinaxcon/templates/symposion/schedule/_grid.html @@ -1,41 +1,41 @@ - - - - {% for room in timetable.rooms %} - - {% endfor %} - - - - {% for row in timetable %} - - - {% for slot in row.slots %} - - {% endfor %} - {% if forloop.last %} - - {% endif %} - + + + + {% for room in timetable.rooms %} + + {% endfor %} + + + + {% for row in timetable %} + + + {% for slot in row.slots %} + {% endfor %} - + {% if forloop.last %} + + {% endif %} + + {% endfor %} +
 {{ room.name }}
{{ row.time|date:"h:iA" }} - {% if slot.kind.label == "talk" or slot.kind.label == "tutorial" %} - {% if not slot.content %} - {% else %} - - {{ slot.content.title }} - - - {{ slot.content.speakers|join:", " }} - - {% endif %} - {% else %} - {% if slot.content_override.raw %} - {{ slot.content_override.rendered|safe }} - {% else %} - {{ slot.kind.label }} - {% endif %} - {% endif %} -
 {{ room.name }}
{{ row.time|date:"h:iA" }} + {% if slot.kind.label == "talk" or slot.kind.label == "tutorial" %} + {% if not slot.content %} + {% else %} + + {{ slot.content.title }} + + + {{ slot.content.speakers|join:", " }} + + {% endif %} + {% else %} + {% if slot.content_override.raw %} + {{ slot.content_override.rendered|safe }} + {% else %} + {{ slot.kind.label }} + {% endif %} + {% endif %} +
diff --git a/pinaxcon/templates/symposion/schedule/presentation_detail.html b/pinaxcon/templates/symposion/schedule/presentation_detail.html index fe8c1fdc..9ae0d5d9 100644 --- a/pinaxcon/templates/symposion/schedule/presentation_detail.html +++ b/pinaxcon/templates/symposion/schedule/presentation_detail.html @@ -1,31 +1,56 @@ -{% extends "site_base.html" %} +{% extends "symposion/schedule/public_base.html" %} +{% load lca2017_tags %} {% load sitetree %} +{% load staticfiles %} +{% load thumbnail %} {% block head_title %}Presentation: {{ presentation.title }}{% endblock %} {% block breadcrumbs %}{% sitetree_breadcrumbs from "main" %}{% endblock %} -{% block body %} - {% if presentation.slot %} -

- {{ presentation.slot.day.date|date:"l" }} - {{ presentation.slot.start}}–{{ presentation.slot.end }} -

- {% endif %} -

{{ presentation.title }}

+{% block header_inset_image %}{% with audience=presentation.proposal.get_target_audience_display %}{% if audience == "Business" %}{% illustration "falls.svg" %}{% elif audience == "Community" %}{% illustration "bridge.svg" %}{% elif audience == "Developer"%}{% illustration "hobart.svg" %}{% elif audience == "User" %}{% illustration "antarctica.svg" %}{% else %}{% illustration "casino.svg" %}{% endif %}{% endwith %}{% endblock %} -

- {% for speaker in presentation.speakers %} - {{ speaker }}{% if not forloop.last %}, {% endif %}{% endfor %} -

+{% block header_background_image %}{% presentation_bg_number presentation 4 as bg_number %}{% if bg_number == 0 %}{% static "lca2017/images/mt_anne_bg_optimised.jpg" %}{% elif bg_number == 1 %}{% static "lca2017/images/the_neck_bg_optimised.jpg" %}{% elif bg_number == 2 %}{% static "lca2017/images/snug_falls_bg_optimised.jpg" %}{% elif bg_number == 3 %}{% static "lca2017/images/sleepy_bay_bg_optimised.jpg" %}{% endif %}{% endblock %} -
-
Audience level:
-
{{ presentation.proposal.get_audience_level_display }}
-
+{% block header_title %}{{ presentation.title }}{% endblock %} + +{% block header_paragraph %} +

+ Presented by + {% for speaker in presentation.speakers %} + {{ speaker }}{% if not forloop.last %}, {% endif %} + {% endfor %} +
+ {% if presentation.slot %} + {{ presentation.slot.day.date|date:"l" }} + {{ presentation.slot.start}}–{{ presentation.slot.end }} +
+ {% endif %} + {% if presentation.proposal.get_target_audience_display %} + Target audience: + {{ presentation.proposal.get_target_audience_display }} + {% endif %} +{% endblock %} + +{% block content %} + + {% if presentation.unpublish %} +

Presentation not published.

+ {% endif %} + +

Abstract

+ +
{{ presentation.abstract_html|safe }}
+ +

Presented by

+ {% for speaker in presentation.speakers %} + {% speaker_photo speaker 512 as speaker_photo_url %} + {% include "lca2017/_right_floating_image.html" with image_url=speaker_photo_url %} + +

{{ speaker }}

+ {{ speaker.biography_html|safe}} + + {% endfor %} -

Abstract

- -
{{ presentation.abstract_html|safe }}
{% endblock %} diff --git a/pinaxcon/templates/symposion/schedule/public_base.html b/pinaxcon/templates/symposion/schedule/public_base.html new file mode 100644 index 00000000..b2ae87e2 --- /dev/null +++ b/pinaxcon/templates/symposion/schedule/public_base.html @@ -0,0 +1,5 @@ +{% extends "lca2017/content_page.html" %} + +{% load staticfiles %} + +{% block header_background_image %}{% static "lca2017/images/hobart_bg_optimised.jpg" %}{% endblock %} diff --git a/pinaxcon/templates/symposion/schedule/schedule_conference.html b/pinaxcon/templates/symposion/schedule/schedule_conference.html index 6dc71ccd..28122d6f 100644 --- a/pinaxcon/templates/symposion/schedule/schedule_conference.html +++ b/pinaxcon/templates/symposion/schedule/schedule_conference.html @@ -1,34 +1,35 @@ -{% extends "site_base_wagtail.html" %} +{% extends "symposion/schedule/public_base.html" %} {% load i18n %} {% load pinax_boxes_tags %} {% load cache %} +{% load lca2017_tags %} {% block head_title %}Conference Schedule{% endblock %} +{% block header_title %}Conference Schedule{% endblock %} +{% block header_paragraph %}{% header_paragraph "conference_schedule" %}{% endblock %} +{% block header_inset_image %}{% illustration "cradle.svg" %}{% endblock %} {% block body_class %}full{% endblock %} {% block right %} {% endblock %} -{% block body %} -
-
-
+{% block content %} -
-

Conference Schedule

- {% block breadcrumbs %}{% endblock %} -
+
+ {% block breadcrumbs %}{% endblock %} +
- {% for section in sections %} - {% cache 600 "schedule-table" section.schedule.section %} - {% for timetable in section.days %} -

{{ section.schedule.section.name }} — {{ timetable.day.date }}

- {% include "symposion/schedule/_grid.html" %} - {% endfor %} - {% endcache %} - {% endfor %} + {% for section in sections %} + {% cache 600 "schedule-table" section.schedule.section %} + {% for timetable in section.days %} +

{{ section.schedule.section.name }} — {{ timetable.day.date|date:"l" }}, {{ timetable.day.date }}

+
+ {% include "symposion/schedule/_grid.html" %} +
+ {% endfor %} + {% endcache %} + {% endfor %} -
{% endblock %} diff --git a/pinaxcon/templates/symposion/schedule/schedule_detail.html b/pinaxcon/templates/symposion/schedule/schedule_detail.html index 5de03481..4ef77867 100644 --- a/pinaxcon/templates/symposion/schedule/schedule_detail.html +++ b/pinaxcon/templates/symposion/schedule/schedule_detail.html @@ -1,35 +1,29 @@ -{% extends "symposion/schedule/base.html" %} +{% extends "symposion/schedule/public_base.html" %} {% load i18n %} {% load pinax_boxes_tags %} {% load cache %} +{% load lca2017_tags %} {% load sitetree %} -{% block head_title %}Conference Schedule{% endblock %} +{% block head_title %}{{ schedule.section }} Schedule{% endblock %} +{% block header_title %}{{ schedule.section }} Schedule{% endblock%} +{% block header_paragraph %}{{ schedule.header_paragraph.text }}{% endblock%} +{% block header_inset_image %}{% illustration "devil.svg" %}{% endblock %} {% block body_class %}full{% endblock %} -{% block right %} -{% endblock %} - {% block content %} -
-
-
+
+ {% block breadcrumbs %}{% sitetree_breadcrumbs from "main" %}{% endblock %} +
-
-

{{ schedule.section }} Schedule

- {% block breadcrumbs %}{% sitetree_breadcrumbs from "main" %}{% endblock %} -
- {% box "schedule_top_"|add:schedule.section.name|slugify %} - - {% cache 600 "schedule-table" schedule.section %} - {% for timetable in days %} -

{{ timetable.day.date }}

- {% include "symposion/schedule/_grid.html" %} - {% endfor %} - {% endcache %} - - {% box "schedule_bottom" %} -
+ {% cache 600 "schedule-table" schedule.section %} + {% for timetable in days %} +

{{ timetable.day.date|date:"l" }}, {{ timetable.day.date }}

+
+ {% include "symposion/schedule/_grid.html" %} +
+ {% endfor %} + {% endcache %} {% endblock %} diff --git a/pinaxcon/templates/symposion/schedule/schedule_list.html b/pinaxcon/templates/symposion/schedule/schedule_list.html index 149f694e..60c7a1bb 100644 --- a/pinaxcon/templates/symposion/schedule/schedule_list.html +++ b/pinaxcon/templates/symposion/schedule/schedule_list.html @@ -1,56 +1,33 @@ -{% extends "site_base_wagtail.html" %} +{% extends "symposion/schedule/public_base.html" %} {% load i18n %} {% load cache %} +{% load lca2017_tags %} {% load sitetree %} {% block head_title %}Presentation Listing{% endblock %} -{% block extra_head %} - -{% endblock %} +{% block header_title %}{{ schedule.section.name }} List{% endblock %} +{% block header_paragraph %}{{ schedule.header_paragraph.text }}{% endblock%} +{% block header_inset_image %}{% illustration "lavender.svg" %}{% endblock %} {% block breadcrumbs %}{% sitetree_breadcrumbs from "main" %}{% endblock %} -{% block body %} -
-
-
- -

Accepted {{ schedule.section.name }}

- {% cache 600 "schedule-list" schedule.section.name %} - {% for presentation in presentations %} -
-
-

{{ presentation.title }}

-

{{ presentation.speakers|join:", " }}

- {{ presentation.description }} - {% if presentation.slot %} -

- {{ presentation.slot.day.date|date:"l" }} - {{ presentation.slot.start}}–{{ presentation.slot.end }} - in - {{ presentation.slot.rooms|join:", " }} -

- {% endif %} -
-
- {% endfor %} - {% endcache %} -
+{% block content %} + {% cache 600 "schedule-list" schedule.section.name %} + + {% endcache %} {% endblock %} diff --git a/pinaxcon/templates/symposion/speakers/speaker_profile.html b/pinaxcon/templates/symposion/speakers/speaker_profile.html index 794f710e..52d9a43d 100644 --- a/pinaxcon/templates/symposion/speakers/speaker_profile.html +++ b/pinaxcon/templates/symposion/speakers/speaker_profile.html @@ -1,41 +1,47 @@ -{% extends "site_base.html" %} +{% extends "symposion/schedule/public_base.html" %} {% load i18n %} +{% load lca2017_tags %} {% load thumbnail %} +{% if speaker.photo %} + {% block header_inset_image %}{% speaker_photo speaker 512 as speaker_photo %}{{ speaker_photo }}{% endblock %} +{% endif %} + +{% block header_title %}{{ speaker.name }}{% endblock %} + +{% block header_paragraph %} +{% endblock %} {% block head_title %}{{ speaker.name }}{% endblock %} -{% block body %} -
-
- {% if speaker.photo %} - {{ speaker.name }} - {% else %} -   - {% endif %} -
-
- {% if speaker.user == request.user or request.user.is_staff %} - Edit - {% endif %} -

{{ speaker.name }}

-
{{ speaker.biography|safe }}
+{% block content %} + {% if speaker.user == request.user or request.user.is_staff %} +

+ Edit +

+ {% endif %} -

Presentations

- {% for presentation in presentations %} -

{{ presentation.title }}

- {% if presentation.slot %} -

- {{ presentation.slot.day.date|date:"l" }} - {{ presentation.slot.start}}–{{ presentation.slot.end }} - in - {{ presentation.slot.rooms|join:", " }} -

- {% endif %} - {% empty %} -

No presentations. This page is only visible to staff until there is a presentation.

- {% endfor %} -

-
+

Biography

+ +
{{ speaker.biography_html|safe }}
+ +

Presentations

+ + {% endblock %} diff --git a/pinaxcon/templates/utility_page.html b/pinaxcon/templates/utility_page.html index 833b029a..d15f1d78 100644 --- a/pinaxcon/templates/utility_page.html +++ b/pinaxcon/templates/utility_page.html @@ -1,26 +1,19 @@ -{% extends "site_base_wagtail.html" %} +{% extends "lca2017/content_page.html" %} {% load staticfiles %} -{% block body %} -
-
-
-

{% block page_title %}{% endblock %}

-
-
-
-
+{% block header_background_image %}{% static 'lca2017/images/wineglass_bg_optimised.jpg' %}{% endblock %} +{% block header_title %}{% block page_title %}{% endblock %}{% endblock %} +{% block header_inset_image_base %}{% endblock %} +{% block content_base %} {% block utility_body_outer %}
- {% block utility_body %} - {% endblock %} + {% block content %} + {% block utility_body %} + {% endblock %} + {% endblock content %}
{% endblock %} {% endblock %} - -{% block extra_script %} - -{% endblock %} diff --git a/pinaxcon/templatetags/lca2017_tags.py b/pinaxcon/templatetags/lca2017_tags.py index 8861666d..a75265fb 100644 --- a/pinaxcon/templatetags/lca2017_tags.py +++ b/pinaxcon/templatetags/lca2017_tags.py @@ -1,19 +1,74 @@ +import cms_pages +import hashlib +import urllib + from django import template +from django.contrib.staticfiles.templatetags import staticfiles +from easy_thumbnails.files import get_thumbnailer + + register = template.Library() + @register.assignment_tag() def classname(ob): return ob.__class__.__name__ + @register.simple_tag(takes_context=True) def can_manage(context, proposal): return proposal_permission(context, "manage", proposal) + @register.simple_tag(takes_context=True) def can_review(context, proposal): return proposal_permission(context, "review", proposal) + def proposal_permission(context, permname, proposal): slug = proposal.kind.section.slug perm = "reviews.can_%s_%s" % (permname, slug) return context.request.user.has_perm(perm) + + +# {% load statictags %}{% static 'lca2017/images/svgs/illustrations/' %}{{ illustration }} + +@register.simple_tag(takes_context=False) +def illustration(name): + return staticfiles.static('lca2017/images/svgs/illustrations/') + name + + +@register.simple_tag(takes_context=True) +def speaker_photo(context, speaker, size): + ''' Provides the speaker profile, or else fall back to libravatar or gravatar. ''' + + if speaker.photo: + thumbnailer = get_thumbnailer(speaker.photo) + thumbnail_options = {'crop': True, 'size': (size, size)} + thumbnail = thumbnailer.get_thumbnail(thumbnail_options) + return thumbnail.url + else: + email = speaker.user.email.encode("utf-8") + md5sum = hashlib.md5(email.strip().lower()).hexdigest() + url = "https://secure.gravatar.com/avatar/%s?s=%d&d=%s" % (md5sum, size, "https://linux.conf.au/site_media/static/lca2017/images/speaker-fallback-devil.jpg") + + return url + + +@register.simple_tag() +def presentation_bg_number(presentation, count): + return sum(ord(i) for i in presentation.title) % count + + +@register.simple_tag() +def header_paragraph(name): + model = cms_pages.models.NamedHeaderParagraph + try: + return model.objects.get(name=name).text + except model.DoesNotExist: + return "" + + +@register.simple_tag() +def all_images(): + return cms_pages.models.CustomImage.objects.all().order_by("title") diff --git a/requirements.txt b/requirements.txt index 5b2ba282..37c6e8d9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,7 +8,7 @@ dj-static==0.0.6 dj-database-url==0.4.0 #pinax-pages==0.4.2 pinax-boxes==2.1.2 -wagtail==1.5.2 +wagtail==1.6.2 pylibmc==1.5.1 raven==5.27.0 diff --git a/static/src/lca2017/css/app.css b/static/src/lca2017/css/app.css index e31e7278..e6f5a987 100644 --- a/static/src/lca2017/css/app.css +++ b/static/src/lca2017/css/app.css @@ -117,14 +117,14 @@ } } -.panel--1-3, .l-speaker-page--portrait, .l-footer--text { +.panel--1-3, .l-speaker-page--portrait, .l-footer--logos { -ms-flex-order: 1; order: 1; width: 100%; } @media (min-width: 48em) { - .panel--1-3, .l-speaker-page--portrait, .l-footer--text { + .panel--1-3, .l-speaker-page--portrait, .l-footer--logos { -ms-flex-order: 0; order: 0; width: auto; @@ -133,14 +133,14 @@ } } -.panel--2-3, .l-speaker-page--content, .l-footer--logos { +.panel--2-3, .l-speaker-page--content, .l-footer--text { -ms-flex-order: 2; order: 2; width: 100%; } @media (min-width: 48em) { - .panel--2-3, .l-speaker-page--content, .l-footer--logos { + .panel--2-3, .l-speaker-page--content, .l-footer--text { -ms-flex-order: 0; order: 0; width: auto; @@ -1127,6 +1127,19 @@ table.alt tr:not(:last-of-type) { } } +.right-floating-image { + width: 30%; + float: right; + margin: 4rem; + margin-right: 0; +} + +.sponsor-logo { + width: 8em; + height: 4em; + margin: 0.5em; +} + .portrait { position: relative; overflow: hidden; diff --git a/static/src/lca2017/images/HPE.svg b/static/src/lca2017/images/HPE.svg new file mode 100644 index 00000000..76757f1d --- /dev/null +++ b/static/src/lca2017/images/HPE.svg @@ -0,0 +1,276 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/static/src/lca2017/images/IBM.svg b/static/src/lca2017/images/IBM.svg new file mode 100644 index 00000000..98105273 --- /dev/null +++ b/static/src/lca2017/images/IBM.svg @@ -0,0 +1,54 @@ + + + + + + image/svg+xml + + + + + + + + diff --git a/static/src/lca2017/images/hobart_bg_optimised.jpg b/static/src/lca2017/images/hobart_bg_optimised.jpg old mode 100755 new mode 100644 index 6b3035d3..68151c0a Binary files a/static/src/lca2017/images/hobart_bg_optimised.jpg and b/static/src/lca2017/images/hobart_bg_optimised.jpg differ diff --git a/static/src/lca2017/images/mt_anne_bg_optimised.jpg b/static/src/lca2017/images/mt_anne_bg_optimised.jpg new file mode 100644 index 00000000..e96bb3fa Binary files /dev/null and b/static/src/lca2017/images/mt_anne_bg_optimised.jpg differ diff --git a/static/src/lca2017/images/sleepy_bay_bg_optimised.jpg b/static/src/lca2017/images/sleepy_bay_bg_optimised.jpg new file mode 100644 index 00000000..6c1f3d4f Binary files /dev/null and b/static/src/lca2017/images/sleepy_bay_bg_optimised.jpg differ diff --git a/static/src/lca2017/images/snug_falls_bg_optimised.jpg b/static/src/lca2017/images/snug_falls_bg_optimised.jpg new file mode 100644 index 00000000..1f9b1471 Binary files /dev/null and b/static/src/lca2017/images/snug_falls_bg_optimised.jpg differ diff --git a/static/src/lca2017/images/speaker-fallback-devil.jpg b/static/src/lca2017/images/speaker-fallback-devil.jpg new file mode 100644 index 00000000..ddb53670 Binary files /dev/null and b/static/src/lca2017/images/speaker-fallback-devil.jpg differ diff --git a/static/src/lca2017/images/svgs/illustrations/cradle.svg b/static/src/lca2017/images/svgs/illustrations/cradle.svg old mode 100755 new mode 100644 index 8f582dd8..50915c4e --- a/static/src/lca2017/images/svgs/illustrations/cradle.svg +++ b/static/src/lca2017/images/svgs/illustrations/cradle.svg @@ -1 +1 @@ -cradle \ No newline at end of file + \ No newline at end of file diff --git a/static/src/lca2017/images/the_neck_bg_optimised.jpg b/static/src/lca2017/images/the_neck_bg_optimised.jpg new file mode 100644 index 00000000..ee4f0e66 Binary files /dev/null and b/static/src/lca2017/images/the_neck_bg_optimised.jpg differ