From 16840a6136f1c3df13b62d174ac48fde8f8d6971 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Daubensch=C3=BCtz?= Date: Tue, 17 Nov 2015 11:57:18 +0100 Subject: [PATCH] Generalize InputFineuploader's submitFileName method to submitFile --- .../ascribe_forms/form_create_contract.js | 6 +++--- .../ascribe_forms/form_register_piece.js | 5 +++-- .../ascribe_forms/input_fineuploader.js | 18 +++++++++--------- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/js/components/ascribe_forms/form_create_contract.js b/js/components/ascribe_forms/form_create_contract.js index aac4c5ea..a409efd4 100644 --- a/js/components/ascribe_forms/form_create_contract.js +++ b/js/components/ascribe_forms/form_create_contract.js @@ -51,9 +51,9 @@ let CreateContractForm = React.createClass({ this.refs.form.reset(); }, - submitFileName(fileName) { + submitFile({ originalName }) { this.setState({ - contractName: fileName + contractName: originalName }); this.refs.form.submit(); @@ -69,7 +69,7 @@ let CreateContractForm = React.createClass({ name="blob" label={getLangText('Contract file (*.pdf only, max. 50MB per contract)')}> + disabled={!(digitalWorkKeyReady && thumbnailKeyReady)}> {submitMessage} } diff --git a/js/components/ascribe_forms/input_fineuploader.js b/js/components/ascribe_forms/input_fineuploader.js index 948521c0..cb9995fd 100644 --- a/js/components/ascribe_forms/input_fineuploader.js +++ b/js/components/ascribe_forms/input_fineuploader.js @@ -10,13 +10,13 @@ import AppConstants from '../../constants/application_constants'; import { getCookie } from '../../utils/fetch_api_utils'; -const { func, bool, object, shape, string, number, arrayOf } = React.PropTypes; +const { func, bool, shape, string, number, arrayOf } = React.PropTypes; const InputFineUploader = React.createClass({ propTypes: { setIsUploadReady: func, isReadyForFormSubmission: func, - submitFileName: func, + submitFile: func, fileInputElement: func, areAssetsDownloadable: bool, @@ -77,8 +77,8 @@ const InputFineUploader = React.createClass({ this.props.onChange({ target: { value: this.state.value } }); } - if(typeof this.props.submitFileName === 'function') { - this.props.submitFileName(file.originalName); + if(typeof this.props.submitFile === 'function') { + this.props.submitFile(file); } }, @@ -104,7 +104,7 @@ const InputFineUploader = React.createClass({ onLoggedOut, enableLocalHashing, fileClassToUpload, - location } = this.props; + uploadMethod } = this.props; let editable = this.props.isFineUploaderActive; // if disabled is actually set by property, we want to override @@ -139,10 +139,10 @@ const InputFineUploader = React.createClass({ 'X-CSRFToken': getCookie(AppConstants.csrftoken) } }} - onInactive={this.props.onLoggedOut} - enableLocalHashing={this.props.enableLocalHashing} - uploadMethod={this.props.uploadMethod} - fileClassToUpload={this.props.fileClassToUpload} /> + onInactive={onLoggedOut} + enableLocalHashing={enableLocalHashing} + uploadMethod={uploadMethod} + fileClassToUpload={fileClassToUpload} /> ); } });