Skip to content

Commit

Permalink
Custom breadcrumbs for webcast pages, fixes #146
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgleason committed Dec 18, 2019
1 parent 91ca3d2 commit 0f5522e
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 2 deletions.
22 changes: 22 additions & 0 deletions project_tier/events/templates/events/tags/breadcrumbs.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{% load wagtailcore_tags %}

{% if ancestors %}
<nav class="breadcrumbs" aria-label="You are here:" role="navigation">
<ul>
{% for ancestor in ancestors %}
<li>
{% if forloop.last %}<span class="show-for-sr">Current: </span>{% endif %}
<a href="{% pageurl ancestor %}">
{% if ancestor.content_type|slugify == "webcast-index-page" %}
Webcasts
{% elif ancestor.content_type|slugify == "webcast-page" %}
{{ ancestor.specific.speaker_name }}
{% else %}
{{ ancestor }}
{% endif %}
</a>
</li>
{% endfor %}
</ul>
</nav>
{% endif %}
15 changes: 14 additions & 1 deletion project_tier/events/templates/events/webcast_index_page.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
{% extends "standard_sidebar_layout.html" %}
{% load wagtailcore_tags wagtailimages_tags %}
{% load wagtailcore_tags wagtailimages_tags navigation_tags %}

{% block page_banner %}
<header class="page-header">
<div class="row">
<div class="columns">
{% webcast_breadcrumbs %}
{% block page_title %}
<h1>{{self.title}}</h1>
{% endblock %}
</div>
</div>
</header>
{% endblock %}

{% block sidebar %}
<div>
Expand Down
15 changes: 14 additions & 1 deletion project_tier/events/templates/events/webcast_page.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
{% extends "standard_sidebar_layout.html" %}
{% load wagtailcore_tags wagtailimages_tags %}
{% load wagtailcore_tags wagtailimages_tags navigation_tags %}

{% block page_banner %}
<header class="page-header">
<div class="row">
<div class="columns">
{% webcast_breadcrumbs %}
{% block page_title %}
<h1>{{self.speaker_name}}</h1>
{% endblock %}
</div>
</div>
</header>
{% endblock %}

{% block sidebar %}
<div data-sticky-container>
Expand Down
5 changes: 5 additions & 0 deletions project_tier/home/templatetags/navigation_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ def breadcrumbs(context):
}


@register.inclusion_tag('events/tags/breadcrumbs.html', takes_context=True)
def webcast_breadcrumbs(context):
return breadcrumbs(context)


@register.inclusion_tag('tags/standard_index_listing.html', takes_context=True)
def standard_index_listing(context, calling_page):
pages = calling_page.get_children().live().specific()
Expand Down

0 comments on commit 0f5522e

Please sign in to comment.