MDL-78324 core: Convert modals to use new static methods
This commit takes all modals which were not using the legacy ModalFactory.create triggers and migrates them to the new Modal.create method.
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
import {get_string} from 'core/str';
|
||||
import ModalFactory from 'core/modal_factory';
|
||||
import ModalSaveCancel from 'core/modal_save_cancel';
|
||||
import Templates from 'core/templates';
|
||||
import ModalEvents from 'core/modal_events';
|
||||
import Ajax from 'core/ajax';
|
||||
@@ -47,14 +47,15 @@ export const showModal = (users, callback = null) => {
|
||||
titlePromise = get_string('sendbulkmessage', 'core_message', users.length);
|
||||
}
|
||||
|
||||
return ModalFactory.create({
|
||||
type: ModalFactory.types.SAVE_CANCEL,
|
||||
return ModalSaveCancel.create({
|
||||
body: Templates.render('core_message/send_bulk_message', {}),
|
||||
title: titlePromise,
|
||||
show: true,
|
||||
buttons: {
|
||||
save: titlePromise,
|
||||
},
|
||||
})
|
||||
.then(function(modal) {
|
||||
modal.setSaveButtonText(titlePromise);
|
||||
|
||||
// When the dialog is closed, perform the callback (if provided).
|
||||
modal.getRoot().on(ModalEvents.hidden, function() {
|
||||
if (callback) {
|
||||
@@ -68,8 +69,6 @@ export const showModal = (users, callback = null) => {
|
||||
sendMessage(messageText, users);
|
||||
});
|
||||
|
||||
modal.show();
|
||||
|
||||
return modal;
|
||||
});
|
||||
};
|
||||
|
||||
@@ -27,7 +27,6 @@ define(['jquery',
|
||||
'core/custom_interaction_events',
|
||||
'core_message/notification_preference',
|
||||
'core_message/notification_processor_settings',
|
||||
'core/modal_factory',
|
||||
],
|
||||
function(
|
||||
$,
|
||||
@@ -36,7 +35,6 @@ define(['jquery',
|
||||
CustomEvents,
|
||||
NotificationPreference,
|
||||
NotificationProcessorSettings,
|
||||
ModalFactory
|
||||
) {
|
||||
|
||||
var SELECTORS = {
|
||||
@@ -156,9 +154,7 @@ define(['jquery',
|
||||
}
|
||||
}.bind(this));
|
||||
|
||||
var eventFormPromise = ModalFactory.create({
|
||||
type: NotificationProcessorSettings.TYPE,
|
||||
});
|
||||
var eventFormPromise = NotificationProcessorSettings.create({});
|
||||
|
||||
this.root.on(CustomEvents.events.activate, SELECTORS.PROCESSOR_SETTING, function(e, data) {
|
||||
var element = $(e.target).closest(SELECTORS.PROCESSOR_SETTING);
|
||||
@@ -175,7 +171,7 @@ define(['jquery',
|
||||
|
||||
e.stopImmediatePropagation();
|
||||
return;
|
||||
}).fail(Notification.exception);
|
||||
}).catch(Notification.exception);
|
||||
});
|
||||
|
||||
CustomEvents.define(disabledNotificationsElement, [
|
||||
|
||||
Reference in New Issue
Block a user