Skip to content

Commit

Permalink
[7884] remove unnecessary admin fields from mozfest homepage (#8130)
Browse files Browse the repository at this point in the history
* [7884] remove unnecessary admin fields from mozfest homepage

* [7884] remove unnecessary admin fields from translatable fields

* [7884] remove footnotes admin field from translatable fields

* Update network-api/networkapi/mozfest/models.py

Co-authored-by: Pomax <[email protected]>
  • Loading branch information
richbrennan and Pomax committed Jan 26, 2022
1 parent 2748735 commit ab97872
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions network-api/networkapi/mozfest/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django import forms
from django.db import models
from wagtail.admin.edit_handlers import FieldPanel, StreamFieldPanel
from wagtail.admin.edit_handlers import FieldPanel, MultiFieldPanel, StreamFieldPanel
from wagtail.core.fields import StreamField, RichTextField
from wagtail.core.models import Page
from wagtail.images.edit_handlers import ImageChooserPanel
Expand Down Expand Up @@ -220,21 +220,19 @@ class MozfestHomepage(MozfestPrimaryPage):
'MozfestHomepage',
]

# Put everything above the body
parent_panels = MozfestPrimaryPage.content_panels
panel_count = len(parent_panels)
n = panel_count - 1

content_panels = parent_panels[:n] + [
FieldPanel('cta_button_label'),
FieldPanel('cta_button_destination'),
# See https://github.com/mozilla/foundation.mozilla.org/issues/7883#issuecomment-996039763
content_panels = Page.content_panels + [
SnippetChooserPanel('signup'),
MultiFieldPanel([
FieldPanel('cta_button_label', heading='Label'),
FieldPanel('cta_button_destination', heading='Destination'),
], heading='CTA Button'),
FieldPanel('banner_heading'),
FieldPanel('banner_cta_label'),
StreamFieldPanel('banner_carousel'),
FieldPanel('banner_guide_text'),
FieldPanel('banner_video_url'),
StreamFieldPanel('banner_video'),
] + parent_panels[n:]
StreamFieldPanel('body'),
]

# Because we inherit from PrimaryPage, but the "use_wide_template" property does nothing
# we should hide it and make sure we use the right template
Expand All @@ -253,13 +251,10 @@ class MozfestHomepage(MozfestPrimaryPage):
SynchronizedField('cta_button_destination'),
TranslatableField('banner_heading'),
TranslatableField('banner_cta_label'),
TranslatableField('banner_guide_text'),
SynchronizedField('banner_video_url'),
TranslatableField('banner_carousel'),
SynchronizedField('banner_video'),
TranslatableField('signup'),
TranslatableField('body'),
TranslatableField('footnotes'),
]

def get_context(self, request):
Expand Down

0 comments on commit ab97872

Please sign in to comment.