Merge pull request #6936 from KalobTaulien/breadcrumb

Show current page in breadcrumb
pull/6762/head
Kalob Taulien 2021-03-26 10:45:45 -06:00 zatwierdzone przez GitHub
commit 4b6b1f23bd
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
3 zmienionych plików z 10 dodań i 3 usunięć

Wyświetl plik

@ -8,7 +8,7 @@
{% block content %}
<header class="merged tab-merged">
{% explorer_breadcrumb parent_page include_self=1 %}
{% explorer_breadcrumb parent_page include_self=1 trailing_arrow=True %}
<div class="row">
<div class="left col9 header-title">

Wyświetl plik

@ -11,6 +11,12 @@
{# For limited-permission users whose breadcrumb starts further down from the root, the first item displays as a 'home' icon in place of the title #}
{% trans 'Home' as home %}
<li class="home"><a href="{% url 'wagtailadmin_explore' page.id %}" class="text-replace">{% icon name="site" class_name="home_icon" title=home %}</a>{% icon name="arrow-right" class_name="arrow_right_icon"%}</li>
{% elif forloop.last %}
<li><a href="{% url 'wagtailadmin_explore' page.id %}"><span class="title">{{ page.get_admin_display_title }}</span>
{% if trailing_arrow %}
{% icon name="arrow-right" class_name="arrow_right_icon" %}
{% endif %}
</a></li>
{% else %}
<li><a href="{% url 'wagtailadmin_explore' page.id %}"><span class="title">{{ page.get_admin_display_title }}</span>{% icon name="arrow-right" class_name="arrow_right_icon" %}</a></li>
{% endif %}

Wyświetl plik

@ -65,7 +65,7 @@ def main_nav(context):
@register.inclusion_tag('wagtailadmin/shared/breadcrumb.html', takes_context=True)
def explorer_breadcrumb(context, page, include_self=False):
def explorer_breadcrumb(context, page, include_self=True, trailing_arrow=False):
user = context['request'].user
# find the closest common ancestor of the pages that this user has direct explore permission
@ -75,7 +75,8 @@ def explorer_breadcrumb(context, page, include_self=False):
return {'pages': Page.objects.none()}
return {
'pages': page.get_ancestors(inclusive=include_self).descendant_of(cca, inclusive=True).specific()
'pages': page.get_ancestors(inclusive=include_self).descendant_of(cca, inclusive=True).specific(),
'trailing_arrow': trailing_arrow
}