-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adds carousel text block * Changed the wrong field * Rebase fixes * Better template to work with * Fix migrations * Drop 'block' in naming conventions * So we don't trigger a new migration
- Loading branch information
1 parent
b1a3d94
commit be5f3e9
Showing
7 changed files
with
1,801 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
# flake8: noqa | ||
from .carousel_text_block import CarouselTextBlock | ||
from .stats_block import StatisticsBlock |
19 changes: 19 additions & 0 deletions
19
network-api/networkapi/mozfest/blocks/carousel_text_block.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from wagtail import blocks | ||
|
||
from networkapi.wagtailpages.pagemodels import customblocks | ||
|
||
|
||
class CarouselTextBlock(blocks.StructBlock): | ||
heading = blocks.CharBlock(help_text="Heading for the block.", required=False) | ||
text = blocks.RichTextBlock(features=["bold", "italic", "link"]) | ||
# Use specific link fields for the CTA on the block as opposed to the | ||
# common.link_blocks.LabelledExternalLinkBlock so it can be marked as | ||
# required=False. | ||
link_url = blocks.URLBlock(help_text="A CTA URL for a link displayed", required=False) | ||
link_label = blocks.CharBlock(help_text="Label for the CTA link.", required=False) | ||
carousel_images = blocks.ListBlock(customblocks.ImageBlock(), max_num=4) | ||
|
||
class Meta: | ||
icon = "placeholder" | ||
template = "fragments/blocks/carousel_text_block.html" | ||
label = "Carousel and Text Block" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1,725 changes: 1,725 additions & 0 deletions
1,725
network-api/networkapi/mozfest/migrations/0033_adds_image_and_text_carousel.py
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
network-api/networkapi/mozfest/templates/fragments/blocks/carousel_text_block.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{% load wagtailcore_tags wagtailimages_tags %} | ||
|
||
{% block block_content %} | ||
<div class="tw-bg-black tw-dark tw-py-16"> | ||
<div class="tw-container"> | ||
<div class="tw-row tw-body"> | ||
<div> | ||
{% if self.heading %} | ||
<h2>{{ self.heading }}</h2> | ||
{% endif %} | ||
{{ self.text|richtext }} | ||
{% if self.link_url and self.link_label %} | ||
<a href="{{ self.link_url }}">{{ self.link_label }}</a> | ||
{% endif %} | ||
</div> | ||
<div> | ||
<ul> | ||
{% for slide in self.carousel_images %} | ||
<li><img width="auto" height="auto" src="{{ slide.image.file.url }}" alt="{{ slide.altText }}"></li> | ||
{% endfor %} | ||
</ul> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
{% endblock block_content %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters