Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request converts the TreeModelAdmin UI to use Wagtail 4’s breadcrumb and header pattern, dropping support for Wagtail 3 and below’s admin UI. After this, Wagtail < 4 will no longer be supported.
With Wagtail 4's admin UI changes, I've gone with a pattern that's slightly less like the page tree itself, and more like how ModelAdmin and Snippets appear:
I noted in the comments, but While Wagtail includes a shared breadcrumb template, it doesn't seem possible to use the
wagtailadmin/shared/breadcrumbs.html
template for non-page-based breadcrumbs. The implementation here borrows heavily fromwagtailsnippets/snippets/headers/_base_header.html
, where the same style breadcrumbs are also re-implemented (and which contains a similar TODO).I've also changed the breadcrumb labeling a little bit. Prior to this change, breadcrumbs from our books example would follow this pattern:
Where the author name would link to the full list of authors, the book name would link to the list of books under the author, and the book’s volumes would exist under the model name itself. This change makes that same set of breadcrumbs appear as:
Where “Authors” links to the full list of authors, the author name links to the authors books, and the book title links to the book’s volumes. In converting the breadcrumbs to Wagtail 4, this seemed more natural.
Finally, I've updated the gif in the README demonstrating how the library works, and updated the versions in the README.
Checklist