Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Style mailchimp newsletter form #493

Merged
merged 7 commits into from
Jul 4, 2023
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
179 changes: 179 additions & 0 deletions tbx/blog/migrations/0027_add_mailchimp_block.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
# Generated by Django 3.2.18 on 2023-06-28 10:39

from django.db import migrations
import tbx.core.blocks
import wagtail.blocks
import wagtail.embeds.blocks
import wagtail.fields
import wagtail.images.blocks
import wagtailmarkdown.blocks
import wagtailmedia.blocks


class Migration(migrations.Migration):

dependencies = [
("blog", "0026_add_video_block"),
]

operations = [
migrations.AlterField(
model_name="blogpage",
name="body",
field=wagtail.fields.StreamField(
[
(
"h2",
wagtail.blocks.CharBlock(
form_classname="title",
icon="title",
template="patterns/molecules/streamfield/blocks/heading2_block.html",
),
),
(
"h3",
wagtail.blocks.CharBlock(
form_classname="title",
icon="title",
template="patterns/molecules/streamfield/blocks/heading3_block.html",
),
),
(
"h4",
wagtail.blocks.CharBlock(
form_classname="title",
icon="title",
template="patterns/molecules/streamfield/blocks/heading4_block.html",
),
),
(
"intro",
wagtail.blocks.RichTextBlock(
icon="pilcrow",
template="patterns/molecules/streamfield/blocks/intro_block.html",
),
),
(
"paragraph",
wagtail.blocks.RichTextBlock(
icon="pilcrow",
template="patterns/molecules/streamfield/blocks/paragraph_block.html",
),
),
(
"aligned_image",
wagtail.blocks.StructBlock(
[
("image", wagtail.images.blocks.ImageChooserBlock()),
("alignment", tbx.core.blocks.ImageFormatChoiceBlock()),
("caption", wagtail.blocks.CharBlock()),
(
"attribution",
wagtail.blocks.CharBlock(required=False),
),
],
label="Aligned image",
template="patterns/molecules/streamfield/blocks/aligned_image_block.html",
),
),
(
"wide_image",
wagtail.blocks.StructBlock(
[("image", wagtail.images.blocks.ImageChooserBlock())],
label="Wide image",
template="patterns/molecules/streamfield/blocks/wide_image_block.html",
),
),
(
"bustout",
wagtail.blocks.StructBlock(
[
("image", wagtail.images.blocks.ImageChooserBlock()),
("text", wagtail.blocks.RichTextBlock()),
],
template="patterns/molecules/streamfield/blocks/bustout_block.html",
),
),
(
"pullquote",
wagtail.blocks.StructBlock(
[
(
"quote",
wagtail.blocks.CharBlock(
form_classname="quote title"
),
),
("attribution", wagtail.blocks.CharBlock()),
],
template="patterns/molecules/streamfield/blocks/pullquote_block.html",
),
),
(
"raw_html",
wagtail.blocks.RawHTMLBlock(
icon="code",
label="Raw HTML",
template="patterns/molecules/streamfield/blocks/raw_html_block.html",
),
),
(
"mailchimp_form",
wagtail.blocks.RawHTMLBlock(
icon="code",
label="Mailchimp embedded form",
template="patterns/molecules/streamfield/blocks/mailchimp_form_block.html",
),
),
(
"markdown",
wagtailmarkdown.blocks.MarkdownBlock(
icon="code",
template="patterns/molecules/streamfield/blocks/markdown_block.html",
),
),
(
"embed",
wagtail.embeds.blocks.EmbedBlock(
group="Media",
icon="code",
template="patterns/molecules/streamfield/blocks/embed_block.html",
),
),
(
"video_block",
wagtail.blocks.StructBlock(
[
("video", wagtailmedia.blocks.VideoChooserBlock()),
(
"autoplay",
wagtail.blocks.BooleanBlock(
default=False,
help_text="Automatically start and loop the video. Please use sparingly.",
required=False,
),
),
(
"use_original_width",
wagtail.blocks.BooleanBlock(
default=False,
help_text="Use the original width of the video instead of the default content width. Note that videos wider than the content width will be limited to the content width.",
required=False,
),
),
],
group="Media",
),
),
(
"story_embed",
tbx.core.blocks.ExternalStoryEmbedBlock(
icon="code",
template="patterns/molecules/streamfield/blocks/external_story_block.html",
),
),
],
use_json_field=True,
),
),
]
5 changes: 5 additions & 0 deletions tbx/core/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,11 @@ class StoryBlock(StreamBlock):
icon="code",
template="patterns/molecules/streamfield/blocks/raw_html_block.html",
)
mailchimp_form = RawHTMLBlock(
label="Mailchimp embedded form",
icon="code",
template="patterns/molecules/streamfield/blocks/mailchimp_form_block.html",
)
markdown = MarkdownBlock(
icon="code",
template="patterns/molecules/streamfield/blocks/markdown_block.html",
Expand Down
179 changes: 179 additions & 0 deletions tbx/core/migrations/0150_add_mailchimp_block.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
# Generated by Django 3.2.18 on 2023-06-28 10:39

from django.db import migrations
import tbx.core.blocks
import wagtail.blocks
import wagtail.embeds.blocks
import wagtail.fields
import wagtail.images.blocks
import wagtailmarkdown.blocks
import wagtailmedia.blocks


class Migration(migrations.Migration):

dependencies = [
("torchbox", "0149_add_video_block"),
]

operations = [
migrations.AlterField(
model_name="standardpage",
name="body",
field=wagtail.fields.StreamField(
[
(
"h2",
wagtail.blocks.CharBlock(
form_classname="title",
icon="title",
template="patterns/molecules/streamfield/blocks/heading2_block.html",
),
),
(
"h3",
wagtail.blocks.CharBlock(
form_classname="title",
icon="title",
template="patterns/molecules/streamfield/blocks/heading3_block.html",
),
),
(
"h4",
wagtail.blocks.CharBlock(
form_classname="title",
icon="title",
template="patterns/molecules/streamfield/blocks/heading4_block.html",
),
),
(
"intro",
wagtail.blocks.RichTextBlock(
icon="pilcrow",
template="patterns/molecules/streamfield/blocks/intro_block.html",
),
),
(
"paragraph",
wagtail.blocks.RichTextBlock(
icon="pilcrow",
template="patterns/molecules/streamfield/blocks/paragraph_block.html",
),
),
(
"aligned_image",
wagtail.blocks.StructBlock(
[
("image", wagtail.images.blocks.ImageChooserBlock()),
("alignment", tbx.core.blocks.ImageFormatChoiceBlock()),
("caption", wagtail.blocks.CharBlock()),
(
"attribution",
wagtail.blocks.CharBlock(required=False),
),
],
label="Aligned image",
template="patterns/molecules/streamfield/blocks/aligned_image_block.html",
),
),
(
"wide_image",
wagtail.blocks.StructBlock(
[("image", wagtail.images.blocks.ImageChooserBlock())],
label="Wide image",
template="patterns/molecules/streamfield/blocks/wide_image_block.html",
),
),
(
"bustout",
wagtail.blocks.StructBlock(
[
("image", wagtail.images.blocks.ImageChooserBlock()),
("text", wagtail.blocks.RichTextBlock()),
],
template="patterns/molecules/streamfield/blocks/bustout_block.html",
),
),
(
"pullquote",
wagtail.blocks.StructBlock(
[
(
"quote",
wagtail.blocks.CharBlock(
form_classname="quote title"
),
),
("attribution", wagtail.blocks.CharBlock()),
],
template="patterns/molecules/streamfield/blocks/pullquote_block.html",
),
),
(
"raw_html",
wagtail.blocks.RawHTMLBlock(
icon="code",
label="Raw HTML",
template="patterns/molecules/streamfield/blocks/raw_html_block.html",
),
),
(
"mailchimp_form",
wagtail.blocks.RawHTMLBlock(
icon="code",
label="Mailchimp embedded form",
template="patterns/molecules/streamfield/blocks/mailchimp_form_block.html",
),
),
(
"markdown",
wagtailmarkdown.blocks.MarkdownBlock(
icon="code",
template="patterns/molecules/streamfield/blocks/markdown_block.html",
),
),
(
"embed",
wagtail.embeds.blocks.EmbedBlock(
group="Media",
icon="code",
template="patterns/molecules/streamfield/blocks/embed_block.html",
),
),
(
"video_block",
wagtail.blocks.StructBlock(
[
("video", wagtailmedia.blocks.VideoChooserBlock()),
(
"autoplay",
wagtail.blocks.BooleanBlock(
default=False,
help_text="Automatically start and loop the video. Please use sparingly.",
required=False,
),
),
(
"use_original_width",
wagtail.blocks.BooleanBlock(
default=False,
help_text="Use the original width of the video instead of the default content width. Note that videos wider than the content width will be limited to the content width.",
required=False,
),
),
],
group="Media",
),
),
(
"story_embed",
tbx.core.blocks.ExternalStoryEmbedBlock(
icon="code",
template="patterns/molecules/streamfield/blocks/external_story_block.html",
),
),
],
use_json_field=True,
),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div class="mailchimp-form-block">
{{ value }}
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
context:
value: '<div id="mc_embed_signup"><form><label for="test">mailchimp form gets embedded here</label> <input type="text" id="test"></form></div>'
Loading