From 1d5ff1f41ce31824d2cc5e6b8c5fc376f4fb9c48 Mon Sep 17 00:00:00 2001 From: danielfmiranda Date: Tue, 2 Jul 2024 13:00:19 -0700 Subject: [PATCH] renamed titlewidget to charcountwidget --- network-api/networkapi/wagtailpages/pagemodels/app_install.py | 4 ++-- network-api/networkapi/wagtailpages/pagemodels/base.py | 4 ++-- network-api/networkapi/wagtailpages/pagemodels/blog/blog.py | 4 ++-- .../wagtailpages/pagemodels/buyersguide/categories.py | 4 ++-- .../wagtailpages/pagemodels/publications/article.py | 4 ++-- network-api/networkapi/wagtailpages/utils.py | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/network-api/networkapi/wagtailpages/pagemodels/app_install.py b/network-api/networkapi/wagtailpages/pagemodels/app_install.py index e9355c4a653..e5dd9ec420b 100644 --- a/network-api/networkapi/wagtailpages/pagemodels/app_install.py +++ b/network-api/networkapi/wagtailpages/pagemodels/app_install.py @@ -3,7 +3,7 @@ from wagtail.fields import StreamField from wagtail_localize.fields import SynchronizedField, TranslatableField -from networkapi.wagtailpages.utils import TitleWidget +from networkapi.wagtailpages.utils import CharCountWidget from .campaigns import CampaignPage from .customblocks.app_install_download_button_block import ( @@ -52,7 +52,7 @@ class AppInstallPage(CampaignPage): FieldPanel( "hero_subheading", classname="full title", - widget=TitleWidget(attrs={"class": "max-length-warning", "data-max-length": 80}), + widget=CharCountWidget(attrs={"class": "max-length-warning", "data-max-length": 80}), ), FieldPanel("download_buttons"), FieldPanel("hero_video"), diff --git a/network-api/networkapi/wagtailpages/pagemodels/base.py b/network-api/networkapi/wagtailpages/pagemodels/base.py index cdd1bb4c14a..9a9c6b86272 100644 --- a/network-api/networkapi/wagtailpages/pagemodels/base.py +++ b/network-api/networkapi/wagtailpages/pagemodels/base.py @@ -11,7 +11,7 @@ # TODO: https://github.com/mozilla/foundation.mozilla.org/issues/2362 from ..donation_modal import DonationModals # noqa: F401 -from ..utils import TitleWidget, get_page_tree_information +from ..utils import CharCountWidget, get_page_tree_information from .customblocks.base_fields import base_fields from .customblocks.base_rich_text_options import base_rich_text_options from .mixin.foundation_banner_inheritance import FoundationBannerInheritanceMixin @@ -838,7 +838,7 @@ def get_banner(self): [ FieldPanel( "hero_headline", - widget=TitleWidget(attrs={"class": "max-length-warning", "data-max-length": 60}), + widget=CharCountWidget(attrs={"class": "max-length-warning", "data-max-length": 60}), ), FieldPanel("hero_button_text"), FieldPanel("hero_button_url"), diff --git a/network-api/networkapi/wagtailpages/pagemodels/blog/blog.py b/network-api/networkapi/wagtailpages/pagemodels/blog/blog.py index 725511b07f9..7f8c446ccb4 100644 --- a/network-api/networkapi/wagtailpages/pagemodels/blog/blog.py +++ b/network-api/networkapi/wagtailpages/pagemodels/blog/blog.py @@ -24,7 +24,7 @@ from networkapi.wagtailpages.forms import BlogPageForm from networkapi.wagtailpages.pagemodels.profiles import Profile -from ...utils import TitleWidget, get_content_related_by_tag +from ...utils import CharCountWidget, get_content_related_by_tag from .. import customblocks from ..base import BasePage from ..customblocks.full_content_rich_text_options import full_content_rich_text_options @@ -167,7 +167,7 @@ class BlogPage(BasePage): TitleFieldPanel( "title", classname="full title", - widget=TitleWidget(attrs={"class": "max-length-warning", "data-max-length": 60}), + widget=CharCountWidget(attrs={"class": "max-length-warning", "data-max-length": 60}), ), MultiFieldPanel([InlinePanel("authors", label="Author", min_num=1)], heading="Author(s)"), FieldPanel("topics", widget=CheckboxSelectMultiple), diff --git a/network-api/networkapi/wagtailpages/pagemodels/buyersguide/categories.py b/network-api/networkapi/wagtailpages/pagemodels/buyersguide/categories.py index 5e301c21890..d4171cc4b2e 100644 --- a/network-api/networkapi/wagtailpages/pagemodels/buyersguide/categories.py +++ b/network-api/networkapi/wagtailpages/pagemodels/buyersguide/categories.py @@ -20,7 +20,7 @@ from networkapi.wagtailpages.pagemodels.buyersguide.forms import ( BuyersGuideProductCategoryForm, ) -from networkapi.wagtailpages.utils import TitleWidget +from networkapi.wagtailpages.utils import CharCountWidget if typing.TYPE_CHECKING: from networkapi.wagtailpages.models import BuyersGuideArticlePage @@ -103,7 +103,7 @@ class BuyersGuideProductCategory( panels = [ FieldPanel( "name", - widget=TitleWidget(attrs={"class": "max-length-warning", "data-max-length": 50}), + widget=CharCountWidget(attrs={"class": "max-length-warning", "data-max-length": 50}), ), FieldPanel("description"), FieldPanel("parent"), diff --git a/network-api/networkapi/wagtailpages/pagemodels/publications/article.py b/network-api/networkapi/wagtailpages/pagemodels/publications/article.py index 43987bd8c5a..9fc776d5f1c 100644 --- a/network-api/networkapi/wagtailpages/pagemodels/publications/article.py +++ b/network-api/networkapi/wagtailpages/pagemodels/publications/article.py @@ -15,7 +15,7 @@ from networkapi.wagtailpages.pagemodels.profiles import Profile from networkapi.wagtailpages.pagemodels.publications.publication import PublicationPage -from networkapi.wagtailpages.utils import TitleWidget, get_plaintext_titles +from networkapi.wagtailpages.utils import CharCountWidget, get_plaintext_titles from ..article_fields import article_fields from ..base import BasePage @@ -182,7 +182,7 @@ class ArticlePage(BasePage): TitleFieldPanel( "title", classname="full title", - widget=TitleWidget(attrs={"class": "max-length-warning", "data-max-length": 60}), + widget=CharCountWidget(attrs={"class": "max-length-warning", "data-max-length": 60}), ), MultiFieldPanel([InlinePanel("authors", label="Author", min_num=0)], heading="Author(s)"), MultiFieldPanel( diff --git a/network-api/networkapi/wagtailpages/utils.py b/network-api/networkapi/wagtailpages/utils.py index 5b29fd958e4..ab8b4be23e9 100644 --- a/network-api/networkapi/wagtailpages/utils.py +++ b/network-api/networkapi/wagtailpages/utils.py @@ -539,7 +539,7 @@ def create_wagtail_image( return wagtail_image -class TitleWidget(forms.TextInput): +class CharCountWidget(forms.TextInput): def render(self, name, value, attrs=None, renderer=None): html = super().render(name, value, attrs) inline_code = mark_safe("

")