Skip to content

Commit

Permalink
DSRC-110: FeaturedPageBlock (#1723)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesbiggs authored Oct 14, 2024
1 parent c876d2e commit f69a3f0
Show file tree
Hide file tree
Showing 4 changed files with 573 additions and 0 deletions.
2 changes: 2 additions & 0 deletions etna/core/blocks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from .promoted_links import (
AuthorPromotedLinkBlock,
AuthorPromotedPagesBlock,
FeaturedPageBlock,
PromotedItemBlock,
PromotedLinkBlock,
PromotedListBlock,
Expand All @@ -41,6 +42,7 @@
"DoDontListBlock",
"FeaturedRecordArticleBlock",
"FeaturedCollectionBlock",
"FeaturedPageBlock",
"ImageBlock",
"ImageGalleryBlock",
"InsetTextBlock",
Expand Down
17 changes: 17 additions & 0 deletions etna/core/blocks/promoted_links.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from wagtail.snippets.blocks import SnippetChooserBlock

from etna.core.blocks.image import APIImageChooserBlock
from etna.core.blocks.page_chooser import APIPageChooserBlock
from etna.core.blocks.paragraph import APIRichTextBlock

from .base import SectionDepthAwareStructBlock
Expand Down Expand Up @@ -141,3 +142,19 @@ class Meta:
icon = "link"
label = "Link list"
template = "articles/blocks/promoted_list_block.html"


class FeaturedPageBlock(blocks.StructBlock):
"""
Block for featuring a page.
"""

page = APIPageChooserBlock(
label="Page",
required=True,
page_type="wagtailcore.Page",
)

class Meta:
icon = "doc-full"
label = "Featured page"
2 changes: 2 additions & 0 deletions etna/generic_pages/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
DetailsBlock,
DocumentsBlock,
DoDontListBlock,
FeaturedPageBlock,
FeaturedRecordArticleBlock,
ImageGalleryBlock,
InsetTextBlock,
Expand Down Expand Up @@ -40,6 +41,7 @@ class SectionContentBlock(blocks.StreamBlock):
details = DetailsBlock()
document = DocumentsBlock()
do_dont_list = DoDontListBlock()
featured_page = FeaturedPageBlock()
featured_record_article = FeaturedRecordArticleBlock()
image = ContentImageBlock()
image_gallery = ImageGalleryBlock()
Expand Down
Loading

0 comments on commit f69a3f0

Please sign in to comment.