Skip to content

Commit

Permalink
Fix revert direct commit tp1 793 (#12865)
Browse files Browse the repository at this point in the history
* Revert "Merge branch 'main' of github-mf:MozillaFoundation/foundation.mozilla.org"

This reverts commit 5e5a1cf, reversing
changes made to 4028231.

* Revert "Replace `News you can use` with `Highlights` in all references. Made all `Highlights`, `Take action` and `Ideas` titles editable in CMS."

This reverts commit 4028231.
  • Loading branch information
ramram-mf authored Sep 12, 2024
1 parent 5e5a1cf commit 467de6b
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 63 deletions.
4 changes: 2 additions & 2 deletions network-api/networkapi/wagtailpages/factory/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
homepage,
homepage_cause_statement_link,
homepage_features,
homepage_highlights,
homepage_partner_logos,
homepage_take_action,
homepage_usable_news,
initiatives_page,
locale,
opportunity,
Expand Down Expand Up @@ -40,7 +40,7 @@ def generate(seed):
homepage_features.generate(seed)
homepage_partner_logos.generate(seed)
homepage_take_action.generate(seed)
homepage_highlights.generate(seed)
homepage_usable_news.generate(seed)
initiatives_page.generate(seed)
opportunity.generate(seed)
participate_page_featured_highlights.generate(seed)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
from factory.django import DjangoModelFactory

from networkapi.utility.faker.helpers import get_homepage, reseed
from networkapi.wagtailpages.models import BlogPage, HomepageHighlights
from networkapi.wagtailpages.models import BlogPage, HomepageNewsYouCanUse

from .blog import BlogPageFactory
from .homepage import WagtailHomepageFactory


class HightlightsFactory(DjangoModelFactory):
class NewsYouCanUseFactory(DjangoModelFactory):
class Meta:
abstract = True

page = SubFactory(WagtailHomepageFactory)


class HomepageHightlightsFactory(HightlightsFactory):
class HomepageNewsYouCanUseFactory(NewsYouCanUseFactory):
class Meta:
model = HomepageHighlights
model = HomepageNewsYouCanUse

blog = SubFactory(BlogPageFactory)

Expand All @@ -29,6 +29,6 @@ def generate(seed):

reseed(seed)

home_page.highlights = [HomepageHightlightsFactory.build(blog=BlogPage.objects.all()[i]) for i in range(4)]
home_page.news_you_can_use = [HomepageNewsYouCanUseFactory.build(blog=BlogPage.objects.all()[i]) for i in range(4)]

home_page.save()

This file was deleted.

2 changes: 1 addition & 1 deletion network-api/networkapi/wagtailpages/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
FoundationMetadataPageMixin,
Homepage,
HomepageFocusAreas,
HomepageHighlights,
HomepageIdeasPosts,
HomepageNewsYouCanUse,
InitiativesPage,
ParticipateHighlights,
ParticipateHighlights2,
Expand Down
19 changes: 5 additions & 14 deletions network-api/networkapi/wagtailpages/pagemodels/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,10 +463,10 @@ def __str__(self):
return self.page.title + "->" + self.blog.title


class HomepageHighlights(TranslatableMixin, WagtailOrderable):
class HomepageNewsYouCanUse(TranslatableMixin, WagtailOrderable):
page = ParentalKey(
"wagtailpages.Homepage",
related_name="highlights",
related_name="news_you_can_use",
)
blog = models.ForeignKey("BlogPage", on_delete=models.CASCADE, related_name="+")
panels = [
Expand Down Expand Up @@ -764,8 +764,6 @@ def get_banner(self):

hero_button_url = models.URLField(blank=True)

ideas_title = models.CharField(default="Ideas", max_length=50)

ideas_image = models.ForeignKey(
"wagtailimages.Image",
null=True,
Expand Down Expand Up @@ -839,9 +837,6 @@ def get_banner(self):
null=True,
on_delete=models.SET_NULL,
)

highlights_title = models.CharField(default="The Highlights", max_length=50)

# Take Action Section
take_action_title = models.CharField(default="Take action", max_length=50)

Expand Down Expand Up @@ -879,15 +874,13 @@ def get_banner(self):
),
MultiFieldPanel(
[
FieldPanel("highlights_title"),
InlinePanel("highlights", min_num=4, max_num=4),
InlinePanel("news_you_can_use", min_num=4, max_num=4),
],
heading="The Highlights",
heading="News you can use",
classname="collapsible",
),
MultiFieldPanel(
[
FieldPanel("ideas_title"),
FieldPanel("ideas_image"),
FieldPanel("ideas_headline"),
InlinePanel("ideas_posts", label="Posts", min_num=3, max_num=3),
Expand Down Expand Up @@ -940,7 +933,6 @@ def get_banner(self):
SynchronizedField("hero_image"),
TranslatableField("hero_button_text"),
SynchronizedField("hero_button_url"),
TranslatableField("ideas_title"),
SynchronizedField("ideas_image"),
TranslatableField("ideas_headline"),
TranslatableField("cause_statement"),
Expand All @@ -960,8 +952,7 @@ def get_banner(self):
TranslatableField("take_action_cards"),
TranslatableField("partner_logos"),
TranslatableField("ideas_posts"),
TranslatableField("highlights"),
TranslatableField("highlights_title"),
TranslatableField("news_you_can_use"),
]

subpage_types = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="row section-ideas section-padding">

<div class="col-12">
<h2 class="capsule-label mb-0 ml-md-4">{{ page.ideas_title }}</h2>
<h2 class="capsule-label mb-0 ml-md-4">{% trans "Ideas" %}</h2>
</div>
<div class="col-12 col-lg-6 mb-md-4 mb-lg-0 tw-dark">
<div class="ideas-banner d-flex align-items-end full-bleed-xs p-3 p-md-4" style="background-image: linear-gradient(180deg, rgba(238,238,238,0) 14%, #000000 100%), url({% image_url page.ideas_image "width-540" %});">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

<div class="row section-news-you-can-use section-padding">
<div class="col-12 d-flex flex-row justify-content-between">
<h2 class="tw-text-[22px] tw-leading-[30px] medium:tw-text-2xl medium:tw-leading-[30px] tw-font-bold tw-font-sans tw-text-black tw-tracking-normal tw-mb-5">{{ page.highlights_title }}</h2>
<h2 class="tw-text-[22px] tw-leading-[30px] medium:tw-text-2xl medium:tw-leading-[30px] tw-font-bold tw-font-sans tw-text-black tw-tracking-normal tw-mb-5">{% trans "News you can use" %}</h2>
{# this should not be a hardcoded route... #}
<a href="/{{ lang_code }}/blog" class="tw-cta-link d-none d-md-inline-block" id="news-you-can-use-cta">{% trans "Read more" %}</a>
<a href="/{{ lang_code }}/blog" class="tw-cta-link d-none d-md-inline-block" id="news-you-can-use-cta">{% trans "Read more news" %}</a>
</div>

<div class="col-12">
<div class="row d-flex flex-row mb-4">
{% with items=page.highlights.all %}
{% with items=page.news_you_can_use.all %}

{% comment %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

<div class="tw-bg-gray-05">
<div class="container">
{% include "./fragments/highlights.html" %}
{% include "./fragments/news_you_can_use.html" %}
</div>
</div>

Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
"eslint": "^8.57.0",
"eslint-plugin-jsx-a11y": "^6.10.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.35.2",
"eslint-plugin-react": "^7.35.0",
"optipng-bin": "^9.0.0",
"prettier": "^3.3.3",
"stylelint": "^16.9.0",
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ ignore="H017"
"network-api/networkapi/wagtailpages/templates/wagtailpages/fragments/entry_cards.html" = "T003,T032"
"network-api/networkapi/wagtailpages/templates/wagtailpages/fragments/formassembly_body.html" = "H021, H026"
"network-api/networkapi/wagtailpages/templates/wagtailpages/fragments/generic_card.html" = "T003"
"network-api/networkapi/wagtailpages/templates/wagtailpages/fragments/hightlights.html" = "D018,H006,T032"
"network-api/networkapi/wagtailpages/templates/wagtailpages/fragments/news_you_can_use.html" = "D018,H006,T032"
"network-api/networkapi/wagtailpages/templates/wagtailpages/fragments/newsletter-signup-box.html" = "H008"
"network-api/networkapi/wagtailpages/templates/wagtailpages/fragments/partner.html" = "H006,H008,H014"
"network-api/networkapi/wagtailpages/templates/wagtailpages/fragments/primary_heroguts.html" = "H006"
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ wagtailmedia==0.14.5
# via -r requirements.in
webencodings==0.5.1
# via html5lib
whitenoise==6.7.0
whitenoise==6.6.0
# via -r requirements.in
willow[heif]==1.6.3
# via
Expand Down

0 comments on commit 467de6b

Please sign in to comment.