summaryrefslogtreecommitdiffstats
path: root/web/react/components/file_attachment_list.jsx
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2015-09-24 08:59:00 -0700
committerCorey Hulen <corey@hulen.com>2015-09-24 08:59:00 -0700
commit819ef528b858f81f239406ed3a05f9170eee2c93 (patch)
treebc2e67a0e5364d36d22a681a5fbb56b008b15ce8 /web/react/components/file_attachment_list.jsx
parenta7d75d3bceef5fa405e72968806c905bcc9d8b31 (diff)
parentc5d78f828a48ba88b8a89a0564bcb8352e84b396 (diff)
downloadchat-819ef528b858f81f239406ed3a05f9170eee2c93.tar.gz
chat-819ef528b858f81f239406ed3a05f9170eee2c93.tar.bz2
chat-819ef528b858f81f239406ed3a05f9170eee2c93.zip
Merge pull request #779 from mattermost/plt-294
PLT-294 Converting preview image modal to use react-bootstrap.
Diffstat (limited to 'web/react/components/file_attachment_list.jsx')
-rw-r--r--web/react/components/file_attachment_list.jsx16
1 files changed, 6 insertions, 10 deletions
diff --git a/web/react/components/file_attachment_list.jsx b/web/react/components/file_attachment_list.jsx
index abe72089a..212d4a958 100644
--- a/web/react/components/file_attachment_list.jsx
+++ b/web/react/components/file_attachment_list.jsx
@@ -11,23 +11,21 @@ export default class FileAttachmentList extends React.Component {
this.handleImageClick = this.handleImageClick.bind(this);
- this.state = {startImgId: 0};
+ this.state = {showPreviewModal: false, startImgId: 0};
}
- handleImageClick(e) {
- this.setState({startImgId: parseInt($(e.target.parentNode).attr('data-img-id'), 10)});
+ handleImageClick(indexClicked) {
+ this.setState({showPreviewModal: true, startImgId: indexClicked});
}
render() {
var filenames = this.props.filenames;
- var modalId = this.props.modalId;
var postFiles = [];
for (var i = 0; i < filenames.length && i < Constants.MAX_DISPLAY_FILES; i++) {
postFiles.push(
<FileAttachment
- key={i}
+ key={'file_attachment_' + i}
filename={filenames[i]}
index={i}
- modalId={modalId}
handleImageClick={this.handleImageClick}
/>
);
@@ -39,9 +37,10 @@ export default class FileAttachmentList extends React.Component {
{postFiles}
</div>
<ViewImageModal
+ show={this.state.showPreviewModal}
+ onModalDismissed={() => this.setState({showPreviewModal: false})}
channelId={this.props.channelId}
userId={this.props.userId}
- modalId={modalId}
startId={this.state.startImgId}
filenames={filenames}
/>
@@ -55,9 +54,6 @@ FileAttachmentList.propTypes = {
// a list of file pathes displayed by this
filenames: React.PropTypes.arrayOf(React.PropTypes.string).isRequired,
- // the identifier of the modal dialog used to preview files
- modalId: React.PropTypes.string.isRequired,
-
// the channel that this is part of
channelId: React.PropTypes.string,