Skip to content

Commit

Permalink
MDL-59759 core_user: Use SAVE_CANCEL modal for unenrol dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
junpataleta committed Sep 4, 2017
1 parent 23356f4 commit 7800e68
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion user/amd/build/status_field.min.js

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

19 changes: 10 additions & 9 deletions user/amd/src/status_field.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,18 +145,19 @@ define(['core/templates',
}
];

$.when(Str.get_strings(strings)).then(function(results) {
var deleteModalPromise = ModalFactory.create({
type: ModalFactory.types.SAVE_CANCEL
});

$.when(Str.get_strings(strings), deleteModalPromise).done(function(results, modal) {
var title = results[0];
var confirmMessage = results[1];
return ModalFactory.create({
body: confirmMessage,
large: true,
title: title,
type: ModalFactory.types.CONFIRM
});
}).done(function(modal) {
modal.setTitle(title);
modal.setBody(confirmMessage);
modal.setSaveButtonText(title);

// Handle confirm event.
modal.getRoot().on(ModalEvents.yes, function() {
modal.getRoot().on(ModalEvents.save, function() {
// Build params.
var unenrolParams = {
confirm: 1,
Expand Down
2 changes: 1 addition & 1 deletion user/tests/behat/edit_user_enrolment.feature
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Feature: Edit user enrolment
And I am on "Course 1" course homepage
And I navigate to course participants
When I click on "Unenrol" "icon" in the "student1" "table_row"
And I click on "Yes" "button"
And I click on "Unenrol" "button" in the ".modal-footer" "css_element"
Then I should not see "Student 1" in the "participants" "table"

@javascript
Expand Down

0 comments on commit 7800e68

Please sign in to comment.