Skip to content

Commit 6390947

Browse files
committed
Use existing color theme rather than creating a new one
1 parent 480360c commit 6390947

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

tbx/core/blocks.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@
3232
logger = logging.getLogger(__name__)
3333

3434

35+
class ColourTheme(models.TextChoices):
36+
CORAL = "theme-coral", "Coral"
37+
NEBULINE = "theme-nebuline", "Nebuline"
38+
LAGOON = "theme-lagoon", "Lagoon"
39+
40+
3541
class LinkStructValue(blocks.StructValue):
3642
@cached_property
3743
def url(self):
@@ -53,19 +59,14 @@ class StyledPageLinkBlock(blocks.StructBlock):
5359
A styled page link block with optional title and style choices.
5460
"""
5561

56-
class StyleChoice(models.TextChoices):
57-
CHARITY = "charity", "Charity"
58-
PUBLIC = "public", "Public"
59-
WAGTAIL = "wagtail", "Wagtail"
60-
6162
page = blocks.PageChooserBlock()
6263
title = blocks.CharBlock(
6364
required=False,
6465
help_text="Optional custom title. If not provided, the page title will be used.",
6566
)
6667
style = blocks.ChoiceBlock(
67-
choices=StyleChoice.choices,
68-
default=StyleChoice.CHARITY,
68+
choices=ColourTheme.choices,
69+
default=ColourTheme.CORAL,
6970
help_text="Choose the visual style for this link.",
7071
)
7172

@@ -580,11 +581,6 @@ class IconChoice(models.TextChoices):
580581

581582

582583
class DivisionSignpostCardBlock(blocks.StructBlock):
583-
class ColourTheme(models.TextChoices):
584-
CORAL = "theme-coral", "Coral"
585-
NEBULINE = "theme-nebuline", "Nebuline"
586-
LAGOON = "theme-lagoon", "Lagoon"
587-
588584
card_colour = blocks.ChoiceBlock(
589585
choices=ColourTheme.choices, default=ColourTheme.CORAL, max_length=20
590586
)

0 commit comments

Comments
 (0)