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 inline panel ordering #9149

Merged
merged 2 commits into from
Sep 6, 2022
Merged

Conversation

lb-
Copy link
Member

@lb- lb- commented Sep 6, 2022

  • Fixes Front-end reordering issue of orderables in Wagtail 4.0 & 4.0.1  #9145
  • Re-ordering was no longer working with the new DOM structure introduced by Update InlinePanel and StreamField styles for new designs #8983 / ca7f23d
  • Instead of using $.children use $.find to find the panel's input fields but ensure we still supported nested fields by finding based on the child panel's id
  • Note: This is intentionally two discrete commits, the first being the smallest code change to get this fix in (for cherry picking to 4.0 stable), the second commit is a start on a bit more robust unit tests and moving the code to an area that has better linting by default.
  • If merged we can create a new issue for enhancing these unit tests to cover the re-ordering bug and other basic behaviour.

  • Do the tests still pass?
  • Does the code comply with the style guide?
  • For front-end changes: Did you test on all of Wagtail’s supported environments? Chrome, Firefox, Safari all desktop on macOS

@squash-labs
Copy link

squash-labs bot commented Sep 6, 2022

Manage this branch in Squash

Test this branch here: https://lb-fix9145-inline-panel-orderi-sj54p.squash.io

Copy link
Collaborator

@gasman gasman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic here looks good to me - thanks for picking this up so quickly @lb-!

Just suggesting a small tweak out of paranoia over clashing child IDs (which is probably a reasonable default stance to take when it comes to this code :-) )

client/src/entrypoints/admin/page-editor.js Outdated Show resolved Hide resolved
- fixes wagtail#9145
- no longer working with the new DOM structure introduced by wagtail#8983  / ca7f23d
- instead of using `$.children` use `$.find` to find the panel's input fields but ensure we still supported nested fields by finding based on the child panel's id
- basic unit test is mostly a smoke test that the init functions get called
- add JSDOC to inlinePanel function body
- name some internal functions
@lb- lb- force-pushed the fix/9145-inline-panel-ordering branch from fa099bd to a58cb66 Compare September 6, 2022 14:24
@gasman gasman merged commit 174488a into wagtail:main Sep 6, 2022
gasman added a commit that referenced this pull request Sep 6, 2022
gasman added a commit that referenced this pull request Sep 6, 2022
@gasman
Copy link
Collaborator

gasman commented Sep 6, 2022

Merged in 174488a (main) and a5c1334 (stable/4.0.x - first commit only).

@gasman gasman added this to the 4.0.2 milestone Sep 6, 2022
@lb- lb- deleted the fix/9145-inline-panel-ordering branch September 6, 2022 22:18
@lb-
Copy link
Member Author

lb- commented Sep 6, 2022

Thanks @gasman

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Front-end reordering issue of orderables in Wagtail 4.0 & 4.0.1
2 participants