Before the introduction of the side panels, the locale selector is
displayed in the header, with the context values resolved in the view.
When side panels were introduced, these values are resolved in the
status side panel component, but some of the logic (e.g. allowing the
locale selection when creating a page at the root level) was lost. In
addition, the resolved values in the view were left unused, which means
that we had a duplicate query for the translations that was unused.
This refactoring reintroduces the ability to select the locale when
creating a page at the root level and eliminates the duplicate query.
This was extracted from PageSidePanels in 80643e0680
and the code to maintain the ordering based on the order attribute was
added in c6e6f46c29 (previously the order
attribute did nothing) and the test was added in
291538ca1d. All of these were added just
for the sake of making use of the order attribute that isn't really
necessary because we never had the ability to customise the side panels
and it actually was just a leftover from copy-pasting the action menu code.
Now that the side panels and the order are defined directly in the view,
we can safely remove this code.
The intermediary class isn't very useful and only adds complexities, as
we have to pass the data to be used by each side panel through it even
if only one of them uses the data (e.g. live_object, scheduled_object
that are only used by the status side panel. It also made parameters
like preview_enabled and comments_enabled necessary when the view
could've determined which side panels to use in the first place.
- Built on original PR #7372 and feedback on that solution
- Add unit tests and documentation
- Fix typo in API documentation for `CustomPagesAPIViewSet`
- Ensure that pk is used (not id) while filtering to prevent assumption that id is pk
- Rename template tag variable toggle_tippy_offset to toggle_tooltip_offset
- Update usage in the dropdown template to use as a Stimulus data attribute variable instead of a data-tippy attribute on the inner button element
This brings the side_panel_toggles.html and side_panels.html includes
closer together (in the same slim_header.html file), which makes sense
as you'd only use the side panels when the slim header (with the
breadcrumbs) is used.