Skip to content

Commit

Permalink
MDL-59365 enrol: Use standard modal
Browse files Browse the repository at this point in the history
Replace the custom footer with a standard modal.
  • Loading branch information
Damyon Wiese authored and danpoltawski committed Jul 11, 2017
1 parent 394e73f commit d77c73a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion enrol/manual/amd/build/quickenrolment.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 13 additions & 4 deletions enrol/manual/amd/src/quickenrolment.js
Expand Up @@ -59,21 +59,30 @@ define(['core/templates',
QuickEnrolment.prototype.initModal = function() {
var triggerButtons = $('.enrolusersbutton.enrol_manual_plugin [type="submit"]');

Str.get_string('enrolusers', 'enrol_manual').then(function(modalTitle) {
var strparams = [
{key: 'enroluserscohorts', component: 'enrol_manual'},
{key: 'enrolusers', component: 'enrol_manual'}
];

$.when(Str.get_strings(strparams)).then(function(strlist) {
var modalSaveChanges = strlist[0],
modalTitle = strlist[1];

return ModalFactory.create({
type: ModalFactory.types.SAVE_CANCEL,
title: modalTitle,
body: this.getBody(),
footer: this.getFooter()
body: this.getBody()
}, triggerButtons).then(function(modal) {
this.modal = modal;
this.modal.setLarge();
this.modal.setSaveButtonText(modalSaveChanges);

// We want the reset the form every time it is opened.
this.modal.getRoot().on(ModalEvents.hidden, function() {
this.modal.setBody(this.getBody());
}.bind(this));

this.modal.getFooter().on('click', '[data-action="submit"]', this.submitForm.bind(this));
this.modal.getRoot().on(ModalEvents.save, this.submitForm.bind(this));
this.modal.getRoot().on('submit', 'form', this.submitFormAjax.bind(this));
}.bind(this));
}.bind(this)).fail(Notification.exception);
Expand Down
2 changes: 0 additions & 2 deletions enrol/manual/templates/enrol_modal_footer.mustache

This file was deleted.

0 comments on commit d77c73a

Please sign in to comment.