add accordion block

This commit is contained in:
2024-07-14 17:46:08 +02:00
parent 2dd94b3d1d
commit fb95bb9694
7 changed files with 222 additions and 35 deletions

View File

@ -176,6 +176,25 @@ class OpeningHoursSectionBlock(blocks.StaticBlock):
admin_text = "Viser gjeldende åpningstider."
@register_streamfield_block
class AccordionBlock(blocks.StructBlock):
heading = blocks.CharBlock(max_length=64, required=True, label="Overskrift")
body = blocks.StreamBlock(
[
("paragraph", blocks.RichTextBlock(label="Rik tekst")),
("image", ImageWithTextBlock(label="Bilde")),
]
)
graphql_fields = [
GraphQLString("heading", required=True),
GraphQLStreamfield("body", required=True),
]
class Meta:
icon = "folder-open-1"
BASE_BLOCKS = [
("paragraph", blocks.RichTextBlock(label="Rik tekst")),
("image", ImageWithTextBlock(label="Bilde")),
@ -183,6 +202,7 @@ BASE_BLOCKS = [
("horizontal_rule", HorizontalRuleBlock(label="Skillelinje")),
("featured", FeaturedBlock(label="Fremhevet underside")),
("page_section_navigation", PageSectionNavigationBlock()),
("accordion", AccordionBlock()),
]