diff --git a/network-api/networkapi/mozfest/factory.py b/network-api/networkapi/mozfest/factory.py
index 86332a3f0af..790000222de 100644
--- a/network-api/networkapi/mozfest/factory.py
+++ b/network-api/networkapi/mozfest/factory.py
@@ -53,6 +53,9 @@ class Meta:
banner_video_url = Faker('url')
banner_heading_text = Faker('sentence', nb_words=6, variable_nb_words=True)
+ banner_carousel = Faker('streamfield', fields=['banner_carousel'])
+ banner_video = Faker('streamfield', fields=['banner_video'])
+
signup = SubFactory(SignupFactory)
diff --git a/network-api/networkapi/mozfest/migrations/0022_mozfesthomepage_banner_carousel_banner_video.py b/network-api/networkapi/mozfest/migrations/0022_mozfesthomepage_banner_carousel_banner_video.py
new file mode 100644
index 00000000000..74c571ec1ce
--- /dev/null
+++ b/network-api/networkapi/mozfest/migrations/0022_mozfesthomepage_banner_carousel_banner_video.py
@@ -0,0 +1,27 @@
+# Generated by Django 3.1.11 on 2021-10-15 16:07
+
+from django.db import migrations
+import networkapi.wagtailpages.pagemodels.customblocks.video_block
+import wagtail.core.blocks
+import wagtail.core.fields
+import wagtail.images.blocks
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('mozfest', '0021_add_spaces_cards'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='mozfesthomepage',
+ name='banner_carousel',
+ field=wagtail.core.fields.StreamField([('slide', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock()), ('heading', wagtail.core.blocks.CharBlock(required=False)), ('description', wagtail.core.blocks.CharBlock(required=False))]))], blank=True, help_text='The slides shown on the new Hero. Please ensure that there are exactly 3 slides. The old Hero will be shown if there are no slides present.', null=True),
+ ),
+ migrations.AddField(
+ model_name='mozfesthomepage',
+ name='banner_video',
+ field=wagtail.core.fields.StreamField([('CMS_video', networkapi.wagtailpages.pagemodels.customblocks.video_block.WagtailVideoChooserBlock()), ('external_video', wagtail.core.blocks.StructBlock([('video_url', wagtail.core.blocks.URLBlock(help_text='For YouTube: go to your YouTube video and click “Share,” then “Embed,” and then copy and paste the provided URL only. For example: https://www.youtube.com/embed/3FIVXBawyQw For Vimeo: follow similar steps to grab the embed URL. For example: https://player.vimeo.com/video/9004979')), ('thumbnail', wagtail.images.blocks.ImageChooserBlock(help_text='The image to show before the video is played.'))]))], blank=True, help_text='The video to play when users click "Watch Video". This is only shown on the new Hero.', null=True),
+ ),
+ ]
diff --git a/network-api/networkapi/mozfest/models.py b/network-api/networkapi/mozfest/models.py
index e91dcd4ad83..29dece1dd2b 100644
--- a/network-api/networkapi/mozfest/models.py
+++ b/network-api/networkapi/mozfest/models.py
@@ -6,7 +6,6 @@
from wagtail.snippets.edit_handlers import SnippetChooserPanel
from wagtail_localize.fields import SynchronizedField, TranslatableField
-
from networkapi.wagtailpages.utils import (
set_main_site_nav_information,
get_page_tree_information
@@ -126,10 +125,15 @@ class MozfestHomepage(MozfestPrimaryPage):
MozFest Homepage
'banner_video_type' determines what version of banner design the page should load
- """
- # this tells the templates to load a hardcoded, pre-defined video in the banner background
- banner_video_type = "hardcoded"
+ If the value of `banner_video_type` is `hardcoded`, it displays a hardcoded,
+ predefined video in the banner background.
+
+ If the value of `banner_video_type` is `featured`, it displays a carousel of
+ cards with their associated headings and body content (`banner_carousel`),
+ and an embedded user-defined video (`banner_video`).
+ """
+ banner_video_type = "featured"
cta_button_label = models.CharField(
max_length=250,
@@ -156,12 +160,39 @@ class MozfestHomepage(MozfestPrimaryPage):
help_text='A banner paragraph specific to the homepage'
)
+ # For banner_video_type == 'hardcoded'
banner_video_url = models.URLField(
max_length=2048,
blank=True,
help_text='The video to play when users click "watch video"'
)
+ # For banner_video_type == 'featured'
+ banner_carousel = StreamField(
+ [
+ ('slide', customblocks.BannerCarouselSlideBlock()),
+ ],
+ max_num=3,
+ help_text='The slides shown on the new Hero. Please ensure that there '
+ 'are exactly 3 slides. The old Hero will be shown if there '
+ 'are no slides present.',
+ blank=True,
+ null=True,
+ )
+
+ # For banner_video_type == 'featured'
+ banner_video = StreamField(
+ [
+ ('CMS_video', customblocks.WagtailVideoChooserBlock()),
+ ('external_video', customblocks.ExternalVideoBlock()),
+ ],
+ max_num=1,
+ help_text='The video to play when users click "Watch Video". This is '
+ 'only shown on the new Hero.',
+ blank=True,
+ null=True,
+ )
+
subpage_types = [
'MozfestPrimaryPage',
'MozfestHomepage',
@@ -176,16 +207,29 @@ class MozfestHomepage(MozfestPrimaryPage):
FieldPanel('cta_button_label'),
FieldPanel('cta_button_destination'),
FieldPanel('banner_heading'),
+ StreamFieldPanel('banner_carousel'),
FieldPanel('banner_guide_text'),
FieldPanel('banner_video_url'),
+ StreamFieldPanel('banner_video'),
] + parent_panels[n:]
if banner_video_type == "hardcoded":
# Hide all the panels that aren't relevant for the video banner version of the MozFest Homepage
content_panels = [
field for field in all_panels
- if field.field_name not in
- ['banner', 'header', 'intro', 'banner_guide_text', 'banner_video_url']
+ if field.field_name not in [
+ 'banner', 'header', 'intro', 'banner_carousel', 'banner_guide_text',
+ 'banner_video', 'banner_video_url',
+ ]
+ ]
+ elif banner_video_type == "featured":
+ # Hide all the panels that aren't relevant for the video banner version of the MozFest Homepage
+ content_panels = [
+ field for field in all_panels
+ if field.field_name not in [
+ 'banner', 'banner_guide_text', 'banner_video_url', 'cta_button_destination',
+ 'cta_button_label', 'header', 'hero_image', 'intro',
+ ]
]
else:
content_panels = all_panels
diff --git a/network-api/networkapi/mozfest/templates/fragments/carousel_navigation.html b/network-api/networkapi/mozfest/templates/fragments/carousel_navigation.html
new file mode 100644
index 00000000000..7c46877c03e
--- /dev/null
+++ b/network-api/networkapi/mozfest/templates/fragments/carousel_navigation.html
@@ -0,0 +1,25 @@
+
+ {% for slide_block in page.specific.banner_carousel %}
+ {% with slide=slide_block.value %}
+ {% image slide.image fill-1600x900 as img %}
+
+ {% endwith %}
+ {% endfor %}
+
+
+
+
+ {# Text slider #}
+
+
+
{{ page.banner_heading }}
+ {% if page.banner_video %}
+
+ {% endif %}
+
+
+
+
+ {# pagination progress bars on desktop #}
+
+
+ {# Text #}
+
+ {% for slide_block in page.specific.banner_carousel %}
+ {% with slide=slide_block.value %}
+
+ {{ slide.heading }}
+
{{ slide.description }}
+
+ {% endwith %}
+ {% endfor %}
+
+
+
+ {# mobile slider #}
+ {% include 'fragments/hero/hero_mobile_slider.html' with items=page.hero_slides %}
+
+
+ {# Video block #}
+ {% if page.banner_video %}
+ {% include 'fragments/hero/featured_video.html' %}
+ {% endif %}
+
+
+
+
+{# Spacing for top of content section when there is no video #}
+{% if not page.banner_video %}
+
+{% endif %}
+
+
diff --git a/network-api/networkapi/mozfest/templates/fragments/hero/featured_video.html b/network-api/networkapi/mozfest/templates/fragments/hero/featured_video.html
new file mode 100644
index 00000000000..5c9c0a528ee
--- /dev/null
+++ b/network-api/networkapi/mozfest/templates/fragments/hero/featured_video.html
@@ -0,0 +1,52 @@
+{% load i18n static wagtailcore_tags wagtailimages_tags %}
+
- {% if homepage %}
- {% include "../fragments/hero/large.html" with page=page banner_video_type=banner_video_type %}
- {% include "./homepage_banner.html" with page=page banner_video_type=banner_video_type %}
+ {% if homepage %}
+ {% if page.banner_carousel %}
+ {# Hero with carousel and featured video below #}
+ {% include "fragments/hero/carousel_hero.html" with page=page banner_video_type=banner_video_type %}
{% else %}
- {% include "../fragments/hero/normal.html" with page=page %}
+ {# Hero with hardcoded video as background #}
+ {% include "fragments/hero/hardcoded_video_hero.html" with page=page banner_video_type=banner_video_type %}
{% endif %}
-