mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
ENHANCEMENT: add confirmation dialog to "Delete all submissions"
This commit is contained in:
parent
cec87a859e
commit
c684b87815
@ -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;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -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 %>
|
||||||
|
Loading…
Reference in New Issue
Block a user