Skip to content

Commit

Permalink
merge develop (#383)
Browse files Browse the repository at this point in the history
  • Loading branch information
RachellCalhoun authored Apr 3, 2024
1 parent 740e224 commit dbb1195
Show file tree
Hide file tree
Showing 6 changed files with 535 additions and 33 deletions.
37 changes: 6 additions & 31 deletions home/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ class Meta:


class TextWithHeadingWithRightImageBlock(blocks.StructBlock):
heading = blocks.CharBlock(max_length=255, class_name="heading-blog")
heading = blocks.CharBlock(
max_length=255, class_name="heading-blog", required=False
)
text = blocks.TextBlock()
image = ImageChooserBlock()

Expand All @@ -94,7 +96,7 @@ class Meta:


class TextWithHeadingWithLeftImageBlock(blocks.StructBlock):
heading = blocks.CharBlock(max_length=255, class_name="blog")
heading = blocks.CharBlock(max_length=255, class_name="blog", required=False)
text = blocks.TextBlock()
image = ImageChooserBlock()

Expand All @@ -106,30 +108,6 @@ class Meta:
template = "blocks/text-with-heading-left-image.html"


class RightImageLeftTextBlock(blocks.StructBlock):
image = ImageChooserBlock()
text = blocks.TextBlock()

def __str__(self):
return self.text

class Meta:
label = "Text Block: Right Image"
template = "blocks/right-image-left-text.html"


class LeftImageRightTextBlock(blocks.StructBlock):
image = ImageChooserBlock()
text = blocks.TextBlock()

def __str__(self):
return self.text

class Meta:
label = "Text Block: Left Image"
template = "blocks/left-image-right-text.html"


class QuoteBlock(blocks.StructBlock):
text = blocks.CharBlock(max_length=255)
attribution = blocks.CharBlock(max_length=255)
Expand Down Expand Up @@ -184,10 +162,9 @@ class Meta:


class TextHeadingImageBlock(blocks.StructBlock):
heading = blocks.CharBlock(max_length=255)
text = blocks.TextBlock()
heading = blocks.CharBlock(max_length=255, required=False)
text = blocks.TextBlock(required=False)
image = ImageChooserBlock()
# TODO: Add left or right side

def __str__(self):
return self.heading
Expand Down Expand Up @@ -243,8 +220,6 @@ class BaseStreamBlock(blocks.StreamBlock):
text_with_heading_and_image = TextHeadingImageBlock()
text_with_heading_and_right_image = TextWithHeadingWithRightImageBlock()
text_with_heading_and_left_image = TextWithHeadingWithLeftImageBlock()
right_image_left_text = RightImageLeftTextBlock()
left_image_right_text = LeftImageRightTextBlock()
left_quote_right_image = QuoteLeftImageBlock(icon="openquote")
video_embed = VideoEmbed()
table = CustomTableBlock()
Expand Down
260 changes: 260 additions & 0 deletions home/migrations/0027_alter_generalpage_content_optional_fields.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,260 @@
# Generated by Django 4.1.13 on 2024-04-03 17:07
from __future__ import annotations

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

import home.blocks


class Migration(migrations.Migration):
dependencies = [
("home", "0026_session_application_survey_and_more"),
]

operations = [
migrations.AlterField(
model_name="generalpage",
name="content",
field=wagtail.fields.StreamField(
[
(
"heading",
wagtail.blocks.StructBlock(
[
(
"size",
wagtail.blocks.ChoiceBlock(
choices=[
("text-5xl", "h1"),
("text-4xl", "h2"),
("text-3xl", "h3"),
("text-2xl", "h4"),
("text-xl", "h5"),
("text-lg", "h6"),
],
icon="title",
),
),
(
"heading",
wagtail.blocks.CharBlock(
class_name="heading-blog", max_length=255
),
),
],
icon="h1",
label="Heading",
),
),
(
"rich_text",
wagtail.blocks.StructBlock(
[
(
"text",
wagtail.blocks.RichTextBlock(
features=[
"embed",
"bold",
"italic",
"link",
"superscript",
"subscript",
"strikethrough",
"code",
"hr",
],
icon="title",
label="Rich Text",
max_length=10000,
),
)
]
),
),
(
"list",
wagtail.blocks.StructBlock(
[
(
"size",
wagtail.blocks.ChoiceBlock(
choices=[
("circle", "unordered list"),
("decimal", "ordered list"),
("none", "unstyled"),
]
),
),
(
"text",
wagtail.blocks.RichTextBlock(
features=["ul"], icon="list-ol"
),
),
],
icon="list-ol",
label="List",
),
),
("paragraph", wagtail.blocks.TextBlock(max_length=10000)),
(
"html",
wagtail.blocks.RawHTMLBlock(icon="code", label="Raw HTML"),
),
("image", wagtail.images.blocks.ImageChooserBlock()),
(
"caption",
wagtail.blocks.StructBlock(
[("text", wagtail.blocks.TextBlock())]
),
),
(
"text_with_heading",
wagtail.blocks.StructBlock(
[
(
"heading",
wagtail.blocks.CharBlock(
class_name="heading-blog", max_length=255
),
),
("text", wagtail.blocks.TextBlock()),
]
),
),
(
"text_with_heading_and_image",
wagtail.blocks.StructBlock(
[
(
"heading",
wagtail.blocks.CharBlock(
max_length=255, required=False
),
),
("text", wagtail.blocks.TextBlock(required=False)),
("image", wagtail.images.blocks.ImageChooserBlock()),
]
),
),
(
"text_with_heading_and_right_image",
wagtail.blocks.StructBlock(
[
(
"heading",
wagtail.blocks.CharBlock(
class_name="heading-blog",
max_length=255,
required=False,
),
),
("text", wagtail.blocks.TextBlock()),
("image", wagtail.images.blocks.ImageChooserBlock()),
]
),
),
(
"text_with_heading_and_left_image",
wagtail.blocks.StructBlock(
[
(
"heading",
wagtail.blocks.CharBlock(
class_name="blog",
max_length=255,
required=False,
),
),
("text", wagtail.blocks.TextBlock()),
("image", wagtail.images.blocks.ImageChooserBlock()),
]
),
),
(
"left_quote_right_image",
wagtail.blocks.StructBlock(
[
("quote", wagtail.blocks.TextBlock()),
("byline", wagtail.blocks.CharBlock(max_length=255)),
("image", wagtail.images.blocks.ImageChooserBlock()),
],
icon="openquote",
),
),
(
"video_embed",
wagtail.blocks.StructBlock(
[
("heading", wagtail.blocks.CharBlock(max_length=255)),
("text", wagtail.blocks.TextBlock()),
]
),
),
("table", home.blocks.CustomTableBlock()),
(
"code_block",
wagtail.blocks.StructBlock(
[
(
"language",
wagtail.blocks.ChoiceBlock(
choices=[
("Python", "python"),
("Markup", "html"),
("CSS", "css"),
("Clojure", "clojure"),
("Bash", "shell"),
("Django", "django"),
("Jinja2", "jinja2"),
("Docker", "dockerfile"),
("Git", "git"),
("GraphQL", "graphql"),
("Handlebars", "handlebars"),
(".ignore", "gitignore"),
("JSON", "json"),
("JSON5", "json5"),
("Markdown", "md"),
("Markdown", "md"),
("React JSX", "jsx"),
("React TSX", "tsx"),
("SASS", "sass"),
("SCSS", "scss"),
("TypeScript", "ts"),
("vim", "vim"),
]
),
),
(
"caption",
wagtail.blocks.CharBlock(
blank=True, max_length=255
),
),
(
"page",
wagtail.blocks.CharBlock(
blank=True, max_length=255
),
),
(
"code",
wagtail.blocks.TextBlock(
blank=True, max_length=1000
),
),
]
),
),
],
blank=True,
null=True,
use_json_field=True,
verbose_name="StreamField Body",
),
),
]
Loading

0 comments on commit dbb1195

Please sign in to comment.