Fix focal point data being localized

pull/12099/head
SebCorbin 2024-07-19 12:17:10 +01:00 zatwierdzone przez Jake Howard
rodzic 5cc28acc56
commit 966f2df4ce
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 8198AEBFA7E86782
4 zmienionych plików z 16 dodań i 6 usunięć

Wyświetl plik

@ -47,6 +47,7 @@ Changelog
* Fix: Prevent incorrect menu ordering when order value is 0 (Ben Dickinson)
* Fix: Fix dynamic image serve view with certain backends (Sébastien Corbin)
* Fix: Show not allowed extension in error message (Sahil Jangra)
* Fix: Fix focal point chooser when localization enabled (Sébastien Corbin)
* Docs: Remove duplicate section on frontend caching proxies from performance page (Jake Howard)
* Docs: Document `restriction_type` field on PageViewRestriction (Shlomo Markowitz)
* Docs: Document Wagtail's bug bounty policy (Jake Howard)

Wyświetl plik

@ -70,6 +70,7 @@ This feature was developed by Albina Starykova and sponsored by The Motley Fool.
* Prevent incorrect menu ordering when order value is 0 (Ben Dickinson)
* Fix dynamic image serve view with certain backends (Sébastien Corbin)
* Show not allowed extension in error message (Sahil Jangra)
* Fix focal point chooser when localization enabled (Sébastien Corbin)
### Documentation

Wyświetl plik

@ -51,10 +51,10 @@
<div
class="focal-point-chooser"
style="max-width: {{ rendition.width }}px; max-height: {{ rendition.height }}px;"
data-focal-point-x="{{ image.focal_point_x|default_if_none:'' }}"
data-focal-point-y="{{ image.focal_point_y|default_if_none:'' }}"
data-focal-point-width="{{ image.focal_point_width|default_if_none:'' }}"
data-focal-point-height="{{ image.focal_point_height|default_if_none:'' }}"
data-focal-point-x="{{ image.focal_point_x|default_if_none:''|unlocalize }}"
data-focal-point-y="{{ image.focal_point_y|default_if_none:''|unlocalize }}"
data-focal-point-width="{{ image.focal_point_width|default_if_none:''|unlocalize }}"
data-focal-point-height="{{ image.focal_point_height|default_if_none:''|unlocalize }}"
data-focal-input-label="{% trans 'Image focal point' %}"
>
<img {{ rendition.attrs }} decoding="async" data-original-width="{{ image.width|unlocalize }}" data-original-height="{{ image.height|unlocalize }}" class="show-transparency">

Wyświetl plik

@ -1264,12 +1264,20 @@ class TestImageEditView(WagtailTestUtils, TestCase):
def test_no_thousand_separators_in_focal_point_editor(self):
large_image = Image.objects.create(
title="Test image",
file=get_test_image_file(size=(1024, 768)),
file=get_test_image_file(size=(3840, 2160)),
focal_point_x=2048,
focal_point_y=1001,
focal_point_width=1009,
focal_point_height=1002,
)
response = self.client.get(
reverse("wagtailimages:edit", args=(large_image.id,))
)
self.assertContains(response, 'data-original-width="1024"')
self.assertContains(response, 'data-original-width="3840"')
self.assertContains(response, 'data-focal-point-x="2048"')
self.assertContains(response, 'data-focal-point-y="1001"')
self.assertContains(response, 'data-focal-point-width="1009"')
self.assertContains(response, 'data-focal-point-height="1002"')
@override_settings(WAGTAILIMAGES_IMAGE_MODEL="tests.CustomImage")
def test_unique_together_validation_error(self):