kopia lustrzana https://github.com/wagtail/wagtail
Merge pull request #6936 from KalobTaulien/breadcrumb
Show current page in breadcrumbpull/6762/head
commit
4b6b1f23bd
wagtail/admin
templates/wagtailadmin
pages
shared
templatetags
|
@ -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">
|
||||
|
|
|
@ -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 %}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue