Skip to content

Commit

Permalink
Merge branch 'master' into 6527-forms
Browse files Browse the repository at this point in the history
  • Loading branch information
fessehaye authored Aug 4, 2021
2 parents 8fd62ec + 3794bc8 commit b72315d
Show file tree
Hide file tree
Showing 12 changed files with 311 additions and 3 deletions.

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions network-api/networkapi/utility/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
from django.conf import settings

hostnames = settings.TARGET_DOMAINS

if len(hostnames) == 0:
print('Error: no TARGET_DOMAINS set, please ensure your environment variables are in order.')

referrer_value = 'same-origin'

if settings.REFERRER_HEADER_VALUE:
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
('double_image', customblocks.ArticleDoubleImageBlock()),
('full_width_image', customblocks.ArticleFullWidthImageBlock()),
('iframe', customblocks.iFrameBlock()),
('single_quote', customblocks.SingleQuoteBlock()),
('table', TableBlock(
template="wagtailpages/blocks/article_table_block.html"
)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
('profile_by_id', customblocks.ProfileById()),
('profile_directory', customblocks.ProfileDirectory()),
('recent_blog_entries', customblocks.RecentBlogEntries()),
('blog_set', customblocks.BlogSetBlock()),
('airtable', customblocks.AirTableBlock()),
('typeform', customblocks.TypeformBlock()),
]
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from .advanced_table_block import AdvancedTableBlock
from .annotated_image_block import AnnotatedImageBlock
from .airtable_block import AirTableBlock
from .blog_set_block import BlogSetBlock
from .bootstrap_spacer_block import BootstrapSpacerBlock
from .iframe_block import iFrameBlock
from .image_block import ImageBlock
Expand All @@ -16,6 +17,7 @@
from .recent_blog_entries import RecentBlogEntries
from .typeform_block import TypeformBlock
from .quote_block import QuoteBlock
from .single_quote_block import SingleQuoteBlock
from .video_block import VideoBlock
from .youtube_regret_block import YoutubeRegretBlock
from .articles import ArticleRichText, ArticleDoubleImageBlock, ArticleFullWidthImageBlock, ArticleImageBlock
Expand All @@ -30,6 +32,7 @@
ArticleImageBlock,
ArticleFullWidthImageBlock,
ArticleRichText,
BlogSetBlock,
BootstrapSpacerBlock,
DearInternetLetterBlock,
iFrameBlock,
Expand All @@ -45,6 +48,7 @@
ProfileDirectory,
PulseProjectList,
QuoteBlock,
SingleQuoteBlock,
RecentBlogEntries,
TypeformBlock,
VideoBlock,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
from wagtail.core import blocks
from wagtail.core.blocks import PageChooserBlock


class BlogSetBlock(blocks.StructBlock):
title = blocks.CharBlock()

top_divider = blocks.BooleanBlock(
required=False,
help_text='Optional divider above content block.',
)

bottom_divider = blocks.BooleanBlock(
required=False,
help_text='Optional divider below content block.',
)

blog_pages = blocks.ListBlock(PageChooserBlock(
target_model='wagtailpages.BlogPage'
))

def get_context(self, value, parent_context=None):
context = super().get_context(value, parent_context=parent_context)

context['entries'] = value.get("blog_pages", list())
context['more_entries'] = False
context['root'] = None

# Optional dividers
divider_styles = []
if value.get("top_divider"):
divider_styles.append('div-top-thick pt-4')
if value.get("bottom_divider"):
divider_styles.append('div-bottom-thick pb-4')
context['divider_styles'] = ' '.join(divider_styles)

return context

class Meta:
icon = 'grip'
template = 'wagtailpages/blocks/blog_set_block.html'
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from wagtail.core import blocks


class SingleQuoteBlock(blocks.StructBlock):

quote = blocks.CharBlock()
attribution = blocks.CharBlock(required=False)

class Meta:
template = 'wagtailpages/blocks/single_quote_block.html'
icon = 'openquote'
help_text = 'A single quote block'
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,8 @@ <h2>{{ page.contents_title }}</h2>
</div>
</div>
<div class="col-8 ml-sm-3{% if not child.get_children_count %} d-flex align-items-center{% endif %}">
<h3 class="{% if child.get_children_count %}publication-chapter-title{% else %}m-0 {% endif %}">
<a href="{{ child.url }}" class="d-block {% if child.get_children_count %}mb-4{% endif %}">
<h3 class="{% if child.get_children_count %}publication-chapter-title mb-4 {{% else %}m-0 {% endif %}">
{{ child.title }} {% if child.has_unpublished_changes %}🐣{% endif %}
</a>
</h3>
{% for grandchild in child_page.grandchildren %}
<h4 class="d-sm-block d-none body">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% extends "./recent_blog_entries.html" %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{% extends "./base_streamfield_block.html" %}
{% load wagtailcore_tags %}

{% block block_content %}
<div class="my-2">
<div class="feature-quote">
<h3>{{value.quote}}</h3>
<p class="h6-heading">{{value.attribution}}</p>
</div>
</div>
{% endblock %}

0 comments on commit b72315d

Please sign in to comment.