Add 'only' to prevent action_url from leaking into header.html's context and creating a spurious action button

Have confirmed that this doesn't strip out any context variables that we do rely on - IndexView is the only thing descending from the generic base template which customises the header beyond title/subtitle/icon, and it does that by explicitly passing parameters to `include`, not by having them floating around in the template context.
pull/7362/head
Matt Westcott 2021-08-24 17:34:00 +01:00 zatwierdzone przez LB Johnston
rodzic 433fc29479
commit eca0e2d413
4 zmienionych plików z 5 dodań i 5 usunięć

Wyświetl plik

@ -5,7 +5,7 @@
{% block content %}
{% block header %}
{% include "wagtailadmin/shared/header.html" with title=page_title subtitle=page_subtitle icon=header_icon %}
{% include "wagtailadmin/shared/header.html" with title=page_title subtitle=page_subtitle icon=header_icon only %}
{% endblock %}
<div class="nice-padding">

Wyświetl plik

@ -6,9 +6,9 @@
{% block content %}
{% if can_add %}
{% url view.add_url_name as add_link %}
{% include "wagtailadmin/shared/header.html" with title=page_title subtitle=page_subtitle action_url=add_link action_text=view.add_item_label icon=header_icon %}
{% include "wagtailadmin/shared/header.html" with title=page_title subtitle=page_subtitle action_url=add_link action_text=view.add_item_label icon=header_icon only %}
{% else %}
{% include "wagtailadmin/shared/header.html" with title=page_title subtitle=page_subtitle icon=header_icon %}
{% include "wagtailadmin/shared/header.html" with title=page_title subtitle=page_subtitle icon=header_icon only %}
{% endif %}
{% block listing %}

Wyświetl plik

@ -24,7 +24,7 @@
{% endblock %}
{% block content %}
{% include "wagtailadmin/shared/header.html" with title=view.page_title icon=view.header_icon merged=1 %}
{% include "wagtailadmin/shared/header.html" with title=view.page_title icon=view.header_icon merged=1 only %}
<form action="{{ view.get_add_url }}" enctype="multipart/form-data" method="POST" novalidate>
{% csrf_token %}

Wyświetl plik

@ -13,7 +13,7 @@
{% block content %}
{% trans "Add group" as add_group_str %}
{% include "wagtailadmin/shared/header.html" with title=add_group_str icon="group" %}
{% include "wagtailadmin/shared/header.html" with title=add_group_str icon="group" only %}
<div class="nice-padding">
<form action="{% url 'wagtailusers_groups:add' %}" method="POST" novalidate>