add schedule block
This commit is contained in:
@@ -225,6 +225,62 @@ class FactBoxBlock(blocks.StructBlock):
|
||||
label = "Faktaboks"
|
||||
|
||||
|
||||
@register_streamfield_block
|
||||
class ScheduleItemBlock(blocks.StructBlock):
|
||||
time = blocks.CharBlock(
|
||||
label="Tidspunkt/dato",
|
||||
required=True,
|
||||
max_length=64,
|
||||
help_text='Fritekst, f.eks. "13:00", "20:00 – 23:00" eller "23.06"',
|
||||
)
|
||||
title = blocks.RichTextBlock(
|
||||
features=["bold", "italic", "link"],
|
||||
label="Tittel",
|
||||
required=True,
|
||||
help_text="Kort tittel på én linje. Du kan legge inn lenker.",
|
||||
)
|
||||
description = blocks.RichTextBlock(
|
||||
features=["bold", "italic", "link"],
|
||||
label="Beskrivelse",
|
||||
required=False,
|
||||
help_text="Valgfri tilleggsinformasjon.",
|
||||
)
|
||||
|
||||
graphql_fields = [
|
||||
GraphQLString("time", required=True),
|
||||
GraphQLRichText("title", required=True),
|
||||
GraphQLRichText("description"),
|
||||
]
|
||||
|
||||
class Meta:
|
||||
icon = "time"
|
||||
label = "Punkt"
|
||||
|
||||
|
||||
@register_streamfield_block
|
||||
class ScheduleBlock(blocks.StructBlock):
|
||||
title = blocks.CharBlock(
|
||||
max_length=64,
|
||||
required=False,
|
||||
label="Tittel",
|
||||
help_text="Overskrift for timeplanen (valgfritt)",
|
||||
)
|
||||
items = blocks.ListBlock(
|
||||
ScheduleItemBlock(),
|
||||
min_num=1,
|
||||
label="Punkter",
|
||||
)
|
||||
|
||||
graphql_fields = [
|
||||
GraphQLString("title"),
|
||||
GraphQLStreamfield("items", required=True),
|
||||
]
|
||||
|
||||
class Meta:
|
||||
icon = "time"
|
||||
label = "Timeplan"
|
||||
|
||||
|
||||
BASE_BLOCKS = [
|
||||
("paragraph", blocks.RichTextBlock(label="Rik tekst")),
|
||||
("image", ImageWithTextBlock()),
|
||||
@@ -234,6 +290,7 @@ BASE_BLOCKS = [
|
||||
("page_section_navigation", PageSectionNavigationBlock()),
|
||||
("accordion", AccordionBlock()),
|
||||
("fact_box", FactBoxBlock()),
|
||||
("schedule", ScheduleBlock()),
|
||||
("embed", EmbedBlock()),
|
||||
("raw_html", blocks.RawHTMLBlock()),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user