Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename ReportingExamplePage to Example Page, add features #3303

Merged
merged 6 commits into from
Nov 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions fec/home/migrations/0106_auto_20191101_1759.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.23 on 2019-11-01 21:59
from __future__ import unicode_literals

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


class Migration(migrations.Migration):

dependencies = [
('home', '0105_auto_20191003_0006'),
]

operations = [
migrations.RenameModel(
old_name='ReportingExamplePage',
new_name='ExamplePage',
),
migrations.AlterField(
model_name='examplepage',
name='body',
field=wagtail.core.fields.StreamField([('paragraph', wagtail.core.blocks.RichTextBlock()), ('example_image', wagtail.core.blocks.StructBlock([('title', wagtail.core.blocks.CharBlock(required=False)), ('caption', wagtail.core.blocks.RichTextBlock(required=True)), ('image', wagtail.images.blocks.ImageChooserBlock(required=True))])), ('reporting_example_cards', wagtail.core.blocks.StructBlock([('card_width', wagtail.core.blocks.ChoiceBlock(choices=[(2, '1/2'), (3, '1/3')], help_text='Control the width of the cards')), ('cards', wagtail.core.blocks.ListBlock(wagtail.core.blocks.PageChooserBlock(), icon='doc-empty'))])), ('internal_button', wagtail.core.blocks.StructBlock([('internal_page', wagtail.core.blocks.PageChooserBlock()), ('text', wagtail.core.blocks.CharBlock())])), ('external_button', wagtail.core.blocks.StructBlock([('url', wagtail.core.blocks.URLBlock()), ('text', wagtail.core.blocks.CharBlock())])), ('image', wagtail.images.blocks.ImageChooserBlock()), ('html', wagtail.core.blocks.RawHTMLBlock())], null=True),
),
migrations.AlterField(
model_name='examplepage',
name='pre_title',
field=models.CharField(blank=True, choices=[('how', 'How to report'), ('scenario', 'Example scenario'), ('example', 'Example')], max_length=255, null=True),
),
]
12 changes: 9 additions & 3 deletions fec/home/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1136,21 +1136,27 @@ def social_image_identifier(self):
return 'meeting-page'


class ReportingExamplePage(Page):
class ExamplePage(Page):
"""Page template for "how to report" and "example scenario" pages
Always within the Help section"""
featured_image = models.ForeignKey('wagtailimages.Image', blank=True, null=True,
on_delete=models.SET_NULL, related_name='+')

pre_title = models.CharField(blank=True, null=True, max_length=255, choices=[
('how', 'How to report'),
('scenario', 'Example scenario')
('scenario', 'Example scenario'),
('example','Example')
])

body = StreamField([
('paragraph', blocks.RichTextBlock()),
('example_image', ExampleImage()),
('reporting_example_cards', ReportingExampleCards())
('reporting_example_cards', ReportingExampleCards()),
('reporting_example_cards', ReportingExampleCards()),
('internal_button', InternalButtonBlock()),
('external_button', ExternalButtonBlock()),
('image', ImageChooserBlock()),
('html', blocks.RawHTMLBlock()),
], null=True)

related_media_title = models.CharField(blank=True, null=True, max_length=255)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
<span class="label heading__pre-title">How to report</span>
{% elif self.pre_title == 'scenario' %}
<span class="label heading__pre-title">Example scenario</span>
{% elif self.pre_title == 'example' %}
<span class="label heading__pre-title">Example</span>
{% endif %}
<h1>{{ self.title }}</h1>
</div>
Expand Down
2 changes: 1 addition & 1 deletion tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def _detect_space(repo, branch=None, yes=False):
('stage', lambda _, branch: branch.startswith('release')),
('dev', lambda _, branch: branch == 'develop'),
# Uncomment below and adjust branch name to deploy desired feature branch to the feature space
('feature', lambda _, branch: branch == 'feature/the-branch-name'),
#('feature', lambda _, branch: branch == 'feature/the-branch-name'),
)


Expand Down