ENHANCEMENT: add confirmation dialog to "Delete all submissions"

This commit is contained in:
Mateusz Uzdowski 2010-10-12 03:21:48 +00:00
parent cec87a859e
commit c684b87815
2 changed files with 24 additions and 8 deletions

View File

@ -74,16 +74,32 @@
/*--------------------- SUBMISSIONS ------------------------ */ /*--------------------- SUBMISSIONS ------------------------ */
/** /**
* Delete a given Submission from the form, or all submissions * Delete a given Submission from the form
* we let the href of the delete link to do all the work for us
*/ */
$("#userforms-submissions .deleteSubmission").click(function(event) {
event.preventDefault();
$("#userforms-submissions .deleteSubmission").click(function() {
var deletedSubmission = $(this); var deletedSubmission = $(this);
$.post($(this).attr('href'), function(data) { $.post($(this).attr('href'), function(data) {
deletedSubmission.parents('div.userform-submission').fadeOut(); deletedSubmission.parents('div.userform-submission').fadeOut();
}); });
return false;
});
/**
* Delete all submissions and fade them out if successful
*/
$("#userforms-submissions .deleteAllSubmissions").click(function(event) {
event.preventDefault();
if (!confirm(ss.i18n._t('UserForms.CONFIRMDELETEALLSUBMISSIONS', 'All submissions will be permanently removed. Continue?'))) return false;
var that = this;
$.post($(this).attr('href'), function(data) {
$(that).parents('#userforms-submissions').children().fadeOut();
});
return false; return false;
}); });

View File

@ -3,7 +3,7 @@
<% if Submissions %> <% if Submissions %>
<ul class="userforms-submission-actions"> <ul class="userforms-submission-actions">
<li><a href="{$Top.Link}/export/?id={$RecordID}"><% _t('EXPORTSUBMISSIONS', 'Export submissions to CSV') %></a></li> <li><a href="{$Top.Link}/export/?id={$RecordID}"><% _t('EXPORTSUBMISSIONS', 'Export submissions to CSV') %></a></li>
<li><a href="{$Top.Link}/deletesubmissions/?id={$RecordID}" class="deleteSubmission"><% _t('DELETEALLSUBMISSIONS', 'Delete All Submissions') %></a></li> <li><a href="{$Top.Link}/deletesubmissions/?id={$RecordID}" class="deleteAllSubmissions"><% _t('DELETEALLSUBMISSIONS', 'Delete All Submissions') %></a></li>
</ul> </ul>
<% control Submissions %> <% control Submissions %>