Skip to content

Commit

Permalink
renamed titlewidget to charcountwidget
Browse files Browse the repository at this point in the history
  • Loading branch information
danielfmiranda committed Jul 2, 2024
1 parent 7f8b027 commit 1d5ff1f
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions network-api/networkapi/wagtailpages/pagemodels/app_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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"),
Expand Down
4 changes: 2 additions & 2 deletions network-api/networkapi/wagtailpages/pagemodels/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"),
Expand Down
4 changes: 2 additions & 2 deletions network-api/networkapi/wagtailpages/pagemodels/blog/blog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion network-api/networkapi/wagtailpages/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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("<h3 class='max-length-countdown'></h3>")
Expand Down

0 comments on commit 1d5ff1f

Please sign in to comment.