diff options
Diffstat (limited to 'web/react/components/file_attachment.jsx')
-rw-r--r-- | web/react/components/file_attachment.jsx | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/web/react/components/file_attachment.jsx b/web/react/components/file_attachment.jsx index 78693df98..888f24aa5 100644 --- a/web/react/components/file_attachment.jsx +++ b/web/react/components/file_attachment.jsx @@ -97,6 +97,7 @@ export default class FileAttachment extends React.Component { var filename = this.props.filename; var fileInfo = utils.splitFileLocation(filename); + var fileUrl = utils.getFileUrl(filename); var type = utils.getFileType(fileInfo.ext); var thumbnail; @@ -142,22 +143,30 @@ export default class FileAttachment extends React.Component { > <a className='post-image__thumbnail' href='#' - onClick={this.props.handleImageClick} - data-img-id={this.props.index} - data-toggle='modal' - data-target={'#' + this.props.modalId} + onClick={() => this.props.handleImageClick(this.props.index)} > {thumbnail} </a> <div className='post-image__details'> - <div + <a + href={fileUrl} + download={filenameString} data-toggle='tooltip' title={filenameString} className='post-image__name' > {trimmedFilename} - </div> + </a> <div> + <a + href={fileUrl} + download={filenameString} + className='post-image__download' + > + <span + className='fa fa-download' + /> + </a> <span className='post-image__type'>{fileInfo.ext.toUpperCase()}</span> <span className='post-image__size'>{fileSizeString}</span> </div> @@ -175,9 +184,6 @@ FileAttachment.propTypes = { // the index of this attachment preview in the parent FileAttachmentList index: React.PropTypes.number.isRequired, - // the identifier of the modal dialog used to preview files - modalId: React.PropTypes.string.isRequired, - - // handler for when the thumbnail is clicked + // handler for when the thumbnail is clicked passed the index above handleImageClick: React.PropTypes.func }; |