Skip to content

Commit

Permalink
Merge branch 'master' into gh-1586
Browse files Browse the repository at this point in the history
  • Loading branch information
alanmoo committed Jun 20, 2018
2 parents b96dcb7 + 5193aee commit 731d408
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 0 deletions.
19 changes: 19 additions & 0 deletions network-api/networkapi/wagtailpages/customblocks.py
Expand Up @@ -113,6 +113,25 @@ class ImageTextBlock(blocks.StructBlock):
class Meta:
icon = 'doc-full'
template = 'wagtailpages/blocks/image_text_block.html'
group = 'Deprecated'


class ImageTextBlock2(ImageBlock):
text = blocks.RichTextBlock(
features=['link', 'h2', 'h3', 'h4', 'h5', 'h6']
)
url = blocks.CharBlock(
required=False,
help_text='Optional URL that this image should link out to.',
)
small = blocks.BooleanBlock(
required=False,
help_text='Use smaller, fixed image size (eg: icon)',
)

class Meta:
icon = 'doc-full'
template = 'wagtailpages/blocks/image_text_block2.html'


class FigureBlock(blocks.StructBlock):
Expand Down
@@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.12 on 2018-06-19 17:46
from __future__ import unicode_literals

from django.db import migrations
import wagtail.core.blocks
import wagtail.core.fields
import wagtail.images.blocks


class Migration(migrations.Migration):

dependencies = [
('wagtailpages', '0029_auto_20180618_2116'),
]

