diff --git a/CHANGES.rst b/CHANGES.rst index aa6d4f0..e5fc75d 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,6 +5,9 @@ Changelog 1.2.3 (unreleased) ------------------ +- WEB-4041 : Handle new "carre" scale + [boulch] + - WEB-4007 : Update contact serializer and use ContactProperties to get well formated schedule and help displaying schedule in REACT directory view [boulch] diff --git a/src/imio/directory/core/contents/contact/content.py b/src/imio/directory/core/contents/contact/content.py index ca6f7e5..f291399 100644 --- a/src/imio/directory/core/contents/contact/content.py +++ b/src/imio/directory/core/contents/contact/content.py @@ -56,6 +56,7 @@ def get_scales(self, fieldname, request=None): return [ "portrait_affiche", "paysage_affiche", + "carre_affiche", ] return [] diff --git a/src/imio/directory/core/subscribers.py b/src/imio/directory/core/subscribers.py index 9dd5b98..1caa5f8 100644 --- a/src/imio/directory/core/subscribers.py +++ b/src/imio/directory/core/subscribers.py @@ -59,7 +59,9 @@ def modified_contact(obj, event): geocode_object(obj) elif "ILeadImageBehavior.image" in d.attributes: # we need to remove cropping information of previous image - remove_cropping(obj, "image", ["portrait_affiche", "paysage_affiche"]) + remove_cropping( + obj, "image", ["portrait_affiche", "paysage_affiche", "carre_affiche"] + ) def modified_entity(obj, event): diff --git a/src/imio/directory/core/tests/test_cropping.py b/src/imio/directory/core/tests/test_cropping.py index 621426c..1fbf745 100644 --- a/src/imio/directory/core/tests/test_cropping.py +++ b/src/imio/directory/core/tests/test_cropping.py @@ -37,7 +37,7 @@ def test_cropping_adapter(self): self.assertIsNotNone(adapter) self.assertEqual( adapter.get_scales("image", self.request), - ["portrait_affiche", "paysage_affiche"], + ["portrait_affiche", "paysage_affiche", "carre_affiche"], ) self.assertEqual(adapter.get_scales("logo", self.request), []) @@ -56,6 +56,6 @@ def test_cropping_view(self): (self.contact, self.request), name="croppingeditor" ) self.assertEqual(len(list(cropping_view._scales("logo"))), 0) - self.assertEqual(len(list(cropping_view._scales("image"))), 2) + self.assertEqual(len(list(cropping_view._scales("image"))), 3) self.assertNotIn("Logo", cropping_view()) self.assertIn("Lead Image", cropping_view())