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

Upgrade wagtail 4.0.4 #1699

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from
56 changes: 41 additions & 15 deletions home/blocks.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from django.conf import settings
from django.forms.utils import flatatt
from django.utils.html import format_html, format_html_join
from django.utils.safestring import mark_safe
from django.utils.translation import gettext as _
Expand All @@ -23,7 +21,8 @@ def get_context(self, value, parent_context=None):
return context

class Meta:
template = 'blocks/media.html'
icon = "media"
template = "blocks/media.html"


class SocialMediaLinkBlock(blocks.StructBlock):
Expand Down Expand Up @@ -52,6 +51,9 @@ class Meta:
class EmbeddedQuestionnaireBlock(blocks.StructBlock):
direct_display = blocks.BooleanBlock(required=False)

class Meta:
icon = "form"


class EmbeddedPollBlock(EmbeddedQuestionnaireBlock):
poll = EmbeddedQuestionnaireChooserBlock(target_model='questionnaires.Poll')
Expand Down Expand Up @@ -119,6 +121,7 @@ def get_context(self, value, parent_context=None):
return context

class Meta:
icon = "link"
template = 'blocks/page_button.html'


Expand All @@ -137,7 +140,8 @@ def get_context(self, value, parent_context=None):
return context

class Meta:
template = 'blocks/article.html'
icon = "pick"
template = "blocks/article.html"


class NumberedListBlock(blocks.ListBlock):
Expand All @@ -152,6 +156,9 @@ def render_basic(self, value, context=None):
)
return format_html("<ol>{0}</ol>", children)

class Meta:
icon = "list-ol"


class RawHTMLBlock(blocks.RawHTMLBlock):
def render_basic(self, value, context=None):
Expand All @@ -162,20 +169,39 @@ def render_basic(self, value, context=None):

class DownloadButtonBlock(blocks.StructBlock):
available_text = blocks.CharBlock(
help_text=_('This text appears when it is possible for the user to install the app on their phone.'))
help_text=_(
"This text appears when it is possible for the user to install the app on"
" their phone"
)
)
unavailable_text = blocks.CharBlock(
required=False,
help_text=_(
'This text appears when the user is using a feature phone and thus cannot install the app '
'(the button will be disabled in this case). [Currently not implemented]'),
form_classname='red-help-text')
"This text appears when the user is using a feature phone and thus cannot"
" install the app (the button will be disabled in this case)."
" [Currently not implemented]"
),
form_classname="red-help-text",
)
offline_text = blocks.CharBlock(
required=False, help_text=_(
'This text appears when the user is navigating the site via the offline app and '
'thus it doesn\'t make sense to install the offline app again '
'(the button will be disabled in this case).'))
page = PageChooserBlock(target_model='wagtailcore.Page')
description = blocks.RichTextBlock(features=settings.WAGTAIL_RICH_TEXT_FIELD_FEATURES)
required=False,
help_text=_(
"This text appears when the user is navigating the site via the offline app"
" and thus it does not make sense to install the offline app again (the"
" button will be disabled in this case)."
),
)
page = PageChooserBlock(target_model="wagtailcore.Page")
description = blocks.RichTextBlock()

class Meta:
template = 'blocks/download_button.html'
icon = "download"
template = "blocks/download_button.html"


def heading_block():
return blocks.CharBlock(
icon="h1",
form_classname="full title",
template="blocks/heading.html",
)
Loading