From 68cd5b027ab6580c164f6a360ccbd09dba4dc377 Mon Sep 17 00:00:00 2001 From: Albert Santoni Date: Wed, 18 Feb 2015 15:56:28 -0500 Subject: [PATCH] CC-5998: Prevent users from spamming the delete button in the library --- airtime_mvc/public/js/airtime/library/library.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/airtime_mvc/public/js/airtime/library/library.js b/airtime_mvc/public/js/airtime/library/library.js index 23b517d6b..fbe7cb5d5 100644 --- a/airtime_mvc/public/js/airtime/library/library.js +++ b/airtime_mvc/public/js/airtime/library/library.js @@ -316,15 +316,24 @@ var AIRTIME = (function(AIRTIME) { }; mod.fnDeleteItems = function(aMedia) { - + + //Prevent the user from spamming the delete button while the AJAX request is in progress + AIRTIME.button.disableButton("btn-group #sb-trash", false); + //Hack to immediately show the "Processing" div in DataTables to give the user some sort of feedback. + $(".dataTables_processing").css('visibility','visible'); + $.post(baseUrl+"library/delete", {"format": "json", "media": aMedia}, function(json){ if (json.message !== undefined) { alert(json.message); } + chosenItems = {}; oTable.fnStandingRedraw(); + + //Re-enable the delete button + AIRTIME.button.enableButton("btn-group #sb-trash", false); }); };