We have mostly standardised on passing an "aria-label" attribute when constructing buttons. However, _dropdown_items.html was still trying to pull this from 'title' when producing its own rendering of the button (probably because you can't write `{{ button.attrs.aria-label }}` in a template...) which meant that the original aria-label attribute wasn't being passed through. Fix this so that we consistently expect an aria-label attribute everywhere, and correct for this in the base Button class if a 'title' attribute has been passed instead.
- The live_object and scheduled_object are never used directly in the
templates.
- The page_perms is no longer used in the template when user_can_lock and
user_can_unlock were added in the view in
fb6d3262ad.
- There has been a long enough time since features were introduced in
snippets so we can drop the page-specific translatable strings in
favour of the generic ones.
It's never used directly in the template. The value that is used in the
side_panels.html template does not come from this parameter, because
that is a wrapper template and not the status panel itself. Instead, the
value is passed when the template is included, i.e. {% include ...
in_explorer=True %}.
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