diff --git a/sources/renderer/bootstrap/fieldrenderer/bsfileuploadfieldrenderer.class.inc.php b/sources/renderer/bootstrap/fieldrenderer/bsfileuploadfieldrenderer.class.inc.php index 4d5bacbbd..0aadb0883 100644 --- a/sources/renderer/bootstrap/fieldrenderer/bsfileuploadfieldrenderer.class.inc.php +++ b/sources/renderer/bootstrap/fieldrenderer/bsfileuploadfieldrenderer.class.inc.php @@ -97,7 +97,7 @@ class BsFileUploadFieldRenderer extends FieldRenderer } else { - var sDownloadLink = '{$this->oField->GetDownloadEndpoint()}'.replace(/-sAttId-/, data.result.att_id); + var sDownloadLink = '{$this->oField->GetDownloadEndpoint()}'.replace(/-sAttachmentId-/, data.result.att_id); $(this).closest('.fileupload_field_content').find('.attachments_container').append( '
'+ @@ -109,15 +109,22 @@ class BsFileUploadFieldRenderer extends FieldRenderer ' '+ '
' ); - + // Preview tooltip + if(data.result.preview){ + $('#display_attachment_'+data.result.att_id).tooltip({ + html: true, + title: function(){ return ''; } + }); + } + // Showing remove button on hover + $('#display_attachment_'+data.result.att_id).hover( function(){ + $(this).children(':button').toggleClass('hidden'); + }); + // Remove button handler $('#display_attachment_'+data.result.att_id+' :button').click(function(oEvent){ oEvent.preventDefault(); RemoveAttachment(data.result.att_id); }); - - $('#display_attachment_'+data.result.att_id).hover( function(){ - $(this).children(':button').toggleClass('hidden'); - }); } }, start: function() { @@ -136,12 +143,21 @@ class BsFileUploadFieldRenderer extends FieldRenderer }); } }); - + + + // Preview tooltip + $('.attachment [data-preview="true"]').each(function(iIndex, oElem){ + $(oElem).parent().tooltip({ + html: true, + title: function(){ return ''; } + }); + }); + // Remove button handler $('.attachments_container .attachment :button').click(function(oEvent){ oEvent.preventDefault(); RemoveAttachment($(this).closest('.attachment').find(':input[name="attachments[]"]').val()); }); - + // Remove button showing if($sIsDeleteAllowed) { $('.attachment').hover( function(){