CRM-14383 - Update cj closures
[civicrm-core.git] / templates / CRM / Form / attachmentjs.tpl
1 <script type="text/javascript">
2 {literal}
3 CRM.$(function($) {
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}';
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 $row.remove();
17 });
18 });
19 return false;
20 });
21 });
22 {/literal}
23 </script>