From 6d08540d8bab54853d2e4511736454a1bc4ef1bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Daubensch=C3=BCtz?= Date: Thu, 19 Nov 2015 11:45:29 +0100 Subject: [PATCH] Sync thumbnail uploader to digitalWork uploader in RegisterPieceForm --- js/components/ascribe_forms/form_register_piece.js | 10 ++++++++++ sass/ascribe_uploader.scss | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/js/components/ascribe_forms/form_register_piece.js b/js/components/ascribe_forms/form_register_piece.js index f79e1dca..74c6b3fa 100644 --- a/js/components/ascribe_forms/form_register_piece.js +++ b/js/components/ascribe_forms/form_register_piece.js @@ -93,10 +93,19 @@ let RegisterPieceForm = React.createClass({ const thumbnailKeyDialogExpanded = AppConstants.supportedThumbnailFileFormats.indexOf(mimeSubType) === -1; this.setState({ thumbnailKeyDialogExpanded }); } else { + this.refs.form.refs.thumbnail_file.reset(); + this.refs.form.refs.digital_work_key.reset(); this.setState({ thumbnailKeyDialogExpanded: false }); } }, + handleSelectFilesThumbnail([thumbnailFile, ]) { + // This is truly terrible, but at least we're not coding this mess into ReactS3Fineuploader + let file = this.refs.form.refs.digital_work_key.refs.input.refs.fineuploader.state.filesToUpload[0]; + file.type = thumbnailFile.type; + file.url = thumbnailFile.url; + }, + render() { const { disabled, handleSuccess, @@ -168,6 +177,7 @@ let RegisterPieceForm = React.createClass({ createBlobRoutine={{ url: ApiUrls.blob_thumbnails }} + handleSelectFiles={this.handleSelectFilesThumbnail} isReadyForFormSubmission={formSubmissionValidation.atLeastOneUploadedFile} keyRoutine={{ url: AppConstants.serverUrl + 's3/key/', diff --git a/sass/ascribe_uploader.scss b/sass/ascribe_uploader.scss index 28de02f7..5117286b 100644 --- a/sass/ascribe_uploader.scss +++ b/sass/ascribe_uploader.scss @@ -3,7 +3,7 @@ cursor: default !important; display: block; height: auto; - margin-top: 1em; + /* margin-top: 1em; */ outline: 1px dashed #9e9e9e; overflow: auto; text-align: center;