Now that the preview sizes are customizable, we can't rely on the
default being the mobile size when we want to force the size of the
preview unavailable screen.
It was popped from the menu_items, so it's not in that list when we loop
through to collect the media files.
And add an early return if the default item is undefined (e.g. if a
construct hook caused the list to be empty), so it doesn't crash when it
tries to render to action menu.
and reuse the markup for footer actions.
With this commit, all form footer actions are now using the single
implementation in generic/form.html template.
This allows us to reuse more markup from the generic templates,
including the code for footer actions dropdown. This also gives us the
unsaved changes warning to these views.
This gives us the disabled button with spinner upon clicking, as well as
the ability to use ctrl+s to save.
Note that we do not introduce a custom label for the in-progress state
of the button yet.
With this added, we can now simplify the overrides in snippets templates
for the footer actions to only override the action buttons to use the
class component.
This now gives us the dropdown button for the footer actions in most
areas of the admin:
- Generic views (ModelViewSets)
- Images
- Documents
- Sites
- Locales
- Collections
- Redirects (edit view, create view TBC)
The following areas have footer actions with their own implementation,
and will be refactored in subsequent commits:
- Workflows
- Workflow tasks
- Settings
The following areas need further work before it can use footer actions,
as they still use function-based view and may not work with the generic
templates yet:
- Redirects create view
- Search promotions
Lastly, for pages and snippets, they have their own footer actions
implementation for now because they use the ActionMenu class components.
Despite this, we also want to move the 'Delete' action to the header
'more' actions dropdown rather than the footer actions. This means we'll
get rid of the extra_actions block in generic/edit.html template in the
next commit. However, we'll keep the actual dropdown markup in
generic/form.html as it's still going to be needed by the workflows and
tasks edit templates to show the enable/disable buttons.