MDL-77174 core_payment: Switch to utility modal

This commit is contained in:
Andrew Nicols
2023-07-31 10:56:22 +08:00
parent 715902c9c0
commit c6e987f525
2 changed files with 9 additions and 12 deletions
+5 -5
View File
@@ -65,8 +65,11 @@ foreach ($accounts as $account) {
$menu->add(new action_menu_link_secondary($account->get_edit_url(), null, get_string('edit')));
if (!$account->get('archived')) {
$deleteurl = $account->get_edit_url(['delete' => 1, 'sesskey' => sesskey()]);
$menu->add(new action_menu_link_secondary($deleteurl, null, get_string('deleteorarchive', 'payment'),
['data-action' => 'delete']));
$menu->add(new action_menu_link_secondary($deleteurl, null, get_string('deleteorarchive', 'payment'), [
'data-modal' => 'confirmation',
'data-modal-type' => 'delete',
'data-modal-content-str' => json_encode(['accountdeleteconfirm', 'payment']),
]));
} else {
$restoreurl = $account->get_edit_url(['restore' => 1, 'sesskey' => sesskey()]);
$menu->add(new action_menu_link_secondary($restoreurl, null, get_string('restoreaccount', 'payment')));
@@ -88,9 +91,6 @@ if (has_capability('moodle/site:config', context_system::instance())) {
echo html_writer::div(html_writer::table($table), 'position-relative');
$PAGE->requires->event_handler('[data-action=delete]', 'click', 'M.util.show_confirm_dialog',
array('message' => get_string('accountdeleteconfirm', 'payment')));
echo html_writer::div(html_writer::link(new moodle_url($PAGE->url, ['showarchived' => !$showarchived]),
$showarchived ? get_string('hidearchived', 'payment') : get_string('showarchived', 'payment')), 'mdl-right');
+4 -7
View File
@@ -16,9 +16,8 @@ Feature: Manage payment accounts
And I choose "Edit" in the open action menu
And I set the field "Account name" to "NewName"
And I press "Save changes"
And I should see "PayPal" in the "NewName" "table_row"
And I should not see "TestAccount"
And I log out
And I should see "PayPal" in the "NewName" "table_row"
@javascript
Scenario: Configuring gateways on payment accounts
@@ -37,9 +36,8 @@ Feature: Manage payment accounts
| Secret | Test |
| Enable | 1 |
And I press "Save changes"
And I should see "PayPal" in the "Account1" "table_row"
And I should not see "Not available" in the "Account1" "table_row"
And I log out
And I should see "PayPal" in the "Account1" "table_row"
@javascript
Scenario: Deleting payment accounts
@@ -51,10 +49,9 @@ Feature: Manage payment accounts
And I navigate to "Payments > Payment accounts" in site administration
And I open the action menu in "Account1" "table_row"
And I choose "Delete or archive" in the open action menu
And I click on "Yes" "button" in the "Confirmation" "dialogue"
And I click on "Yes" "button" in the "Confirm" "dialogue"
Then I should not see "Account1"
And I should see "Account2"
And I log out
@javascript
Scenario: Archiving and restoring accounts
@@ -73,7 +70,7 @@ Feature: Manage payment accounts
And I navigate to "Payments > Payment accounts" in site administration
And I open the action menu in "Account1" "table_row"
And I choose "Delete or archive" in the open action menu
And I click on "Yes" "button" in the "Confirmation" "dialogue"
And I click on "Yes" "button" in the "Confirm" "dialogue"
Then I should not see "Account1"
And I should see "Account2"
And I follow "Show archived"