Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes Drag&drop list sorting not being updated correctly on the first try #356

Merged
merged 4 commits into from
Nov 18, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ There's a frood who really knows where his towel is.
matches the css of the theme that you are using on your site.
[warpr, maurits]

- The reodering of list items is now immediately reflected in the DOM. (closes `#351`_).
[href]


1.0a6 (2013-11-12)
^^^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -359,6 +362,7 @@ There's a frood who really knows where his towel is.
.. _`#323`: https://github.com/collective/collective.cover/issues/323
.. _`#339`: https://github.com/collective/collective.cover/issues/339
.. _`#342`: https://github.com/collective/collective.cover/issues/342
.. _`#351`: https://github.com/collective/collective.cover/issues/351
.. _`#35`: https://github.com/collective/collective.cover/issues/35
.. _`#48`: https://github.com/collective/collective.cover/issues/48
.. _`PloneFormGen`: https://pypi.python.org/pypi/Products.PloneFormGen
1 change: 1 addition & 0 deletions CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ the following people:
- Carlos de la Guardia
- Cleber J. Santos
- Davi Lima
- Denis Krienbühl
- Érico Andrei
- Franco Pellegrini
- Fulvio Casali
Expand Down
28 changes: 28 additions & 0 deletions src/collective/cover/tests/test_list_tile.robot
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ ${link_selector} .ui-draggable .contenttype-link
${news-item_selector} .ui-draggable .contenttype-news-item
${tile_selector} div.tile-container div.tile

${first_item} .list-item:first-child
${last_item} .list-item:last-child

*** Test cases ***

Test List Tile
Expand Down Expand Up @@ -67,6 +70,31 @@ Test List Tile
Page Should Contain Test link
Page Should Contain Test news item

# reorder list items
Compose Cover

# check the existing order
${first_item_title} = Get Text css=${first_item} h2
${last_item_title} = Get Text css=${last_item} h2
Should Be Equal ${first_item_title} My document
Should Be Equal ${last_item_title} Test news item

# move first item to the end

# Selenium doesn't seem to handle drag&drop correctly if the
# drop-target is not in the viewport. This code tries to work
# around the issue.
Execute Javascript window.scroll(0, 800)

Drag And Drop css=${first_item} css=${last_item}
Sleep 1s Wait for reordering to occur

# ensure that the reodering is reflected in the DOM
${first_item_title} = Get Text css=${first_item} h2
${last_item_title} = Get Text css=${last_item} h2
Should Be Equal ${first_item_title} My file
Should Be Equal ${last_item_title} My document

# delete the tile
Edit Cover Layout
Delete Tile
Expand Down
5 changes: 4 additions & 1 deletion src/collective/cover/tiles/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ def results(self):
:returns: a list of objects.
"""
self.set_limit()
uuids = self.data.get('uuids', None)

# always get the latest data
uuids = ITileDataManager(self).get().get('uuids', None)

result = []
if uuids:
uuids = [uuids] if type(uuids) == str else uuids
Expand Down