diff --git a/CHANGES.rst b/CHANGES.rst index 0056c4b7a..d35a79ce0 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -6,6 +6,9 @@ There's a frood who really knows where his towel is. 1.0a11 (unreleased) ^^^^^^^^^^^^^^^^^^^ +- Allow new empty carousel tiles to be edited in compose mode. (fixes `#472`_). + [fredvd] + - Add warning in the developer docs that switching the default grid system also means you should pay extra attention to the preset/saved cover layouts as these can contain invalid grid sizes. [fredvd] diff --git a/src/collective/cover/tests/test_carousel_tile.robot b/src/collective/cover/tests/test_carousel_tile.robot index 0965c5ba5..4a6348fad 100644 --- a/src/collective/cover/tests/test_carousel_tile.robot +++ b/src/collective/cover/tests/test_carousel_tile.robot @@ -43,6 +43,11 @@ Test Carousel Tile Compose Cover Page Should Contain This carousel is empty; open the content chooser and drag-and-drop some items here. + # Test if we can edit the cover without any content added to it yet + Click Link css=${edit_link_selector} + Page Should Contain Edit Carousel Tile + Click Button Cancel + # drag&drop an Image Open Content Chooser Click Element link=Content tree diff --git a/src/collective/cover/tiles/carousel.py b/src/collective/cover/tiles/carousel.py index 6bf4ea455..4f08108fb 100644 --- a/src/collective/cover/tiles/carousel.py +++ b/src/collective/cover/tiles/carousel.py @@ -173,6 +173,12 @@ def toWidgetValue(self, value): :type value: Dict :returns: A string with UUIDs separated by \r\n """ + + # A new carousel tile has no items, populate_with_uids has not been + # called yet, so incoming uuids is not an empty dict() but None + if value is None: + return '' + ordered_uuids = [(k, v) for k, v in value.items()] ordered_uuids.sort(key=lambda x: x[1]['order']) return '\r\n'.join([i[0] for i in ordered_uuids])