From 0e01704f83df13e87a374ea918c2e6ef579dbc5f Mon Sep 17 00:00:00 2001 From: Charles Connell Date: Thu, 2 Jan 2014 13:04:09 -0500 Subject: [PATCH] Confirm note flagging --- karmaworld/assets/js/note-detail.js | 32 +++++++++++++++-------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/karmaworld/assets/js/note-detail.js b/karmaworld/assets/js/note-detail.js index a5d175c..14d3a58 100644 --- a/karmaworld/assets/js/note-detail.js +++ b/karmaworld/assets/js/note-detail.js @@ -63,7 +63,7 @@ function setupPdfViewer() { } $(function() { - $("#thank-button").click(function() { + $("#thank-button").click(function(event) { event.preventDefault(); // increment number in page right away @@ -85,21 +85,23 @@ $(function() { }); }); - $("#flag-button").click(function() { + $("#flag-button").click(function(event) { event.preventDefault(); - // disable thank button so it can't - // be pressed again - $(this).hide(); - $('#flag-button-disabled').show(); - $(this).unbind('click'); - - // tell server that somebody thanked - // this note - $.ajax({ - url: note_flag_url, - dataType: "json", - type: 'POST' - }); + if (confirm('Do you wish to flag this note for deletion?')) { + // disable thank button so it can't + // be pressed again + $(this).hide(); + $('#flag-button-disabled').show(); + $(this).unbind('click'); + + // tell server that somebody thanked + // this note + $.ajax({ + url: note_flag_url, + dataType: "json", + type: 'POST' + }); + } }); }); -- 2.25.1