Skip to content

Commit

Permalink
WEB-4041 : Handle new "carre" scale
Browse files Browse the repository at this point in the history
  • Loading branch information
boulch committed Jan 8, 2024
1 parent 22a3fae commit c03b680
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
1 change: 1 addition & 0 deletions src/imio/directory/core/contents/contact/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def get_scales(self, fieldname, request=None):
return [
"portrait_affiche",
"paysage_affiche",
"carre_affiche",
]
return []

Expand Down
4 changes: 3 additions & 1 deletion src/imio/directory/core/subscribers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions src/imio/directory/core/tests/test_cropping.py
Original file line number Diff line number Diff line change
Expand Up @@ -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), [])

Expand All @@ -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())

0 comments on commit c03b680

Please sign in to comment.