diff --git a/js/components/ascribe_detail/further_details.js b/js/components/ascribe_detail/further_details.js index 57c6ebe1..36e79811 100644 --- a/js/components/ascribe_detail/further_details.js +++ b/js/components/ascribe_detail/further_details.js @@ -15,6 +15,8 @@ import GlobalNotificationActions from '../../actions/global_notification_actions import FurtherDetailsFileuploader from './further_details_fileuploader'; +import { isReadyForFormSubmission } from '../ascribe_uploader/react_s3_fine_uploader_utils'; + let FurtherDetails = React.createClass({ propTypes: { editable: React.PropTypes.bool, @@ -48,15 +50,6 @@ let FurtherDetails = React.createClass({ }); }, - isReadyForFormSubmission(files) { - files = files.filter((file) => file.status !== 'deleted' && file.status !== 'canceled'); - if(files.length > 0 && files[0].status === 'upload successful') { - return true; - } else { - return false; - } - }, - render() { //return (); return ( @@ -88,7 +81,7 @@ let FurtherDetails = React.createClass({ file.status !== 'deleted' && file.status !== 'canceled'); - if (files.length > 0 && files[0].status === 'upload successful') { - return true; - } else { - return false; - } - }, - render() { let currentUser = this.state.currentUser; let enableLocalHashing = currentUser && currentUser.profile ? currentUser.profile.hash_locally : false; @@ -117,7 +110,7 @@ let RegisterPieceForm = React.createClass({ {this.props.breadcrumbs.map((breadcrumb, i) => { return ( - +
{this.props.breadcrumbs[i]} diff --git a/js/components/ascribe_uploader/react_s3_fine_uploader.js b/js/components/ascribe_uploader/react_s3_fine_uploader.js index 7780ceae..90c76667 100644 --- a/js/components/ascribe_uploader/react_s3_fine_uploader.js +++ b/js/components/ascribe_uploader/react_s3_fine_uploader.js @@ -160,7 +160,7 @@ var ReactS3FineUploader = React.createClass({ } return name; }, - multiple: true, + multiple: false, defaultErrorMessage: getLangText('Unexpected error. Please contact us if this happens repeatedly.') }; }, diff --git a/js/components/ascribe_uploader/react_s3_fine_uploader_utils.js b/js/components/ascribe_uploader/react_s3_fine_uploader_utils.js new file mode 100644 index 00000000..dbf62619 --- /dev/null +++ b/js/components/ascribe_uploader/react_s3_fine_uploader_utils.js @@ -0,0 +1,16 @@ +'use strict'; + +/** + * Returns a boolean if there has been at least one file uploaded + * successfully without it being deleted or canceled. + * @param {array of files} files provided by react fine uploader + * @return {Boolean} + */ +export function isReadyForFormSubmission(files) { + files = files.filter((file) => file.status !== 'deleted' && file.status !== 'canceled'); + if (files.length > 0 && files[0].status === 'upload successful') { + return true; + } else { + return false; + } +} \ No newline at end of file diff --git a/js/components/whitelabel/wallet/components/cyland/ascribe_forms/cyland_additional_data_form.js b/js/components/whitelabel/wallet/components/cyland/ascribe_forms/cyland_additional_data_form.js index 364360c8..cddabb0c 100644 --- a/js/components/whitelabel/wallet/components/cyland/ascribe_forms/cyland_additional_data_form.js +++ b/js/components/whitelabel/wallet/components/cyland/ascribe_forms/cyland_additional_data_form.js @@ -43,6 +43,7 @@ let CylandAdditionalDataForm = React.createClass({ extradata: extradata, piece_id: this.props.piece.id }; + }, setIsUploadReady(isReady) { @@ -51,8 +52,15 @@ let CylandAdditionalDataForm = React.createClass({ }); }, - isReadyForFormSubmission() { - return true; + isReadyForFormSubmission(files) { + let uploadedFiles = files.filter((file) => file.status === 'upload successful'); + let uploadingFiles = files.filter((file) => file.status === 'submitting'); + + if (uploadedFiles.length > 0 && uploadingFiles.length === 0) { + return true; + } else { + return false; + } }, render() {