Skip to content

Commit

Permalink
DSRC-15: Table Block (#1679)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesbiggs authored Jul 16, 2024
1 parent 08644f7 commit 8d3db08
Show file tree
Hide file tree
Showing 5 changed files with 694 additions and 0 deletions.
1 change: 1 addition & 0 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"etna.whatson",
"wagtail.contrib.forms",
"wagtail.contrib.redirects",
"wagtail.contrib.table_block",
"wagtail.embeds",
"wagtail.sites",
"wagtail.users",
Expand Down
2 changes: 2 additions & 0 deletions etna/core/blocks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
)
from .quote import QuoteBlock
from .section import SectionBlock, SubHeadingBlock
from .tables import ContentTableBlock
from .text import InsetTextBlock, WarningTextBlock
from .video import YouTubeBlock

Expand All @@ -29,6 +30,7 @@
"ButtonBlock",
"CallToActionBlock",
"ContentImageBlock",
"ContentTableBlock",
"DocumentsBlock",
"DoDontListBlock",
"FeaturedRecordArticleBlock",
Expand Down
34 changes: 34 additions & 0 deletions etna/core/blocks/tables.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from wagtail import blocks
from wagtail.contrib.table_block.blocks import TableBlock


class ContentTableBlock(blocks.StructBlock):
title = blocks.CharBlock(
max_length=100,
help_text="Title of the table",
label="Title",
required=False,
)
table = TableBlock(
table_options={
"contextMenu": [
"row_above",
"row_below",
"---------",
"col_left",
"col_right",
"---------",
"remove_row",
"remove_col",
"---------",
"undo",
"redo",
"---------",
"alignment",
]
}
)

class Meta:
icon = "table"
label = "Table"
2 changes: 2 additions & 0 deletions etna/generic_pages/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
ButtonBlock,
CallToActionBlock,
ContentImageBlock,
ContentTableBlock,
DocumentsBlock,
DoDontListBlock,
FeaturedRecordArticleBlock,
Expand Down Expand Up @@ -37,6 +38,7 @@ class SectionContentBlock(blocks.StreamBlock):
quote = QuoteBlock()
record_links = RecordLinksBlock()
sub_heading = SubHeadingBlock()
table = ContentTableBlock()
warning_text = WarningTextBlock()
youtube_video = YouTubeBlock()

Expand Down
Loading

0 comments on commit 8d3db08

Please sign in to comment.