From 813ebd912926fa55f0633a998dc20b714882207e Mon Sep 17 00:00:00 2001 From: Ahmed Ejaz Date: Thu, 28 Dec 2023 17:07:18 +0500 Subject: [PATCH] 11068: add confirm_actions to close the modal --- app/views/admin/products_v3/_delete_modal.html.haml | 1 + app/webpacker/controllers/products_controller.js | 6 +----- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/app/views/admin/products_v3/_delete_modal.html.haml b/app/views/admin/products_v3/_delete_modal.html.haml index 446130cd95..40b6fbd32d 100644 --- a/app/views/admin/products_v3/_delete_modal.html.haml +++ b/app/views/admin/products_v3/_delete_modal.html.haml @@ -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 diff --git a/app/webpacker/controllers/products_controller.js b/app/webpacker/controllers/products_controller.js index 770ad16944..6fe8662f50 100644 --- a/app/webpacker/controllers/products_controller.js +++ b/app/webpacker/controllers/products_controller.js @@ -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(); }