The core/utility confirmation modal can be used in this case to confirm
backpack actions. It is not necessary to have a custom module for this
purpose.
This change includes some additional simplifications to support this
change, including conversion from done/fail to then/catch, and some
simplification of Promise usage.
There were a number of cases of nested Modal usage which have been
removed.
This commit includes some simplifications to the way in which some of
the modals are launched and allows us to remove several modules entirely
as they are no longer required following the simplification of the Modal
instantiation.
This commits adds a new static `create()` method to replace the existing
ModalFactory.create approach.
This allows the creation of a modal to now be simplified to:
```js
import SomeModalClass from 'mymodule/wherever';
// ...
const modal = await SomeModalClass.create();
```
Prior to this change the modal was instantiated via the ModalFactory,
but the Type of modal was typically pulled from the ModalClass itself
via the registry. Essentially it used to require three modules to
instantiate a single Modal, and now it takes just one.
This change moves configuration of the modal from the ModalFactory to
a new `configure` function on the Modal class which does exactly the
same thing. This means that the API is fully encapsulated within the
Modal, and an individual Modal can specify its own configuration more
easily.
This change will make it much easier to instantiate new modals,
significantly reducing boilerplate in many instances.
This change allows modals to extend the `configure()` method to provide
their own defaults, or to override standard ones.
```js
class MyModal extends Modal {
static TYPE = 'my_module/mymodal';
static TEMPLATE = 'my_module/mymodal';
configure(params = {}) {
// Override the default value for large.
params.large = true;
super.configure(params);
// Handle our own properties here.
const {
makeSound = true,
} = params;
this.setSoundEmitter(makeSound);
}
```
Prior to this change, it was common to see this happen in the _calling_
code, rather than the modal itself.
* When toggling bulk editing, updating the page's title can help users,
especially screen reader users, to determine the current editing state
of the course homepage.