add icon selection for page sections

This commit is contained in:
2024-08-09 16:54:45 +02:00
parent bdaf35347a
commit 2a0c91711c
6 changed files with 65 additions and 29 deletions
+17
View File
@@ -241,12 +241,28 @@ BASE_BLOCKS = [
@register_streamfield_block
class PageSectionBlock(blocks.StructBlock):
ICON_CHOICES = (
("pigHeadLogo", "Grisehodelogo"),
("key", "Nøkkel"),
("ticket", "Billett"),
("shield", "Skjold"),
("lostProperty", "hittegods"),
("pigsty", "Grisebinge"),
("wheelchair", "Rullestol"),
("clock", "Klokke"),
)
title = blocks.CharBlock(max_length=64, required=True, label="Tittel")
background_color = blocks.ChoiceBlock(
label="Bakgrunnsfarge",
required=False,
choices=BACKGROUND_COLOR_CHOICES,
)
icon = blocks.ChoiceBlock(
label="Ikon",
required=False,
choices=ICON_CHOICES,
)
body = blocks.StreamBlock(
[block for block in BASE_BLOCKS if block[0] != "page_section_navigation"]
+ [
@@ -258,6 +274,7 @@ class PageSectionBlock(blocks.StructBlock):
graphql_fields = [
GraphQLString("title", required=True),
GraphQLString("background_color", required=False),
GraphQLString("icon", required=False),
GraphQLStreamfield("body", required=True),
]