From 178e25f8f7980ee9a5c035dd61722d92d6be99d7 Mon Sep 17 00:00:00 2001 From: Khanh Ngo Date: Thu, 5 Jul 2018 13:58:27 +0700 Subject: [PATCH] Fix domain table modal to prevent removing several record at the same time --- app/templates/domain.html | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/templates/domain.html b/app/templates/domain.html index 4a922ff..5769b2f 100644 --- a/app/templates/domain.html +++ b/app/templates/domain.html @@ -62,7 +62,7 @@ {{ record.ttl }} - + {{ record.data }} {% if domain.type != 'Slave' %} @@ -158,12 +158,16 @@ var nRow = $(this).parents('tr')[0]; var info = "Are you sure you want to delete " + record + "?"; modal.find('.modal-body p').text(info); - modal.find('#button_delete_confirm').click(function() { - table.row(nRow).remove().draw(); - modal.modal('hide'); - }) modal.modal('show'); + $("#button_delete_confirm").unbind().one('click', function(e) { + table.row(nRow).remove().draw(); + modal.modal('hide'); + }); + + $("#button_delete_cancel").unbind().one('click', function(e) { + modal.modal('hide'); + }); }); // handle edit button and record click $(document.body).on("click", ".button_edit{% if quick_edit %}, .row_record{% endif %}", function(e) { @@ -429,7 +433,7 @@