simplify fact box types

This commit is contained in:
2024-07-15 20:56:16 +02:00
parent ea5ea5cf1c
commit a73a0799fc
11 changed files with 203 additions and 172 deletions
+5 -13
View File
@@ -2,6 +2,7 @@ from grapple.helpers import register_streamfield_block
from grapple.models import (
GraphQLImage,
GraphQLPage,
GraphQLRichText,
GraphQLStreamfield,
GraphQLString,
)
@@ -203,27 +204,18 @@ class AccordionBlock(blocks.StructBlock):
@register_streamfield_block
class FactBoxBlock(blocks.StructBlock):
heading = blocks.CharBlock(max_length=64, required=True, label="Overskrift")
background_color = blocks.ChoiceBlock(
label="Bakgrunnsfarge",
required=False,
choices=BACKGROUND_COLOR_CHOICES,
)
body = blocks.StreamBlock(
[
(
"paragraph",
blocks.RichTextBlock(
features=["bold", "italic", "link", "ol", "ul", "h2", "h3", "h4", "h5", "h6"],
label="Tekst",
),
),
]
body = blocks.RichTextBlock(
features=["bold", "italic", "link", "ol", "ul", "h2", "h3"],
label="Innhold",
)
graphql_fields = [
GraphQLString("heading", required=True),
GraphQLStreamfield("body", required=True),
GraphQLRichText("body", required=True),
GraphQLString("background_color", required=False),
]