Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DSRC-62: Document block #1638

Merged
merged 29 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
9a0d8b7
Created DocumentBlock to add link text and a related file
jamesbiggs Jun 5, 2024
2ccbc1e
Added DocumentBlock to the __init__
jamesbiggs Jun 5, 2024
a7bb1db
Added DocumentBlock to SectionContentBlock
jamesbiggs Jun 5, 2024
7316acd
Formatting
jamesbiggs Jun 5, 2024
9b36828
Checked migration
jamesbiggs Jun 5, 2024
2c8e3b9
Added `GENERIC_RICH_TEXT_FEATURES` for later use to add documents to …
jamesbiggs Jun 13, 2024
267c80f
Deleted migration
jamesbiggs Jun 18, 2024
c451226
Merge branch 'develop' into feature/DSRC-62-documents
jamesbiggs Jun 18, 2024
75885cc
Added DocumentBlock to GeneralPage
jamesbiggs Jun 18, 2024
e833fe6
Document -> Documents
jamesbiggs Jun 18, 2024
e4fabd1
Merge branch 'develop' into feature/DSRC-62-documents
jamesbiggs Jul 2, 2024
1eb7900
Fixed migration
jamesbiggs Jul 2, 2024
97ad4bf
Extended base DocumentModel with CustomDocument to add extent and des…
jamesbiggs Jul 2, 2024
e984300
Updated API representation of the DocumentBlock
jamesbiggs Jul 2, 2024
68b8cfd
Migrations
jamesbiggs Jul 2, 2024
8189421
Formatting
jamesbiggs Jul 2, 2024
ead48b3
More formatting...
jamesbiggs Jul 2, 2024
9f6cc51
Removed GENERIC_RICH_TEXT_FEATURES
jamesbiggs Jul 2, 2024
7b39a3a
Dropped to 1DP
jamesbiggs Jul 2, 2024
4698ce8
Merge branch 'develop' into feature/DSRC-62-documents
jamesbiggs Jul 9, 2024
897e4d4
Merge branch 'develop' into feature/DSRC-62-documents
jamesbiggs Jul 10, 2024
0254156
Removed link_text and updated migrations
jamesbiggs Jul 10, 2024
9e3a7d1
Added pretty_file_size
jamesbiggs Jul 10, 2024
61f99ae
Changed to 1000 base
jamesbiggs Jul 10, 2024
768f8fc
Update etna/core/models/documents.py
jamesbiggs Jul 10, 2024
7577978
Differing decimal places, and strip .0 or .00 endings
jamesbiggs Jul 10, 2024
749a9aa
Formatting
jamesbiggs Jul 10, 2024
e7c2d0b
Further formatting
jamesbiggs Jul 10, 2024
727fd45
Even more formatting...
jamesbiggs Jul 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,9 @@
"ol",
"ul",
]
GENERIC_RICH_TEXT_FEATURES = RESTRICTED_RICH_TEXT_FEATURES + [
"document-link",
]
EXPANDED_RICH_TEXT_FEATURES = RESTRICTED_RICH_TEXT_FEATURES + [
"h2",
"h3",
Expand Down
2 changes: 2 additions & 0 deletions etna/core/blocks/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from .base import SectionDepthAwareStructBlock
from .cta import ButtonBlock, CallToActionBlock, LargeCardLinksBlock
from .document import DocumentBlock
from .featured_content import (
FeaturedCollectionBlock,
FeaturedRecordArticleBlock,
Expand All @@ -25,6 +26,7 @@
"ButtonBlock",
"CallToActionBlock",
"ContentImageBlock",
"DocumentBlock",
"FeaturedRecordArticleBlock",
"FeaturedCollectionBlock",
"ImageBlock",
Expand Down
18 changes: 18 additions & 0 deletions etna/core/blocks/document.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from wagtail import blocks
from wagtail.documents.blocks import DocumentChooserBlock


class DocumentBlock(blocks.StructBlock):
"""
A block for embedding a document file in a page.
"""

link_text = blocks.CharBlock(
required=True,
help_text="The text to display for the link to the document",
)
file = DocumentChooserBlock(required=True)

class Meta:
icon = "doc-full"
label = "Document"
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,
DocumentBlock,
FeaturedRecordArticleBlock,
ParagraphBlock,
PromotedItemBlock,
Expand All @@ -20,6 +21,7 @@
class SectionContentBlock(blocks.StreamBlock):
button = ButtonBlock()
call_to_action = CallToActionBlock()
document = DocumentBlock()
featured_record_article = FeaturedRecordArticleBlock()
image = ContentImageBlock()
media = MediaBlock()
Expand Down
Loading
Loading