MDL-59759 core_user: Use SAVE_CANCEL modal for unenrol dialog
authorJun Pataleta <jun@moodle.com>
Tue, 8 Aug 2017 09:08:24 +0000 (17:08 +0800)
committerJun Pataleta <jun@moodle.com>
Mon, 4 Sep 2017 02:44:51 +0000 (10:44 +0800)
user/amd/build/status_field.min.js
user/amd/src/status_field.js
user/tests/behat/edit_user_enrolment.feature

index 565c8dd..c1743f5 100644 (file)
Binary files a/user/amd/build/status_field.min.js and b/user/amd/build/status_field.min.js differ
index 3e1303b..46cb8b6 100644 (file)
@@ -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,
index 1fe2b52..9c3f44b 100644 (file)
@@ -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