kopia lustrzana https://github.com/wagtail/wagtail
Convert breadcrumb.html include into a custom tag
rodzic
44508fd7bb
commit
2a76a30e7b
|
@ -8,7 +8,7 @@
|
|||
{% block content %}
|
||||
|
||||
<header class="merged tab-merged nice-padding">
|
||||
{% include "wagtailadmin/shared/breadcrumb.html" with page=parent_page include_self=1 %}
|
||||
{% explorer_breadcrumb parent_page include_self=1 %}
|
||||
|
||||
<div class="row row-flush">
|
||||
<div class="left col9">
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
{% block content %}
|
||||
{% page_permissions page as page_perms %}
|
||||
<header class="merged tab-merged nice-padding">
|
||||
{% include "wagtailadmin/shared/breadcrumb.html" with page=page %}
|
||||
{% explorer_breadcrumb page %}
|
||||
|
||||
<div class="row row-flush">
|
||||
<div class="left col9">
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<header class="merged no-border nice-padding no-v-padding">
|
||||
<h1 class="visuallyhidden">Explorer</h1>
|
||||
|
||||
{% include "wagtailadmin/shared/breadcrumb.html" with page=parent_page %}
|
||||
{% explorer_breadcrumb parent_page %}
|
||||
</header>
|
||||
|
||||
<form id="page-reorder-form">
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
{% load i18n %}
|
||||
|
||||
<ul class="breadcrumb">
|
||||
{% for page in page.get_ancestors %}
|
||||
{% for page in pages %}
|
||||
{% if page.is_root %}
|
||||
<li class="home"><a href="{% url 'wagtailadmin_explore_root' %}" class="icon icon-home text-replace">{% trans 'Home' %}</a></li>
|
||||
{% else %}
|
||||
<li><a href="{% url 'wagtailadmin_explore' page.id %}">{{ page.get_admin_display_title }}</a></li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if include_self %}
|
||||
<li><a href="{% url 'wagtailadmin_explore' page.id %}">{{ page.get_admin_display_title }}</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
|
|
@ -55,6 +55,13 @@ def main_nav(context):
|
|||
}
|
||||
|
||||
|
||||
@register.inclusion_tag('wagtailadmin/shared/breadcrumb.html')
|
||||
def explorer_breadcrumb(page, include_self=False):
|
||||
return {
|
||||
'pages': page.get_ancestors(inclusive=include_self)
|
||||
}
|
||||
|
||||
|
||||
@register.inclusion_tag('wagtailadmin/shared/search_other.html', takes_context=True)
|
||||
def search_other(context, current=None):
|
||||
request = context['request']
|
||||
|
|
Ładowanie…
Reference in New Issue