kopia lustrzana https://github.com/wagtail/wagtail
Use get_admin_display_title in PageChooserPanel
rodzic
0c6815910b
commit
61e8173625
|
@ -26,6 +26,7 @@ Changelog
|
|||
* Fix: Revise `edit_handler` bind order in ModelAdmin views and fix duplicate form instance creation (Jérôme Lebleu)
|
||||
* Fix: Properly distinguish child blocks when comparing revisions with nested StreamBlocks (Martin Mena)
|
||||
* Fix: Correctly handle Turkish 'İ' characters in client-side slug generation (Matt Westcott)
|
||||
* Fix: Page chooser widgets now reflect custom ``get_admin_display_title`` methods (Saptak Sengupta)
|
||||
|
||||
|
||||
2.10.2 (25.09.2020)
|
||||
|
|
|
@ -40,6 +40,7 @@ Bug fixes
|
|||
* Revise ``edit_handler`` bind order in ModelAdmin views and fix duplicate form instance creation (Jérôme Lebleu)
|
||||
* Properly distinguish child blocks when comparing revisions with nested StreamBlocks (Martin Mena)
|
||||
* Correctly handle Turkish 'İ' characters in client-side slug generation (Matt Westcott)
|
||||
* Page chooser widgets now reflect custom ``get_admin_display_title`` methods (Saptak Sengupta)
|
||||
|
||||
|
||||
Upgrade considerations
|
||||
|
|
|
@ -26,7 +26,7 @@ function createPageChooser(id, pageTypes, openAtParentId, canChooseRoot, userPer
|
|||
pageChosen: function(pageData) {
|
||||
input.val(pageData.id);
|
||||
openAtParentId = pageData.parentId;
|
||||
pageTitle.text(pageData.title);
|
||||
pageTitle.text(pageData.adminTitle);
|
||||
chooserElement.removeClass('blank');
|
||||
editLink.attr('href', pageData.editUrl);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ Expects a variable 'page', the page instance.
|
|||
|
||||
<div class="title-wrapper">
|
||||
{% if page.can_choose %}
|
||||
<a class="choose-page" href="#{{ page.id|unlocalize }}" data-id="{{ page.id|unlocalize }}" data-title="{{ page.title }}" data-url="{{ page.url }}" data-parent-id="{{ page.get_parent.id|unlocalize }}" data-edit-url="{% url 'wagtailadmin_pages:edit' page.id %}">{{ page.get_admin_display_title }}</a>
|
||||
<a class="choose-page" href="#{{ page.id|unlocalize }}" data-id="{{ page.id|unlocalize }}" data-title="{{ page.title }}" data-admin-title="{{ page.get_admin_display_title }}" data-url="{{ page.url }}" data-parent-id="{{ page.get_parent.id|unlocalize }}" data-edit-url="{% url 'wagtailadmin_pages:edit' page.id %}">{{ page.get_admin_display_title }}</a>
|
||||
{% else %}
|
||||
{{ page.get_admin_display_title }}
|
||||
{% endif %}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{% extends "wagtailadmin/widgets/chooser.html" %}
|
||||
|
||||
{% block chosen_state_view %}
|
||||
<span class="title">{{ page.get_admin_display_title }}</span>
|
||||
<span class="title">{{ page.specific.get_admin_display_title }}</span>
|
||||
{% endblock %}
|
||||
|
||||
{% block edit_chosen_item_url %}{% if page %}{% url 'wagtailadmin_pages:edit' page.id %}{% endif %}{% endblock %}
|
||||
|
|
|
@ -50,6 +50,8 @@ class TestAdminPageChooserWidget(TestCase):
|
|||
|
||||
html = widget.render_html('test', self.child_page, {})
|
||||
self.assertInHTML("""<input name="test" type="hidden" value="%d" />""" % self.child_page.id, html)
|
||||
# SimplePage has a custom get_admin_display_title method which should be reflected here
|
||||
self.assertInHTML("foobarbaz (simple page)", html)
|
||||
|
||||
def test_render_js_init_with_value(self):
|
||||
widget = widgets.AdminPageChooser()
|
||||
|
|
Ładowanie…
Reference in New Issue