Commit | Line | Data |
---|---|---|
1ef465c2 DL |
1 | <script type="text/javascript"> |
2 | {literal} | |
3cc60a06 | 3 | CRM.$(function($) { |
6414adce CW |
4 | $('a.delete-attachment').click(function() { |
5 | var $el = $(this), | |
6 | $row = $el.closest('.crm-attachment-wrapper'), | |
7 | msg = '{/literal}{ts escape="js" 1="%1"}This will immediately delete the file %1. This action cannot be undone.{/ts}{literal}'; | |
5fb83680 | 8 | CRM.confirm({ |
6414adce CW |
9 | title: $el.attr('title'), |
10 | message: ts(msg, {1: '<em>' + $el.data('filename') + '</em>'}) | |
5fb83680 | 11 | }).on('crmConfirm:yes', function() { |
6414adce CW |
12 | var postUrl = {/literal}"{crmURL p='civicrm/file/delete' h=0 }"{literal}; |
13 | var request = $.post(postUrl, $el.data('args')); | |
14 | CRM.status({success: '{/literal}{ts escape="js"}Removed{/ts}{literal}'}, request); | |
15 | request.done(function() { | |
16 | $row.remove(); | |
17 | }); | |
18 | }); | |
19 | return false; | |
1ef465c2 | 20 | }); |
6414adce | 21 | }); |
1ef465c2 DL |
22 | {/literal} |
23 | </script> |