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 ------------------------ */
/**
* Delete a given Submission from the form, or all submissions
* we let the href of the delete link to do all the work for us
* Delete a given Submission from the form
*/
$("#userforms-submissions .deleteSubmission").click(function() {
var deletedSubmission = $(this);
$("#userforms-submissions .deleteSubmission").click(function(event) {
event.preventDefault();
var deletedSubmission = $(this);
$.post($(this).attr('href'), function(data) {
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;
});
@ -316,4 +332,4 @@
});
});
})
(jQuery);
(jQuery);

View File

@ -3,7 +3,7 @@
<% if Submissions %>
<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}/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>
<% control Submissions %>
@ -38,4 +38,4 @@
<% end_if %>
<p class="userforms-nosubmissions" <% if Submissions %>style="display: none"<% end_if %>><% _t('NOSUBMISSIONS', 'No Submissions') %></p>
</div>
</div>