From af5b7b3bc90575239320d5e8622b1fc0d47ea11a Mon Sep 17 00:00:00 2001 From: Ramon Ramos Date: Thu, 13 Jun 2024 12:07:52 -0600 Subject: [PATCH 1/4] Remove all `zen_mode` references from page models --- .../wagtailpages/pagemodels/app_install.py | 2 -- .../networkapi/wagtailpages/pagemodels/base.py | 12 ------------ .../networkapi/wagtailpages/pagemodels/blog/blog.py | 2 -- .../networkapi/wagtailpages/pagemodels/campaigns.py | 2 -- .../wagtailpages/pagemodels/dear_internet.py | 2 -- .../networkapi/wagtailpages/pagemodels/modular.py | 12 ------------ .../wagtailpages/pagemodels/publications/article.py | 4 ---- .../pagemodels/publications/publication.py | 4 ---- .../networkapi/wagtailpages/pagemodels/youtube.py | 7 ------- 9 files changed, 47 deletions(-) diff --git a/network-api/networkapi/wagtailpages/pagemodels/app_install.py b/network-api/networkapi/wagtailpages/pagemodels/app_install.py index 9cfac4c13f4..85e2ee6d6e5 100644 --- a/network-api/networkapi/wagtailpages/pagemodels/app_install.py +++ b/network-api/networkapi/wagtailpages/pagemodels/app_install.py @@ -11,8 +11,6 @@ class AppInstallPage(CampaignPage): - zen_nav = False - hero_heading = models.CharField( max_length=80, help_text="Hero story headline", diff --git a/network-api/networkapi/wagtailpages/pagemodels/base.py b/network-api/networkapi/wagtailpages/pagemodels/base.py index c3a9caf55ab..cdd1bb4c14a 100644 --- a/network-api/networkapi/wagtailpages/pagemodels/base.py +++ b/network-api/networkapi/wagtailpages/pagemodels/base.py @@ -61,11 +61,6 @@ class PrimaryPage(FoundationBannerInheritanceMixin, BasePage): # type: ignore help_text="For text-heavy pages, turn this on to reduce the overall width of the content on the page.", ) - zen_nav = models.BooleanField( - default=False, - help_text="For secondary nav pages, use this to collapse the primary nav under a toggle hamburger.", - ) - body = StreamField(base_fields, use_json_field=True) settings_panels = Page.settings_panels + [ @@ -75,12 +70,6 @@ class PrimaryPage(FoundationBannerInheritanceMixin, BasePage): # type: ignore ], classname="collapsible", ), - MultiFieldPanel( - [ - FieldPanel("zen_nav"), - ], - classname="collapsible", - ), ] content_panels = Page.content_panels + [ @@ -104,7 +93,6 @@ class PrimaryPage(FoundationBannerInheritanceMixin, BasePage): # type: ignore TranslatableField("intro"), TranslatableField("body"), SynchronizedField("narrowed_page_content"), - SynchronizedField("zen_nav"), ] subpage_types = [ diff --git a/network-api/networkapi/wagtailpages/pagemodels/blog/blog.py b/network-api/networkapi/wagtailpages/pagemodels/blog/blog.py index 75a3f3fa76d..725511b07f9 100644 --- a/network-api/networkapi/wagtailpages/pagemodels/blog/blog.py +++ b/network-api/networkapi/wagtailpages/pagemodels/blog/blog.py @@ -134,8 +134,6 @@ class BlogPage(BasePage): tags = ClusterTaggableManager(through=BlogPageTag, blank=True) - zen_nav = False - hero_image = models.ForeignKey( "wagtailimages.Image", null=True, diff --git a/network-api/networkapi/wagtailpages/pagemodels/campaigns.py b/network-api/networkapi/wagtailpages/pagemodels/campaigns.py index f311b00d20c..69a3123f427 100644 --- a/network-api/networkapi/wagtailpages/pagemodels/campaigns.py +++ b/network-api/networkapi/wagtailpages/pagemodels/campaigns.py @@ -352,7 +352,6 @@ def get_donation_modal_json(self): TranslatableField("title"), TranslatableField("header"), SynchronizedField("narrowed_page_content"), - SynchronizedField("zen_nav"), TranslatableField("body"), TranslatableField("donation_modals"), ] @@ -429,7 +428,6 @@ class BanneredCampaignPage(PrimaryPage): TranslatableField("title"), SynchronizedField("banner"), SynchronizedField("narrowed_page_content"), - SynchronizedField("zen_nav"), # FIXME: Contingency fix while https://github.com/mozilla/foundation.mozilla.org/pull/7771 is sorted out # TranslatableField("cta"), TranslatableField("signup"), diff --git a/network-api/networkapi/wagtailpages/pagemodels/dear_internet.py b/network-api/networkapi/wagtailpages/pagemodels/dear_internet.py index 3de3c955532..3c1c35b130a 100644 --- a/network-api/networkapi/wagtailpages/pagemodels/dear_internet.py +++ b/network-api/networkapi/wagtailpages/pagemodels/dear_internet.py @@ -68,6 +68,4 @@ class DearInternetPage(BasePage): SynchronizedField("cta_button_link"), ] - zen_nav = True - template = "wagtailpages/pages/dear_internet_page.html" diff --git a/network-api/networkapi/wagtailpages/pagemodels/modular.py b/network-api/networkapi/wagtailpages/pagemodels/modular.py index ae56792b4d9..0e8ac3ed7bc 100644 --- a/network-api/networkapi/wagtailpages/pagemodels/modular.py +++ b/network-api/networkapi/wagtailpages/pagemodels/modular.py @@ -23,11 +23,6 @@ class ModularPage(BasePage): help_text="For text-heavy pages, turn this on to reduce the overall width of the content on the page.", ) - zen_nav = models.BooleanField( - default=True, - help_text="For secondary nav pages, use this to collapse the primary nav under a toggle hamburger.", - ) - body = StreamField(base_fields, use_json_field=True) settings_panels = Page.settings_panels + [ @@ -37,12 +32,6 @@ class ModularPage(BasePage): ], classname="collapsible", ), - MultiFieldPanel( - [ - FieldPanel("zen_nav"), - ], - classname="collapsible", - ), ] content_panels = Page.content_panels + [ @@ -60,7 +49,6 @@ class ModularPage(BasePage): # Content tab fields TranslatableField("header"), SynchronizedField("narrowed_page_content"), - SynchronizedField("zen_nav"), ] show_in_menus_default = True diff --git a/network-api/networkapi/wagtailpages/pagemodels/publications/article.py b/network-api/networkapi/wagtailpages/pagemodels/publications/article.py index 91d006b9156..43987bd8c5a 100644 --- a/network-api/networkapi/wagtailpages/pagemodels/publications/article.py +++ b/network-api/networkapi/wagtailpages/pagemodels/publications/article.py @@ -307,10 +307,6 @@ def breadcrumb_list(self): """ return Page.objects.ancestor_of(self).type(PublicationPage).live() - @property - def zen_nav(self): - return True - @property def get_page_titles(self): return get_plaintext_titles(None, self.body, "content") diff --git a/network-api/networkapi/wagtailpages/pagemodels/publications/publication.py b/network-api/networkapi/wagtailpages/pagemodels/publications/publication.py index 586caeef0c2..ae309b1effc 100644 --- a/network-api/networkapi/wagtailpages/pagemodels/publications/publication.py +++ b/network-api/networkapi/wagtailpages/pagemodels/publications/publication.py @@ -286,10 +286,6 @@ def prev_page(self): prev_page = sibling return prev_page - @property - def zen_nav(self): - return True - def breadcrumb_list(self): """ Get all the parent PublicationPages and return a QuerySet diff --git a/network-api/networkapi/wagtailpages/pagemodels/youtube.py b/network-api/networkapi/wagtailpages/pagemodels/youtube.py index 1b668d80f3c..bdd707d2b7c 100644 --- a/network-api/networkapi/wagtailpages/pagemodels/youtube.py +++ b/network-api/networkapi/wagtailpages/pagemodels/youtube.py @@ -66,8 +66,6 @@ class YoutubeRegretsPage(BasePage): TranslatableField("regret_stories"), ] - zen_nav = True - template = "wagtailpages/pages/youtube_regrets_page.html" @@ -112,15 +110,12 @@ class YoutubeRegretsReporterPage(BasePage): TranslatableField("intro_images"), ] - zen_nav = True - template = "wagtailpages/pages/youtube_regrets_reporter_page.html" class YoutubeRegrets2021Page(BasePage): template = "wagtailpages/pages/youtube-regrets-2021/youtube_regrets_2021.html" max_count = 1 - zen_nav = True translatable_fields = [ # Promote tab fields @@ -141,7 +136,6 @@ class Meta: class YoutubeRegrets2022Page(BasePage): template = "wagtailpages/pages/youtube-regrets-2022/youtube_regrets_2022.html" max_count = 1 - zen_nav = True translatable_fields = [ # Promote tab fields @@ -162,7 +156,6 @@ class Meta: class YoutubeRegretsReporterExtensionPage(BasePage): template = "wagtailpages/pages/regrets-reporter-landing-page/youtube_regrets_reporter_extension.html" max_count = 1 - zen_nav = True translatable_fields = [ # Promote tab fields From 514f22cb615b1c2d0e478facd438f2fa9af109b8 Mon Sep 17 00:00:00 2001 From: Ramon Ramos Date: Fri, 14 Jun 2024 15:22:40 -0600 Subject: [PATCH 2/4] Create migration for `zen_mode` field removal in page models --- ...138_remove_modularpage_zen_nav_and_more.py | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 network-api/networkapi/wagtailpages/migrations/0138_remove_modularpage_zen_nav_and_more.py diff --git a/network-api/networkapi/wagtailpages/migrations/0138_remove_modularpage_zen_nav_and_more.py b/network-api/networkapi/wagtailpages/migrations/0138_remove_modularpage_zen_nav_and_more.py new file mode 100644 index 00000000000..0e17a202aad --- /dev/null +++ b/network-api/networkapi/wagtailpages/migrations/0138_remove_modularpage_zen_nav_and_more.py @@ -0,0 +1,21 @@ +# Generated by Django 4.2.11 on 2024-06-14 21:12 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("wagtailpages", "0137_blogsignup_privacy_notice_cta_privacy_notice"), + ] + + operations = [ + migrations.RemoveField( + model_name="modularpage", + name="zen_nav", + ), + migrations.RemoveField( + model_name="primarypage", + name="zen_nav", + ), + ] From d01ee6fb62da764088664073f63d881acca374c0 Mon Sep 17 00:00:00 2001 From: Ramon Ramos Date: Wed, 12 Jun 2024 20:30:11 -0600 Subject: [PATCH 3/4] Remove zen mode references from `primary-nav.js` and `primary_nav.html` --- .../networkapi/templates/fragments/primary_nav.html | 12 +++--------- source/js/primary-nav.js | 11 ----------- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/network-api/networkapi/templates/fragments/primary_nav.html b/network-api/networkapi/templates/fragments/primary_nav.html index 5fd859a4ad9..7d27d8c8b2e 100644 --- a/network-api/networkapi/templates/fragments/primary_nav.html +++ b/network-api/networkapi/templates/fragments/primary_nav.html @@ -1,8 +1,6 @@ {% load primary_active_nav i18n %} -{% if page.zen_nav == True %}
-{% else %}
-{% endif %} +