From a66a4e1c9f6713f391074d2951f70758c4c4a559 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Daubensch=C3=BCtz?= Date: Mon, 29 Jun 2015 17:37:14 +0200 Subject: [PATCH 1/8] add pause and play functionality --- .../ascribe_uploader/file_drag_and_drop.js | 20 ++++++++++- .../file_drag_and_drop_preview.js | 10 ++++-- .../file_drag_and_drop_preview_image.js | 16 ++++++--- .../file_drag_and_drop_preview_iterator.js | 8 +++-- .../file_drag_and_drop_preview_other.js | 1 - .../react_s3_fine_uploader.js | 33 +++++++++++++++++++ 6 files changed, 77 insertions(+), 11 deletions(-) diff --git a/js/components/ascribe_uploader/file_drag_and_drop.js b/js/components/ascribe_uploader/file_drag_and_drop.js index 7db49192..96347157 100644 --- a/js/components/ascribe_uploader/file_drag_and_drop.js +++ b/js/components/ascribe_uploader/file_drag_and_drop.js @@ -19,6 +19,8 @@ var FileDragAndDrop = React.createClass({ filesToUpload: React.PropTypes.array, handleDeleteFile: React.PropTypes.func, handleCancelFile: React.PropTypes.func, + handlePauseFile: React.PropTypes.func, + handleResumeFile: React.PropTypes.func, multiple: React.PropTypes.bool, dropzoneInactive: React.PropTypes.bool }, @@ -93,6 +95,20 @@ var FileDragAndDrop = React.createClass({ this.props.handleCancelFile(fileId); }, + handlePauseFile(fileId) { + // input's value is not change the second time someone + // inputs the same file again, therefore we need to reset its value + this.refs.fileinput.getDOMNode().value = ''; + this.props.handlePauseFile(fileId); + }, + + handleResumeFile(fileId) { + // input's value is not change the second time someone + // inputs the same file again, therefore we need to reset its value + this.refs.fileinput.getDOMNode().value = ''; + this.props.handleResumeFile(fileId); + }, + handleOnClick() { // when multiple is set to false and the user already uploaded a piece, // do not propagate event @@ -128,7 +144,9 @@ var FileDragAndDrop = React.createClass({ + handleCancelFile={this.handleCancelFile} + handlePauseFile={this.handlePauseFile} + handleResumeFile={this.handleResumeFile}/> 0 && this.props.progress < 99 && this.state.paused) { actionSymbol =