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

Fix sortable elements #2750

Merged
merged 2 commits into from
Feb 27, 2024
Merged

Conversation

tvdeyen
Copy link
Member

@tvdeyen tvdeyen commented Feb 27, 2024

What is this pull request for?

1. Fix sorting of nested elements of freshly created elements
Make sure that nested elements of all elements get initialized as sortable after being created, not just fixed.

2. Avoid sending sort events twice
SortableJS sends two events if you drag an element from one nesteable elements container to another. Leading to incrementing the target lists positions to high.

Since acts_as_list maintains both lists correctly we can simply suppress the second event on the source list.

Checklist

Make sure that nested elements of all elements get initialized
as sortable after being created, not just fixed.
SortableJS sends two events if you drag an element from one
nesteable elements container to another. Leading to incrementing
the target lists positions to high.

Since acts_as_list maintains both lists correctly we can simply
suppress the second event on the source list.
@tvdeyen tvdeyen added backport-to-7.1-stable Needs to be backported to 7.1-stable bug labels Feb 27, 2024
@tvdeyen tvdeyen requested a review from a team February 27, 2024 08:02
@tvdeyen tvdeyen enabled auto-merge February 27, 2024 08:02
@tvdeyen tvdeyen merged commit bd8ca2a into AlchemyCMS:main Feb 27, 2024
36 checks passed
@tvdeyen tvdeyen deleted the fix-sortable-elements branch February 27, 2024 09:06
@alchemycms-bot
Copy link
Collaborator

💚 All backports created successfully

Status Branch Result
7.1-stable

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

tvdeyen added a commit that referenced this pull request Feb 27, 2024
[7.1-stable] Merge pull request #2750 from tvdeyen/fix-sortable-elements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-to-7.1-stable Needs to be backported to 7.1-stable bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants