mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-03-16 22:10:28 +00:00
The order of nested InlinePanels (recently formally added in 5566) doesn't get saved properly due to some now-invalid assumptions in the JS selector code. Currently, Wagtail users can use the editor up/down arrows to order InlinePanel elements that contain child InlinePanels, but these may not be properly saved. Before InlinePanel nesting was supported, it was a safer bet that a child panel would only contain one hidden input named "-ORDER". With nesting, however, a parent panel will also contain hidden inputs named like this for its child panels. This breaks the logic used in the ordering code. This change modifies the logic to use the jQuery `.children()` selector instead of `.next()`, ensuring that we reference the correct adjacent panel item. An easy way to test this against current master is to use the Wagtail testapp test models that exercise this behavior: 1. `wagtail start testwagtail` to create a new project. 2. `cd testwagtail` 3. Edit testwagtail/settings/base.py to add the Wagtail test application `'wagtail.tests.testapp'` to the list of `INSTALLED_APPS`. For the admin to work properly with this app, you also need to add `'wagtail.contrib.settings'` to that list and copy the definition of `WAGTAILADMIN_RICH_TEXT_EDITORS` from wagtail/tests/settings.py. 4. `./manage.py migrate` to create your local database. 5. `./manage.py createsuperuser` to create an admin user. 6. Create a new Event Page (http://localhost:8000/admin/pages/add/tests/eventpage/3/). 7. Fill in all required items, and then add multiple speakers under "Speaker Lineup". For each speaker, add at least one Award. Save the page. 8. Try using the up/down arrows to reorder the speakers (the parent InlinePanel), and save the page. 9. Note that when the page reloads, the ordering hasn't been saved. If you debug using the developer tools, you'll notice that this is because the code being modified here selects the child panel items instead of the adjacent parent panel item. |
||
|---|---|---|
| .. | ||
| _static | ||
| advanced_topics | ||
| contributing | ||
| editor_manual | ||
| getting_started | ||
| reference | ||
| releases | ||
| topics | ||
| autobuild.sh | ||
| conf.py | ||
| favicon.ico | ||
| index.rst | ||
| logo.png | ||
| Makefile | ||
| README.md | ||
| requirements.txt | ||
| spelling_wordlist.txt | ||
| support.rst | ||
Wagtail docs
These are Sphinx docs, automatically built at https://docs.wagtail.io when the master branch is committed to Github. To build them locally, install Wagtail's development requirements (in the root Wagtail directory):
pip install -e .[testing,docs]
To build the documentation for browsing, from this directory run:
make html
then open _build/html/index.html in a browser.
To rebuild automatically while editing the documentation, from this directory run:
sphinx-autobuild . _build
The online editor at http://rst.ninjs.org/ is a helpful tool for checking reStructuredText syntax.