kopia lustrzana https://github.com/wagtail/wagtail
Don't use page admin title when editing rich text (#5491)
When editing a rich text field and entering a link to a page whose Page type overrides get_admin_display_title, the custom admin display title is used both when browsing to select the page to link to and also when viewing the rich text editor. The first behavior is consistent with how custom admin display titles are used throughout the admin, but the second behavior is not. The Wagtail user should be able to use the rich text field as a reasonable preview of what the rendered content will look like for the end user. To do this, the "real" page title should be used, not the admin one. This commit alters the data that gets passed to the rich text editor so that its title is the real page title and not the admin one. Fixes issue 5131.pull/5501/head
rodzic
ada652f19f
commit
52b01cda67
|
@ -14,6 +14,7 @@ Changelog
|
|||
* Fix: Prevent exception when deleting a model with a protected One-to-one relationship (Neal Todd)
|
||||
* Fix: Added labels to snippet bulk edit checkboxes for screen reader users (Martey Dodoo)
|
||||
* Fix: Middleware responses during page preview are now properly returned to the user (Matt Westcott)
|
||||
* Fix: Default text of page links in rich text uses the public page title rather than the admin display title (Andy Chosak)
|
||||
|
||||
|
||||
2.6.1 (05.08.2019)
|
||||
|
|
|
@ -32,6 +32,7 @@ Bug fixes
|
|||
* Prevent exception when deleting a model with a protected One-to-one relationship (Neal Todd)
|
||||
* Added labels to snippet bulk edit checkboxes for screen reader users (Martey Dodoo)
|
||||
* Middleware responses during page preview are now properly returned to the user (Matt Westcott)
|
||||
* Default text of page links in rich text uses the public page title rather than the admin display title (Andy Chosak)
|
||||
|
||||
|
||||
Upgrade considerations
|
||||
|
|
|
@ -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.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>
|
||||
<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>
|
||||
{% else %}
|
||||
{{ page.get_admin_display_title }}
|
||||
{% endif %}
|
||||
|
|
|
@ -208,7 +208,13 @@ class TestChooserBrowseChild(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(response.status_code, 200)
|
||||
self.assertTemplateUsed(response, 'wagtailadmin/chooser/browse.html')
|
||||
|
||||
self.assertInHTML("foobarbaz (simple page)", response.json().get('html'))
|
||||
html = response.json().get('html')
|
||||
self.assertInHTML("foobarbaz (simple page)", html)
|
||||
|
||||
# The data-title attribute should not use the custom admin display title,
|
||||
# because JS code that uses that attribute (e.g. the rich text editor)
|
||||
# should use the real page title.
|
||||
self.assertIn('data-title="foobarbaz"', html)
|
||||
|
||||
def test_parent_with_admin_display_title(self):
|
||||
# Add another child under child_page so it renders a chooser list
|
||||
|
|
Ładowanie…
Reference in New Issue