Skip to content
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

Add external page link to "Read next" sidebar on ResourcePage #3995

Merged
merged 4 commits into from
Aug 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion fec/home/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,8 @@ class ResourcePage(Page):
], null=True, blank=True)
sidebar_title = models.CharField(max_length=255, null=True, blank=True)
related_pages = StreamField([
('related_pages', blocks.ListBlock(blocks.PageChooserBlock()))
('related_pages', blocks.ListBlock(blocks.PageChooserBlock())),
('external_page', blocks.RichTextBlock()),
], null=True, blank=True)
sections = StreamField([
('sections', ResourceBlock())
Expand Down
12 changes: 8 additions & 4 deletions fec/home/templates/home/resource_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@
<aside class="sidebar sidebar--secondary">
<h4 class="sidebar__title">{{ self.sidebar_title }}</h4>
<ul class="sidebar__content">
{% for related_pages in self.related_pages %}
{% for related_page in related_pages.value %}
<li class="u-padding--bottom"><a href="{{ related_page.url }}">{{ related_page.title }}</a></li>
{% endfor %}
{% for related_page in self.related_pages %}
{% if related_page.block_type == "related_pages" %}
{% for related in related_page.value %}
<li class="u-padding--bottom"><a href="{{ related.url }}">{{ related.title }}</a></li>
{% endfor %}
{% else %}
<li class="u-padding--bottom">{{ related_page.value}}</li>
{% endif %}
{% endfor %}
</ul>
{% if self.show_search %}
Expand Down