Skip to content

Commit

Permalink
remove some validations on page block
Browse files Browse the repository at this point in the history
  • Loading branch information
mwvolo committed Jul 1, 2024
1 parent e433ee7 commit 9961156
Show file tree
Hide file tree
Showing 3 changed files with 597 additions and 10 deletions.
14 changes: 6 additions & 8 deletions pages/custom_blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ class Meta:
max_num = 1

class CTAButtonBlock(blocks.StructBlock):
text = blocks.CharBlock(required=True)
link = LinkBlock(required=True)
link_aria_label = blocks.CharBlock(required=True)
text = blocks.CharBlock(required=False)
link = LinkBlock(required=False)
link_aria_label = blocks.CharBlock(required=False)

class Meta:
icon = 'placeholder'
Expand Down Expand Up @@ -241,7 +241,7 @@ class HeroBlock(blocks.StructBlock):
sub_heading = blocks.CharBlock(required=False)
description = APIRichTextBlock(required=False)
image = blocks.ListBlock(APIImageBlock(required=False), max_num=1)
cta = blocks.ListBlock(CTAButtonBlock(required=False), max_num=2)
cta = blocks.ListBlock(CTAButtonBlock(required=False), max_num=2, label="CTA")

class Meta:
icon = 'pilcrow'
Expand Down Expand Up @@ -277,7 +277,7 @@ class SectionBlock(blocks.StructBlock):
class Meta:
icon = 'cog'

class PageBodyBlock(blocks.StreamBlock):
class PageContentSectionBlock(blocks.StreamBlock):
hero = HeroBlock(required=False)
cards = blocks.ListBlock(CardsBlock(required=False))
section = SectionBlock(required=False)
Expand All @@ -287,8 +287,6 @@ class PageBodyBlock(blocks.StreamBlock):

class Meta:
icon = 'doc-full'
label = 'Page body'
label = 'Content Section'
group = 'Custom blocks'
max_num = 1
required = True
help_text = 'This block is required and should be used only once per page.'
Loading

0 comments on commit 9961156

Please sign in to comment.