Merge remote-tracking branch 'upstream/4.4' into 4.4-master-2014-07-14-13-42-39
[civicrm-core.git] / templates / CRM / Form / attachmentjs.tpl
CommitLineData
1ef465c2
DL
1<script type="text/javascript">
2{literal}
3cc60a06 3 CRM.$(function($) {
4b472ff2 4 $('a.delete-attachment').click(function(e) {
6414adce
CW
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() {
4b472ff2 16 $el.trigger('crmPopupFormSuccess');
6414adce
CW
17 $row.remove();
18 });
19 });
4b472ff2 20 e.preventDefault();
1ef465c2 21 });
6414adce 22 });
1ef465c2
DL
23{/literal}
24</script>