'Parent' link in page chooser search should not navigate away (#5011)

pull/5013/head
Asanka Lihiniyagoda 2019-01-29 17:28:12 +05:30 zatwierdzone przez Matt Westcott
rodzic 437f641977
commit 8c4b3fe669
7 zmienionych plików z 30 dodań i 5 usunięć

Wyświetl plik

@ -11,6 +11,7 @@ Changelog
* Fix: Validation error messages in `InlinePanel` no longer count towards `max_num` when disabling the 'add' button (Todd Dembrey, Thibaud Colas)
* Fix: Rich text to contentstate conversion now ignores stray closing tags (frmdstryr)
* Fix: Escape backslashes in `postgres_search` queries (Hammy Goonan)
* Fix: Parent page link in page chooser search results no longer navigates away (Asanka Lihiniyagoda, Sævar Öfjörð Magnússon)
2.4 (19.12.2018)

Wyświetl plik

@ -341,6 +341,7 @@ Contributors
* frmdstryr
* Aidarbek Suleimenov
* Matthew Linares
* Asanka Lihiniyagoda
Translators
===========

Wyświetl plik

@ -26,6 +26,7 @@ Bug fixes
* Validation error messages in ``InlinePanel`` no longer count towards ``max_num`` when disabling the 'add' button (Todd Dembrey, Thibaud Colas)
* Rich text to contentstate conversion now ignores stray closing tags (frmdstryr)
* Escape backslashes in ``postgres_search`` queries (Hammy Goonan)
* Parent page link in page chooser search results no longer navigates away (Asanka Lihiniyagoda, Sævar Öfjörð Magnússon)
Upgrade considerations

Wyświetl plik

@ -69,6 +69,11 @@ PAGE_CHOOSER_MODAL_ONLOAD_HANDLERS = {
$('.page-results', modal.body).load(this.href, ajaxifySearchResults);
return false;
});
/* Set up parent navigation links (.navigate-parent) to open in the modal */
$('.page-results a.navigate-parent', modal.body).on('click',function() {
modal.loadUrl(this.href);
return false;
});
}
function ajaxifyBrowseResults() {

Wyświetl plik

@ -55,13 +55,15 @@
{% endblock %}
</td>
{% if show_parent %}
{% with page.get_parent as parent %}
<td class="parent" valign="top">
{% if parent %}
<a href="{% url 'wagtailadmin_explore' parent.id %}">{{ parent.get_admin_display_title }}</a>
{% endif %}
{% block page_parent_page_title %}
{% with page.get_parent as parent %}
{% if parent %}
<a href="{% url 'wagtailadmin_explore' parent.id %}">{{ parent.get_admin_display_title }}</a>
{% endif %}
{% endwith %}
{% endblock %}
</td>
{% endwith %}
{% endif %}
<td class="updated" valign="top">{% if page.latest_revision_created_at %}<div class="human-readable-date" title="{{ page.latest_revision_created_at|date:"d M Y H:i" }}">{% blocktrans with time_period=page.latest_revision_created_at|timesince %}{{ time_period }} ago{% endblocktrans %}</div>{% endif %}</td>
<td class="type" valign="top">{{ page.content_type.model_class.get_verbose_name }}</td>

Wyświetl plik

@ -33,6 +33,10 @@
{% include "wagtailadmin/pages/listing/_page_title_choose.html" with page=page %}
{% endblock %}
{% block page_parent_page_title %}
{% include "wagtailadmin/pages/listing/_page_parent_page_title_choose.html" with page=page %}
{% endblock %}
{% block page_navigation %}
{% include "wagtailadmin/pages/listing/_navigation_choose.html" %}
{% endblock %}

Wyświetl plik

@ -0,0 +1,11 @@
{% comment %}
The parent field for a page in the page listing, when in 'choose' mode.
Expects a variable 'page', the page instance.
{% endcomment %}
{% with page.get_parent as parent %}
{% if parent %}
<a href="{% url 'wagtailadmin_choose_page_child' parent.id %}" class="navigate-parent">{{ parent.get_admin_display_title }}</a>
{% endif %}
{% endwith %}