11068: add confirm_actions to close the modal

This commit is contained in:
Ahmed Ejaz
2023-12-28 17:07:18 +05:00
parent 047e63541c
commit 813ebd9129
2 changed files with 2 additions and 5 deletions

View File

@@ -6,6 +6,7 @@
confirm_button_class: :red,
actions_alignment_class: 'justify-end',
confirm_reflexes: "click->products#delete_#{object_type}",
confirm_actions: "click->modal#close",
)
= render delete_modal do
%h2.margin-bottom-20.black-text

View File

@@ -10,11 +10,7 @@ export default class extends ApplicationController {
this.stimulate("Products#fetch");
}
beforeReflex(element) {
// To prevent the double click on the confirm modal's confirmation button
if (element.id === "modal-confirm-button") {
window.dispatchEvent(new Event("modal:close"));
}
beforeReflex() {
this.showLoading();
this.scrollToElement();
}