Skip to content

[BE/FE] Mozfest Current Events Slider #7457

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 57 commits into from
Nov 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
6d40c69
Add common reusable link blocks
Oct 6, 2021
8776fcd
BE: Mozfest Spaces Cards
Oct 6, 2021
7bf3e17
[7430] FE - current events slider (#7505)
stevedya Oct 5, 2021
569228b
Update template size condition
stevedya Oct 6, 2021
577d28a
Grid adjustment depending on signup form being visible
stevedya Oct 6, 2021
18ac67c
Javascript cleanups as per code review
stevedya Oct 8, 2021
371b181
Merge remote-tracking branch 'origin/main' into feature/be-fe-mozfest…
Oct 11, 2021
6a31577
Update migrations
Oct 11, 2021
2bf5e13
Make subheading_link optional
Oct 11, 2021
f3f2e04
Merge branch 'feature/be-fe-mozfest-current-events-slider' of github.…
Oct 11, 2021
e359df1
Carousel alignment fixes
stevedya Oct 11, 2021
1b1d259
Carousel full width
stevedya Oct 12, 2021
5f9f797
Signup form placement depending on which block is rendered in base
stevedya Oct 12, 2021
db10903
Add property to event block to check if wide
stevedya Oct 13, 2021
d6f4192
Add template tag for holding singup form boolean to render form
stevedya Oct 13, 2021
a53086a
Js modifications as per feedback
stevedya Oct 14, 2021
513d993
Remove base page overrides for overflowing sliders, configure slider …
stevedya Oct 14, 2021
1732603
autoheight for carousels on mozfest
stevedya Oct 15, 2021
168d397
Merge branch 'main' into feature/be-fe-mozfest-current-events-slider
Oct 19, 2021
264a62c
Fix flake issues
Oct 19, 2021
feac757
Fix eslint issues
Oct 19, 2021
7de18b9
Remove newline
Oct 19, 2021
029e1a5
Merge branch 'main' into feature/be-fe-mozfest-current-events-slider
Oct 21, 2021
13b6ddd
Use double-quotes in tailwind config https://github.com/mozilla/found…
Oct 21, 2021
7a87031
Use template literal in querySelector https://github.com/mozilla/foun…
Oct 21, 2021
8be7bdf
Use forEach instead of for, use template literal for querySelectorAll…
Oct 21, 2021
60d2fe0
Use single quotes https://github.com/mozilla/foundation.mozilla.org/p…
Oct 21, 2021
e7c061b
Remove unused load in mozfest-base
stevedya Oct 21, 2021
4d10c5b
Remove unused template tag that was used in development
stevedya Oct 21, 2021
9157af0
Remove empty carousel.scss
stevedya Oct 21, 2021
d0c0434
Remove duplicated class and fix nav title not showing with current ev…
stevedya Oct 22, 2021
19b54aa
Remove commented out overlay
stevedya Oct 22, 2021
8a4046d
Merge branch 'main' into feature/be-fe-mozfest-current-events-slider
Oct 26, 2021
94f9d2e
Switch colors to originally intended colors
Oct 26, 2021
c212114
Remove space changes
Oct 26, 2021
26c8fbf
Update migrations
Oct 26, 2021
e5fd4ca
Replace ListBlock with StreamBlock
Oct 26, 2021
d32291c
Remove rogue spacing changes
Oct 26, 2021
ad0941e
More rogue space changes
Oct 26, 2021
cc62055
Minor spacing changes
Oct 26, 2021
dad0b44
Remove duplicate styles
Oct 26, 2021
027fa87
Add padding to h2
Oct 26, 2021
53034fb
Remove newline change
Oct 26, 2021
9bacc05
Move navigation buttons into slider main container
Oct 26, 2021
487e3fc
Change title font weight to 600 https://github.com/mozilla/foundation…
Oct 27, 2021
1772a5c
Update subheading color to tw-text-blue (#595cf3) https://github.com/…
Oct 27, 2021
7ef0ff3
Remove fill-rule and clip-rule from carousel_navigation fragment http…
Oct 27, 2021
ec05fcd
Use blocks instead of comments in block template https://github.com/m…
Oct 27, 2021
69385d2
Merge branch 'main' into feature/be-fe-mozfest-current-events-slider
Oct 27, 2021
825b1b2
Update migrations
Oct 27, 2021
fcbfddf
Remove tailwind config changes
Oct 27, 2021
9d06453
Change mobile navigation active bullet color to #0d10bf https://githu…
Oct 27, 2021
05f63ad
Merge branch 'main' into feature/be-fe-mozfest-current-events-slider
Oct 27, 2021
f6cbbff
Merge branch 'main' into feature/be-fe-mozfest-current-events-slider
Oct 29, 2021
6c49765
Update migrations
Oct 29, 2021
6298337
Merge branch 'main' into feature/be-fe-mozfest-current-events-slider
Nov 1, 2021
a082403
Merge branch 'main' into feature/be-fe-mozfest-current-events-slider
Pomax Nov 4, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 3.1.11 on 2021-10-29 09:09

from django.db import migrations
import networkapi.wagtailpages.pagemodels.blog.blog_category
import wagtail.core.blocks
import wagtail.core.blocks.static_block
import wagtail.core.fields
import wagtail.documents.blocks
import wagtail.images.blocks


class Migration(migrations.Migration):

dependencies = [
('mozfest', '0024_mozfesthomepage_banner_cta_label'),
]

operations = [
migrations.AlterField(
model_name='mozfestprimarypage',
name='body',
field=wagtail.core.fields.StreamField([('paragraph', wagtail.core.blocks.RichTextBlock(features=['bold', 'italic', 'large', 'h2', 'h3', 'h4', 'h5', 'ol', 'ul', 'link', 'hr'], template='wagtailpages/blocks/rich_text_block.html')), ('card_grid', wagtail.core.blocks.StructBlock([('cards', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock()), ('alt_text', wagtail.core.blocks.CharBlock(help_text="Alt text for card's image.", required=False)), ('title', wagtail.core.blocks.CharBlock(help_text='Heading for the card.')), ('body', wagtail.core.blocks.TextBlock(help_text='Body text of the card.')), ('link_url', wagtail.core.blocks.CharBlock(help_text='Optional URL that this card should link out to. (Note: If left blank, link will not render.) ', required=False)), ('link_label', wagtail.core.blocks.CharBlock(help_text='Optional Label for the URL link above. (Note: If left blank, link will not render.) ', required=False))]), help_text='Please use a minimum of 2 cards.'))])), ('image', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock()), ('altText', wagtail.core.blocks.CharBlock(help_text='Image description (for screen readers).', required=True)), ('caption', wagtail.core.blocks.CharBlock(required=False)), ('captionURL', wagtail.core.blocks.CharBlock(help_text='Optional URL that this caption should link out to.', required=False)), ('image_width', wagtail.core.blocks.ChoiceBlock(choices=[('normal', 'Normal'), ('wide', 'Wide'), ('full_width', 'Full Width')], help_text='Wide images are col-12, Full-Width Images reach both ends of the screen (16:6 images recommended for full width)'))])), ('image_text', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock()), ('altText', wagtail.core.blocks.CharBlock(help_text='Image description (for screen readers).', required=True)), ('text', wagtail.core.blocks.RichTextBlock(features=['bold', 'italic', 'h2', 'h3', 'h4', 'h5', 'h6', 'ol', 'ul', 'link'])), ('url', wagtail.core.blocks.CharBlock(help_text='Optional URL that this image should link out to.', required=False)), ('top_divider', wagtail.core.blocks.BooleanBlock(help_text='Optional divider above content block.', required=False)), ('bottom_divider', wagtail.core.blocks.BooleanBlock(help_text='Optional divider below content block.', required=False))])), ('image_text_mini', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock()), ('altText', wagtail.core.blocks.CharBlock(help_text='Image description (for screen readers).', required=True)), ('text', wagtail.core.blocks.RichTextBlock(features=['bold', 'italic', 'link']))])), ('image_grid', wagtail.core.blocks.StructBlock([('grid_items', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock()), ('alt_text', wagtail.core.blocks.CharBlock(help_text='Alt text for this image.', required=False)), ('caption', wagtail.core.blocks.CharBlock(help_text='Please remember to properly attribute any images we use.', required=False)), ('url', wagtail.core.blocks.CharBlock(help_text='Optional URL that this figure should link out to.', required=False)), ('square_image', wagtail.core.blocks.BooleanBlock(default=True, help_text='If left checked, the image will be cropped to be square.', required=False))])))])), ('video', wagtail.core.blocks.StructBlock([('url', wagtail.core.blocks.CharBlock(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')), ('caption', wagtail.core.blocks.CharBlock(required=False)), ('captionURL', wagtail.core.blocks.CharBlock(help_text='Optional URL for caption to link to.', required=False)), ('video_width', wagtail.core.blocks.ChoiceBlock(choices=[('normal', 'Normal'), ('wide', 'Wide'), ('full_width', 'Full Width')], help_text='Wide videos are col-12, Full-Width videos reach both ends of the screen.'))])), ('iframe', wagtail.core.blocks.StructBlock([('url', wagtail.core.blocks.CharBlock(help_text='Please note that only URLs from allow-listed domains will work.')), ('height', wagtail.core.blocks.IntegerBlock(help_text='Optional integer pixel value for custom iFrame height', required=False)), ('caption', wagtail.core.blocks.CharBlock(required=False)), ('captionURL', wagtail.core.blocks.CharBlock(help_text='Optional URL that this caption should link out to.', required=False)), ('iframe_width', wagtail.core.blocks.ChoiceBlock(choices=[('normal', 'Normal'), ('wide', 'Wide'), ('full_width', 'Full Width')], help_text='Wide iframes are col-12, Full-Width iframes reach both ends of the screen'))])), ('linkbutton', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock()), ('URL', wagtail.core.blocks.CharBlock()), ('styling', wagtail.core.blocks.ChoiceBlock(choices=[('btn-primary', 'Primary button'), ('btn-secondary', 'Secondary button')]))])), ('spacer', wagtail.core.blocks.StructBlock([('size', wagtail.core.blocks.ChoiceBlock(choices=[('1', 'quarter spacing'), ('2', 'half spacing'), ('3', 'single spacing'), ('4', 'one and a half spacing'), ('5', 'triple spacing')]))])), ('quote', wagtail.core.blocks.StructBlock([('quotes', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock([('quote', wagtail.core.blocks.RichTextBlock(features=['bold'])), ('attribution', wagtail.core.blocks.CharBlock(required=False))])))])), ('pulse_listing', wagtail.core.blocks.StructBlock([('search_terms', wagtail.core.blocks.CharBlock(help_text='Test your search at mozillapulse.org/search', label='Search', required=False)), ('max_number_of_results', wagtail.core.blocks.IntegerBlock(default=6, help_text='Choose 1-12. If you want visitors to see more, link to a search or tag on Pulse.', max_value=12, min_value=0, required=True)), ('only_featured_entries', wagtail.core.blocks.BooleanBlock(default=False, help_text='Featured items are selected by Pulse moderators.', label='Display only featured entries', required=False)), ('newest_first', wagtail.core.blocks.ChoiceBlock(choices=[('True', 'Show newer entries first'), ('False', 'Show older entries first')], label='Sort')), ('advanced_filter_header', wagtail.core.blocks.static_block.StaticBlock(admin_text='-------- ADVANCED FILTERS: OPTIONS TO DISPLAY FEWER, MORE TARGETED RESULTS. --------', label=' ')), ('issues', wagtail.core.blocks.ChoiceBlock(choices=[('all', 'All'), ('Decentralization', 'Decentralization'), ('Digital Inclusion', 'Digital Inclusion'), ('Online Privacy & Security', 'Online Privacy & Security'), ('Open Innovation', 'Open Innovation'), ('Web Literacy', 'Web Literacy')])), ('help', wagtail.core.blocks.ChoiceBlock(choices=[('all', 'All'), ('Attend', 'Attend'), ('Create content', 'Create content'), ('Code', 'Code'), ('Design', 'Design'), ('Fundraise', 'Fundraise'), ('Join community', 'Join community'), ('Localize & translate', 'Localize & translate'), ('Mentor', 'Mentor'), ('Plan & organize', 'Plan & organize'), ('Promote', 'Promote'), ('Take action', 'Take action'), ('Test & feedback', 'Test & feedback'), ('Write documentation', 'Write documentation')], label='Type of help needed')), ('direct_link', wagtail.core.blocks.BooleanBlock(default=False, help_text='Checked: user goes to project link. Unchecked: user goes to pulse entry', label='Direct link', required=False))])), ('profile_listing', wagtail.core.blocks.StructBlock([('max_number_of_results', wagtail.core.blocks.IntegerBlock(default=12, help_text='Pick up to 48 profiles.', max_value=48, min_value=1, required=True)), ('advanced_filter_header', wagtail.core.blocks.static_block.StaticBlock(admin_text='-------- ADVANCED FILTERS: OPTIONS TO DISPLAY FEWER, MORE TARGETED RESULTS. --------', label=' ')), ('profile_type', wagtail.core.blocks.CharBlock(default='', help_text='Example: Fellow.', required=False)), ('program_type', wagtail.core.blocks.CharBlock(default='', help_text='Example: Tech Policy.', required=False)), ('year', wagtail.core.blocks.CharBlock(default='', required=False))])), ('profile_by_id', wagtail.core.blocks.StructBlock([('ids', wagtail.core.blocks.CharBlock(help_text='Show profiles for pulse users with specific profile ids (mozillapulse.org/profile/[##]). For multiple profiles, specify a comma separated list (e.g. 85,105,332).', label='Profile by ID'))])), ('profile_directory', wagtail.core.blocks.StructBlock([('max_number_of_results', wagtail.core.blocks.IntegerBlock(default=12, help_text='Pick up to 48 profiles.', max_value=48, min_value=1, required=True)), ('advanced_filter_header', wagtail.core.blocks.static_block.StaticBlock(admin_text='-------- ADVANCED FILTERS: OPTIONS TO DISPLAY FEWER, MORE TARGETED RESULTS. --------', label=' ')), ('profile_type', wagtail.core.blocks.CharBlock(default='', help_text='Example: Fellow.', required=False)), ('program_type', wagtail.core.blocks.CharBlock(default='', help_text='Example: Tech Policy.', required=False)), ('year', wagtail.core.blocks.CharBlock(default='', required=False)), ('filter_values', wagtail.core.blocks.CharBlock(default='2019,2018,2017,2016,2015,2014,2013', help_text='Example: 2019,2018,2017,2016,2015,2014,2013', required=True))])), ('recent_blog_entries', wagtail.core.blocks.StructBlock([('title', wagtail.core.blocks.CharBlock(required=False)), ('tag_filter', wagtail.core.blocks.CharBlock(help_text='Test this filter at foundation.mozilla.org/blog/tags/', label='Filter by Tag', required=False)), ('category_filter', wagtail.core.blocks.ChoiceBlock(choices=networkapi.wagtailpages.pagemodels.blog.blog_category.BlogPageCategory.get_categories, help_text='Test this filter at foundation.mozilla.org/blog/category/', label='Filter by Category', required=False)), ('top_divider', wagtail.core.blocks.BooleanBlock(help_text='Optional divider above content block.', required=False)), ('bottom_divider', wagtail.core.blocks.BooleanBlock(help_text='Optional divider below content block.', required=False))])), ('blog_set', wagtail.core.blocks.StructBlock([('title', wagtail.core.blocks.CharBlock()), ('top_divider', wagtail.core.blocks.BooleanBlock(help_text='Optional divider above content block.', required=False)), ('bottom_divider', wagtail.core.blocks.BooleanBlock(help_text='Optional divider below content block.', required=False)), ('blog_pages', wagtail.core.blocks.ListBlock(wagtail.core.blocks.PageChooserBlock(page_type=['wagtailpages.BlogPage'])))])), ('airtable', wagtail.core.blocks.StructBlock([('url', wagtail.core.blocks.URLBlock(help_text="Copied from the Airtable embed code. The word 'embed' will be in the url")), ('height', wagtail.core.blocks.IntegerBlock(default=533, help_text='The pixel height on desktop view, usually copied from the Airtable embed code'))])), ('typeform', wagtail.core.blocks.StructBlock([('embed_id', wagtail.core.blocks.CharBlock(help_text='The embed id of your Typeform page (e.g. if the form is on admin.typeform.com/form/e8zScc6t, the id will be: e8zScc6t)', required=True)), ('button_type', wagtail.core.blocks.ChoiceBlock(choices=[('btn-primary', 'Primary button'), ('btn-secondary', 'Secondary button')])), ('button_text', wagtail.core.blocks.CharBlock(help_text='This is a text prompt for users to open the typeform content', required=True))])), ('current_events_slider', wagtail.core.blocks.StructBlock([('title', wagtail.core.blocks.CharBlock(help_text='Heading for the slider.')), ('current_events', wagtail.core.blocks.StreamBlock([('current_event', wagtail.core.blocks.StructBlock([('title', wagtail.core.blocks.CharBlock(help_text='Heading of the card.')), ('subheading_link', wagtail.core.blocks.StreamBlock([('internal', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='Label for this link.')), ('link', wagtail.core.blocks.PageChooserBlock(help_text='Page that this should link out to.'))])), ('external', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='Label for this link.')), ('link', wagtail.core.blocks.URLBlock(help_text='URL that this should link out to.'))]))], help_text='The link that appears below the card heading.', max_num=1, required=False)), ('image', wagtail.images.blocks.ImageChooserBlock(help_text='The image associated with this event.')), ('body', wagtail.core.blocks.TextBlock(help_text='Body text of the card.')), ('buttons', wagtail.core.blocks.StreamBlock([('internal', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='Label for this link.')), ('link', wagtail.core.blocks.PageChooserBlock(help_text='Page that this should link out to.'))])), ('external', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='Label for this link.')), ('link', wagtail.core.blocks.URLBlock(help_text='URL that this should link out to.'))])), ('document', wagtail.core.blocks.StructBlock([('label', wagtail.core.blocks.CharBlock(help_text='Label for this link.')), ('document', wagtail.documents.blocks.DocumentChooserBlock(help_text='Document that this should link out to.'))], help_text='An iCal document can be attached here for an "Add to Calendar" button.'))], help_text='A list of buttons that will appear at the bottom of the card.', max_num=2))]))], help_text='A list of current events in the slider.'))])), ('space_card_list', wagtail.core.blocks.StructBlock([('title', wagtail.core.blocks.CharBlock()), ('space_cards', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock()), ('title', wagtail.core.blocks.CharBlock(help_text='Heading for the card.')), ('body', wagtail.core.blocks.TextBlock(help_text='Body text of the card.')), ('link', wagtail.core.blocks.StreamBlock([('internal', wagtail.core.blocks.StructBlock([('link', wagtail.core.blocks.PageChooserBlock(help_text='Page that this should link out to.'))])), ('external', wagtail.core.blocks.StructBlock([('link', wagtail.core.blocks.URLBlock(help_text='URL that this should link out to.'))]))], help_text='Page or external URL this card will link out to.', max_num=1))]), help_text='A list of Space Cards.'))]))]),
),
]
1 change: 1 addition & 0 deletions network-api/networkapi/mozfest/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class MozfestPrimaryPage(FoundationMetadataPageMixin, FoundationBannerInheritanc

body = StreamField(
base_fields + [
('current_events_slider', customblocks.CurrentEventsSliderBlock()),
('space_card_list', customblocks.SpaceCardListBlock()),
]
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<div class="swiper-navigation tw-container tx-p-0 tw-relative tw-z-10 tw-mb-5 tw-ml-auto tw-hidden large:tw-flex large:tw-justify-end {% if page.signup != None %} tw-ml-0 tw-container{% endif %}">
<div class="tw-flex tw-flex-row tw-justify-between tw-items-center">
<div class="swiper-button-prev">
<svg class="swiper-button-icon" viewBox="0 0 21 21" fill="none">
<path d="M20.75 10.5c0-.70761-.5099-1.28125-1.1389-1.28125H1.38889C.759899 9.21875.25 9.79239.25 10.5c0 .7076.509899 1.2812 1.13889 1.2812H19.6111c.629 0 1.1389-.5736 1.1389-1.2812Z"
fill="currentColor"/>
<path d="M10.1664.625269c-.44474-.500359-1.16584-.500359-1.6106 0L.583572 9.59402c-.444763.50038-.444763 1.31158 0 1.81198L8.5558 20.3747c.44476.5004 1.16586.5004 1.6106 0 .4448-.5003.4448-1.3116 0-1.8119L2.99952 10.5l7.16688-8.06277c.4448-.50036.4448-1.3116 0-1.811961Z"
fill="currentColor"/>
</svg>
</div>
<div class="swiper-button-next">
<svg class="swiper-button-icon" viewBox="0 0 21 21" fill="none">
<path d="M.25 10.5c0-.70761.509898-1.28125 1.13889-1.28125H19.6111c.629 0 1.1389.57364 1.1389 1.28125 0 .7076-.5099 1.2812-1.1389 1.2812H1.38889C.759898 11.7812.25 11.2076.25 10.5Z"
fill="currentColor"/>
<path d="M10.8336.625269c.4447-.500359 1.1658-.500359 1.6106 0l7.9722 8.968751c.4448.50038.4448 1.31158 0 1.81198l-7.9722 8.9687c-.4448.5004-1.1659.5004-1.6106 0-.4448-.5003-.4448-1.3116 0-1.8119L18.0005 10.5l-7.1669-8.06277c-.4448-.50036-.4448-1.3116 0-1.811961Z"
fill="currentColor"/>
</svg>
</div>
</div>
</div>
19 changes: 19 additions & 0 deletions network-api/networkapi/mozfest/templates/fragments/event_card.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<div class="tw-border tw-border-gray-60/20 tw-p-5 medium:tw-p-6 tw-h-full tw-flex tw-flex-col tw-items-start">
<div class="tw-mb-4">
<h3>{{ title }}</h3>
{% if category_url %}
<div class="tw-mt-3">
<a class="tw-underline tw-text-blue body" href="{{ category_url }}">{{ category_title }}</a>
</div>
{% endif %}
</div>
{% if image %}
<img class="tw-w-full tw-h-auto" src="{{ image }}" alt="{{ image_alt }}">
{% endif %}
<p class="tw-my-5">{{ text }}</p>
<div class="tw-flex tw-flex-wrap tw-gap-3">
{% for button in buttons %}
<a class="btn btn-primary tw-mt-auto" href="{{ button.value.link_url }}">{{ button.value.label }}</a>
{% endfor %}
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from .blog_set_block import BlogSetBlock
from .bootstrap_spacer_block import BootstrapSpacerBlock
from .card_grid import CardGrid, CardGridBlock
from .current_events_slider_block import CurrentEventsSliderBlock
from .banner_carousel import BannerCarouselSlideBlock
from .iframe_block import iFrameBlock
from .image_block import ImageBlock
Expand Down Expand Up @@ -42,6 +43,7 @@
BootstrapSpacerBlock,
CardGrid,
CardGridBlock,
CurrentEventsSliderBlock,
DearInternetLetterBlock,
ExternalVideoBlock,
iFrameBlock,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
from wagtail.core import blocks
from wagtail.images.blocks import ImageChooserBlock

from .common.link_blocks import LabelledExternalLinkBlock, LabelledInternalLinkBlock, LabelledDocumentLinkBlock


class CurrentEventBlock(blocks.StructBlock):
title = blocks.CharBlock(help_text='Heading of the card.')

subheading_link = blocks.StreamBlock(
[
('internal', LabelledInternalLinkBlock()),
('external', LabelledExternalLinkBlock()),
],
help_text='The link that appears below the card heading.',
max_num=1,
required=False,
)

image = ImageChooserBlock(help_text='The image associated with this event.')

body = blocks.TextBlock(help_text='Body text of the card.')

buttons = blocks.StreamBlock(
[
('internal', LabelledInternalLinkBlock()),
('external', LabelledExternalLinkBlock()),
('document', LabelledDocumentLinkBlock(
help_text='An iCal document can be attached here for an "Add to Calendar" button.'
)),
],
help_text='A list of buttons that will appear at the bottom of the card.',
max_num=2,
)

class Meta:
icon = 'form'
label = 'Current Event Item'


class CurrentEventsSliderBlock(blocks.StructBlock):
title = blocks.CharBlock(help_text='Heading for the slider.')

current_events = blocks.StreamBlock(
[
('current_event', CurrentEventBlock()),
],
help_text='A list of current events in the slider.',
)

class Meta:
icon = 'list-ul'
help_text = (
'Recommendation: No more than 5 items should be in this slider. '
'This slider cannot be placed at the top of the page when a signup form is present as they will overlap.'
)
template = 'wagtailpages/blocks/current_events_slider_block.html'
Loading