add colored horizontal rule block
This commit is contained in:
@ -68,3 +68,25 @@ class ImageSliderBlock(blocks.StructBlock):
|
||||
|
||||
class Meta:
|
||||
icon = "image"
|
||||
|
||||
|
||||
@register_streamfield_block
|
||||
class HorizontalRuleBlock(blocks.StructBlock):
|
||||
COLOR_CHOICES = (
|
||||
("deepBrick", "Dyp tegl"),
|
||||
("neufPink", "Griserosa"),
|
||||
("goldenOrange", "Gyllen oransje"),
|
||||
("goldenBeige", "Gyllen beige"),
|
||||
("chateauBlue", "Slottsblå"),
|
||||
)
|
||||
|
||||
color = blocks.ChoiceBlock(
|
||||
label="Farge",
|
||||
required=False,
|
||||
choices=COLOR_CHOICES,
|
||||
)
|
||||
|
||||
graphql_fields = [GraphQLString("color", required=False)]
|
||||
|
||||
class Meta:
|
||||
icon = "minus"
|
||||
|
@ -1,13 +1,14 @@
|
||||
from wagtail import blocks
|
||||
from wagtail.fields import StreamField
|
||||
|
||||
from dnscms.blocks import ImageSliderBlock, ImageWithTextBlock
|
||||
from dnscms.blocks import HorizontalRuleBlock, ImageSliderBlock, ImageWithTextBlock
|
||||
|
||||
CommonStreamField = StreamField(
|
||||
[
|
||||
("paragraph", blocks.RichTextBlock(label="Rik tekst")),
|
||||
("image", ImageWithTextBlock(label="Bilde")),
|
||||
("image_slider", ImageSliderBlock(label="Bildegalleri")),
|
||||
("horizontal_rule", HorizontalRuleBlock(label="Skillelinje")),
|
||||
],
|
||||
default=[("paragraph", "")],
|
||||
)
|
||||
|
Reference in New Issue
Block a user