| 1 | <script type="text/javascript"> |
| 2 | {literal} |
| 3 | CRM.$(function($) { |
| 4 | $('a.delete-attachment').click(function(e) { |
| 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}'; |
| 8 | CRM.confirm({ |
| 9 | title: $el.attr('title'), |
| 10 | message: ts(msg, {1: '<em>' + $el.data('filename') + '</em>'}) |
| 11 | }).on('crmConfirm:yes', function() { |
| 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 | $el.trigger('crmPopupFormSuccess'); |
| 17 | $row.remove(); |
| 18 | }); |
| 19 | }); |
| 20 | e.preventDefault(); |
| 21 | }); |
| 22 | }); |
| 23 | {/literal} |
| 24 | </script> |