Skip to content

Commit

Permalink
MDL-77174 core_payment: Switch to utility modal
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Jul 31, 2023
1 parent 715902c commit c6e987f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
10 changes: 5 additions & 5 deletions payment/accounts.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,11 @@
$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')));
Expand All @@ -88,9 +91,6 @@

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');

Expand Down
11 changes: 4 additions & 7 deletions payment/tests/behat/accounts.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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"
Expand Down

0 comments on commit c6e987f

Please sign in to comment.