wagtail after templates (#19)

* Adds inset_illustration as a drop-down of svg data rather than as an uploady thing.

* Adds external link types to the homepage models

* Migrations
This commit is contained in:
Christopher Neugebauer 2016-06-26 11:49:14 +10:00 committed by Scott Bragg
parent 2d7a71a4ef
commit ca329c1c90
2 changed files with 73 additions and 1 deletions

View file

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-06-25 03:37
from __future__ import unicode_literals
from django.db import migrations
import wagtail.wagtailcore.blocks
import wagtail.wagtailcore.fields
import wagtail.wagtailimages.blocks
class Migration(migrations.Migration):
dependencies = [
('cms_pages', '0002_auto_20160621_0936'),
]
operations = [
migrations.AlterField(
model_name='homepage',
name='body',
field=wagtail.wagtailcore.fields.StreamField([('basic_content', wagtail.wagtailcore.blocks.StructBlock([('type', wagtail.wagtailcore.blocks.ChoiceBlock(choices=[(1, 'Left-aligned image, blue-filtered image BG'), (2, 'Right-aligned image, white background')])), ('heading', wagtail.wagtailcore.blocks.CharBlock(required=True)), ('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')])), ('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)), ('body', wagtail.wagtailcore.blocks.RichTextBlock(required=True)), ('link', wagtail.wagtailcore.blocks.StructBlock([('page', wagtail.wagtailcore.blocks.PageChooserBlock()), ('title', wagtail.wagtailcore.blocks.CharBlock(required=True))])), ('external_links', wagtail.wagtailcore.blocks.ListBlock(wagtail.wagtailcore.blocks.StructBlock([('alt', wagtail.wagtailcore.blocks.CharBlock(required=True)), ('icon', wagtail.wagtailcore.blocks.ChoiceBlock(choices=[('twitter.svg', 'Twitter'), ('facebook.svg', 'Facebook'), ('linkedin.svg', 'LinkedIn'), ('generic.svg', 'Generic URL')])), ('url', wagtail.wagtailcore.blocks.URLBlock(required=True))])))]))]),
),
]

View file

@ -27,6 +27,42 @@ class HomePage(Page):
(BASIC_CONTENT_WHITE_RIGHT, "Right-aligned image, white background"),
)
ILLUSTRATION_ANTARCTICA = "antarctica.svg"
ILLUSTRATION_BRIDGE = "bridge.svg"
ILLUSTRATION_CASINO = "casino.svg"
ILLUSTRATION_CRADLE = "cradle.svg"
ILLUSTRATION_DEVIL = "devil.svg"
ILLUSTRATION_FALLS = "falls.svg"
ILLUSTRATION_HOBART = "hobart.svg"
ILLUSTRATION_LAVENDER = "lavender.svg"
ILLUSTRATION_TUZ = "tuz.svg"
ILLUSTRATION_WINEGLASS = "wineglass.svg"
ILLUSTRATION_TYPES = (
(ILLUSTRATION_ANTARCTICA, "Antarctica"),
(ILLUSTRATION_BRIDGE, "Bridge"),
(ILLUSTRATION_CASINO, "Casino"),
(ILLUSTRATION_CRADLE, "Cradle Mountain"),
(ILLUSTRATION_DEVIL, "Tasmanian Devil"),
(ILLUSTRATION_FALLS, "Waterfall"),
(ILLUSTRATION_HOBART, "Hobart"),
(ILLUSTRATION_LAVENDER, "Lavender"),
(ILLUSTRATION_TUZ, "Tuz"),
(ILLUSTRATION_WINEGLASS, "Wineglass"),
)
EXTERNAL_LINK_TWITTER = "twitter.svg"
EXTERNAL_LINK_FACEBOOK = "facebook.svg"
EXTERNAL_LINK_LINKEDIN = "linkedin.svg"
EXTERNAL_LINK_GENERIC = "generic.svg"
EXTERNAL_LINK_TYPES = (
(EXTERNAL_LINK_TWITTER, "Twitter"),
(EXTERNAL_LINK_FACEBOOK, "Facebook"),
(EXTERNAL_LINK_LINKEDIN, "LinkedIn"),
(EXTERNAL_LINK_GENERIC, "Generic URL"),
)
body = StreamField([
("basic_content", blocks.StructBlock([
("type", blocks.ChoiceBlock(
@ -34,7 +70,10 @@ class HomePage(Page):
required=True,
)),
("heading", blocks.CharBlock(required=True)),
("inset_image", imageblocks.ImageChooserBlock()),
("inset_illustration", blocks.ChoiceBlock(
choices=ILLUSTRATION_TYPES,
required=True,
)),
("background_image", imageblocks.ImageChooserBlock(
required=False,
help_text="This is used as the background image of a "
@ -45,6 +84,16 @@ class HomePage(Page):
("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)
)])
)),
])),
# TODO: keynotes
# TODO: other bits