Skip to content

Commit

Permalink
Merge pull request #3995 from fecgov/feature/3794-external-related-pa…
Browse files Browse the repository at this point in the history
…ge-ResourcePage

Add external page link to "Read next" sidebar on ResourcePage
  • Loading branch information
lbeaufort authored Aug 28, 2020
2 parents 915499f + 3ba51da commit 8823975
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
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

0 comments on commit 8823975

Please sign in to comment.