operations = [
migrations.AlterField(
model_name='modularpage',
name='body',
field=wagtail.core.fields.StreamField((('heading', wagtail.core.blocks.CharBlock()), ('paragraph', wagtail.core.blocks.RichTextBlock(features=['bold', 'italic', 'h2', 'h3', 'h4', 'h5', 'ol', 'ul', 'link', 'hr'])), ('image', wagtail.core.blocks.StructBlock((('image', wagtail.images.blocks.ImageChooserBlock()), ('altText', wagtail.core.blocks.CharBlock(help_text='Image description (for screen readers).', required=True)), ('caption', wagtail.core.blocks.CharBlock(required=False)), ('captionURL', wagtail.core.blocks.CharBlock(help_text='Optional URL that this caption should link out to.', required=False))))), ('image_text', wagtail.core.blocks.StructBlock((('text', wagtail.core.blocks.RichTextBlock(features=['bold', 'italic', 'link'])), ('image', wagtail.core.blocks.StructBlock((('image', wagtail.images.blocks.ImageChooserBlock()), ('altText', wagtail.core.blocks.CharBlock(help_text='Image description (for screen readers).', required=True))))), ('ordering', wagtail.core.blocks.ChoiceBlock(choices=[('left', 'Image on the left'), ('right', 'Image on the right')]))))), ('image_text2', wagtail.core.blocks.StructBlock((('image', wagtail.images.blocks.ImageChooserBlock()), ('altText', wagtail.core.blocks.CharBlock(help_text='Image description (for screen readers).', required=True)), ('text', wagtail.core.blocks.RichTextBlock(features=['link', 'h2', 'h3', 'h4', 'h5', 'h6'])), ('url', wagtail.core.blocks.CharBlock(help_text='Optional URL that this image should link out to.', required=False)), ('small', wagtail.core.blocks.BooleanBlock(help_text='Use smaller, fixed image size (eg: icon)', required=False))))), ('figure', wagtail.core.blocks.StructBlock((('figure', wagtail.core.blocks.StructBlock((('image', wagtail.images.blocks.ImageChooserBlock()), ('altText', wagtail.core.blocks.CharBlock(help_text='Image description (for screen readers).', required=True)), ('alignment', wagtail.core.blocks.ChoiceBlock(choices=[('', 'Do not apply any explicit alignment classes.'), ('left-align', 'Left-align this image with the page content.'), ('right-align', 'Right-align this image with the page content.'), ('center', 'Center this image with the page content.'), ('full-width', 'Make this image full-width.')], required=False))))), ('caption', wagtail.core.blocks.CharBlock(help_text='Please remember to properly attribute any images we use.', required=False)), ('url', wagtail.core.blocks.CharBlock(help_text='Optional URL that this figure should link out to.', required=False))))), ('figuregrid', wagtail.core.blocks.StructBlock((('grid_items', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock((('figure', wagtail.core.blocks.StructBlock((('image', wagtail.images.blocks.ImageChooserBlock()), ('altText', wagtail.core.blocks.CharBlock(help_text='Image description (for screen readers).', required=True)), ('alignment', wagtail.core.blocks.ChoiceBlock(choices=[('', 'Do not apply any explicit alignment classes.'), ('left-align', 'Left-align this image with the page content.'), ('right-align', 'Right-align this image with the page content.'), ('center', 'Center this image with the page content.'), ('full-width', 'Make this image full-width.')], required=False))))), ('caption', wagtail.core.blocks.CharBlock(help_text='Please remember to properly attribute any images we use.', required=False)), ('url', wagtail.core.blocks.CharBlock(help_text='Optional URL that this figure should link out to.', required=False)))))),))), ('figuregrid2', wagtail.core.blocks.StructBlock((('grid_items', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock((('image', wagtail.images.blocks.ImageChooserBlock()), ('caption', wagtail.core.blocks.CharBlock(help_text='Please remember to properly attribute any images we use.', required=False)), ('url', wagtail.core.blocks.CharBlock(help_text='Optional URL that this figure should link out to.', required=False)))))),))), ('video', wagtail.core.blocks.StructBlock((('url', wagtail.core.blocks.CharBlock(help_text='Please make sure this is a proper embed URL, or your video will not show up on the page.')), ('caption', wagtail.core.blocks.CharBlock(required=False)), ('captionURL', wagtail.core.blocks.CharBlock(help_text='Optional URL for caption to link to.', required=False))))), ('iframe', wagtail.core.blocks.StructBlock((('url', wagtail.core.blocks.CharBlock(help_text='Please note that only URLs from white-listed domains will work.')), ('caption', wagtail.core.blocks.CharBlock(required=False)), ('captionURL', wagtail.core.blocks.CharBlock(help_text='Optional URL that this caption should link out to.', required=False))))), ('linkbutton', wagtail.core.blocks.StructBlock((('label', wagtail.core.blocks.CharBlock()), ('URL', wagtail.core.blocks.CharBlock()), ('styling', wagtail.core.blocks.ChoiceBlock(choices=[('btn-primary', 'Primary button'), ('btn-secondary', 'Secondary button'), ('btn-success', 'Success button'), ('btn-info', 'Info button'), ('btn-warning', 'Warning button'), ('btn-danger', 'Danger button'), ('btn-ghost', 'Ghost button')])), ('outline', wagtail.core.blocks.BooleanBlock(default=False, required=False))))), ('spacer', wagtail.core.blocks.StructBlock((('size', wagtail.core.blocks.ChoiceBlock(choices=[('1', 'quarter spacing'), ('2', 'half spacing'), ('3', 'single spacing'), ('4', 'one and a half spacing'), ('5', 'triple spacing')])),))), ('quote', wagtail.core.blocks.StructBlock((('quotes', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock((('quote', wagtail.core.blocks.CharBlock()), ('attribution', wagtail.core.blocks.CharBlock()))))),))), ('pulse_listing', wagtail.core.blocks.StructBlock((('search_terms', wagtail.core.blocks.CharBlock(help_text='Fill in any number of pulse entry search terms (separated by spaces).')), ('max_number_of_results', wagtail.core.blocks.IntegerBlock(default=0, help_text='The maximum number of results to fetch (use 0 for default maximum of 48)', min_value=0, required=False)), ('newest_first', wagtail.core.blocks.BooleanBlock(default=True, help_text='Check this box to list entries "newest first".', required=False)), ('only_featured_entries', wagtail.core.blocks.BooleanBlock(default=False, help_text='Check this box to only get results from the featured entry list.', required=False))))))),
),
migrations.AlterField(
model_name='primarypage',
name='body',
field=wagtail.core.fields.StreamField((('heading', wagtail.core.blocks.CharBlock()), ('paragraph', wagtail.core.blocks.RichTextBlock(features=['bold', 'italic', 'h2', 'h3', 'h4', 'h5', 'ol', 'ul', 'link', 'hr'])), ('image', wagtail.core.blocks.StructBlock((('image', wagtail.images.blocks.ImageChooserBlock()), ('altText', wagtail.core.blocks.CharBlock(help_text='Image description (for screen readers).', required=True)), ('caption', wagtail.core.blocks.CharBlock(required=False)), ('captionURL', wagtail.core.blocks.CharBlock(help_text='Optional URL that this caption should link out to.', required=False))))), ('image_text', wagtail.core.blocks.StructBlock((('text', wagtail.core.blocks.RichTextBlock(features=['bold', 'italic', 'link'])), ('image', wagtail.core.blocks.StructBlock((('image', wagtail.images.blocks.ImageChooserBlock()), ('altText', wagtail.core.blocks.CharBlock(help_text='Image description (for screen readers).', required=True))))), ('ordering', wagtail.core.blocks.ChoiceBlock(choices=[('left', 'Image on the left'), ('right', 'Image on the right')]))))), ('image_text2', wagtail.core.blocks.StructBlock((('image', wagtail.images.blocks.ImageChooserBlock()), ('altText', wagtail.core.blocks.CharBlock(help_text='Image description (for screen readers).', required=True)), ('text', wagtail.core.blocks.RichTextBlock(features=['link', 'h2', 'h3', 'h4', 'h5', 'h6'])), ('url', wagtail.core.blocks.CharBlock(help_text='Optional URL that this image should link out to.', required=False)), ('small', wagtail.core.blocks.BooleanBlock(help_text='Use smaller, fixed image size (eg: icon)', required=False))))), ('figure', wagtail.core.blocks.StructBlock((('figure', wagtail.core.blocks.StructBlock((('image', wagtail.images.blocks.ImageChooserBlock()), ('altText', wagtail.core.blocks.CharBlock(help_text='Image description (for screen readers).', required=True)), ('alignment', wagtail.core.blocks.ChoiceBlock(choices=[('', 'Do not apply any explicit alignment classes.'), ('left-align', 'Left-align this image with the page content.'), ('right-align', 'Right-align this image with the page content.'), ('center', 'Center this image with the page content.'), ('full-width', 'Make this image full-width.')], required=False))))), ('caption', wagtail.core.blocks.CharBlock(help_text='Please remember to properly attribute any images we use.', required=False)), ('url', wagtail.core.blocks.CharBlock(help_text='Optional URL that this figure should link out to.', required=False))))), ('figuregrid', wagtail.core.blocks.StructBlock((('grid_items', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock((('figure', wagtail.core.blocks.StructBlock((('image', wagtail.images.blocks.ImageChooserBlock()), ('altText', wagtail.core.blocks.CharBlock(help_text='Image description (for screen readers).', required=True)), ('alignment', wagtail.core.blocks.ChoiceBlock(choices=[('', 'Do not apply any explicit alignment classes.'), ('left-align', 'Left-align this image with the page content.'), ('right-align', 'Right-align this image with the page content.'), ('center', 'Center this image with the page content.'), ('full-width', 'Make this image full-width.')], required=False))))), ('caption', wagtail.core.blocks.CharBlock(help_text='Please remember to properly attribute any images we use.', required=False)), ('url', wagtail.core.blocks.CharBlock(help_text='Optional URL that this figure should link out to.', required=False)))))),))), ('figuregrid2', wagtail.core.blocks.StructBlock((('grid_items', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock((('image', wagtail.images.blocks.ImageChooserBlock()), ('caption', wagtail.core.blocks.CharBlock(help_text='Please remember to properly attribute any images we use.', required=False)), ('url', wagtail.core.blocks.CharBlock(help_text='Optional URL that this figure should link out to.', required=False)))))),))), ('video', wagtail.core.blocks.StructBlock((('url', wagtail.core.blocks.CharBlock(help_text='Please make sure this is a proper embed URL, or your video will not show up on the page.')), ('caption', wagtail.core.blocks.CharBlock(required=False)), ('captionURL', wagtail.core.blocks.CharBlock(help_text='Optional URL for caption to link to.', required=False))))), ('iframe', wagtail.core.blocks.StructBlock((('url', wagtail.core.blocks.CharBlock(help_text='Please note that only URLs from white-listed domains will work.')), ('caption', wagtail.core.blocks.CharBlock(required=False)), ('captionURL', wagtail.core.blocks.CharBlock(help_text='Optional URL that this caption should link out to.', required=False))))), ('linkbutton', wagtail.core.blocks.StructBlock((('label', wagtail.core.blocks.CharBlock()), ('URL', wagtail.core.blocks.CharBlock()), ('styling', wagtail.core.blocks.ChoiceBlock(choices=[('btn-primary', 'Primary button'), ('btn-secondary', 'Secondary button'), ('btn-success', 'Success button'), ('btn-info', 'Info button'), ('btn-warning', 'Warning button'), ('btn-danger', 'Danger button'), ('btn-ghost', 'Ghost button')])), ('outline', wagtail.core.blocks.BooleanBlock(default=False, required=False))))), ('spacer', wagtail.core.blocks.StructBlock((('size', wagtail.core.blocks.ChoiceBlock(choices=[('1', 'quarter spacing'), ('2', 'half spacing'), ('3', 'single spacing'), ('4', 'one and a half spacing'), ('5', 'triple spacing')])),))), ('quote', wagtail.core.blocks.StructBlock((('quotes', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock((('quote', wagtail.core.blocks.CharBlock()), ('attribution', wagtail.core.blocks.CharBlock()))))),))), ('pulse_listing', wagtail.core.blocks.StructBlock((('search_terms', wagtail.core.blocks.CharBlock(help_text='Fill in any number of pulse entry search terms (separated by spaces).')), ('max_number_of_results', wagtail.core.blocks.IntegerBlock(default=0, help_text='The maximum number of results to fetch (use 0 for default maximum of 48)', min_value=0, required=False)), ('newest_first', wagtail.core.blocks.BooleanBlock(default=True, help_text='Check this box to list entries "newest first".', required=False)), ('only_featured_entries', wagtail.core.blocks.BooleanBlock(default=False, help_text='Check this box to only get results from the featured entry list.', required=False))))))),
),
]
1 change: 1 addition & 0 deletions network-api/networkapi/wagtailpages/models.py
Expand Up @@ -34,6 +34,7 @@
)),
('image', customblocks.AnnotatedImageBlock()),
('image_text', customblocks.ImageTextBlock()),
('image_text2', customblocks.ImageTextBlock2()),
('figure', customblocks.FigureBlock()),
('figuregrid', customblocks.FigureGridBlock()),
('figuregrid2', customblocks.FigureGridBlock2()),
Expand Down
@@ -0,0 +1,25 @@
{% load wagtailcore_tags wagtailimages_tags %}

<div class="row my-default">
{% if value.small %}
<div class="col-12 d-flex flex-nowrap">
<div class="mr-3" style="width:50px; flex-shrink:0;">
{% if value.url %}<a href="{{ value.url }}">{% endif %}
{% image value.image fill-100x100-c100 format-jpeg class="w-100" %}
{% if value.url %}</a>{% endif %}
</div>
<div>
{{ value.text|richtext }}
</div>
</div>
{% else %}
<div class="col-12 col-md-3 mb-3 mb-md-0">
{% if value.url %}<a href="{{ value.url }}">{% endif %}
{% image value.image fill-760x760-c100 format-jpeg class="w-100" %}
{% if value.url %}</a>{% endif %}
</div>
<div class="col-12 col-md-9">
{{ value.text|richtext }}
</div>
{% endif %}
</div>

0 comments on commit 731d408

Please sign in to comment.