mirror of
https://github.com/ascribe/onion.git
synced 2025-02-14 21:10:27 +01:00
fix contract fineuploader bugs
This commit is contained in:
parent
24af321669
commit
dd039b88e8
@ -238,15 +238,27 @@ var ReactS3FineUploader = React.createClass({
|
|||||||
});
|
});
|
||||||
this.setState(newState);
|
this.setState(newState);
|
||||||
this.createBlob(files[id]);
|
this.createBlob(files[id]);
|
||||||
this.props.submitKey(files[id].key);
|
|
||||||
|
|
||||||
// also, lets check if after the completion of this upload,
|
// since the form validation props isReadyForFormSubmission, setIsUploadReady and submitKey
|
||||||
// the form is ready for submission or not
|
// are optional, we'll only trigger them when they're actually defined
|
||||||
if(this.props.isReadyForFormSubmission && this.props.isReadyForFormSubmission(this.state.filesToUpload)) {
|
if(this.props.submitKey) {
|
||||||
// if so, set uploadstatus to true
|
this.props.submitKey(files[id].key);
|
||||||
this.props.setIsUploadReady(true);
|
|
||||||
} else {
|
} else {
|
||||||
this.props.setIsUploadReady(false);
|
console.warn('You didn\'t define submitKey in as a prop in react-s3-fine-uploader');
|
||||||
|
}
|
||||||
|
|
||||||
|
// for explanation, check comment of if statement above
|
||||||
|
if(this.props.isReadyForFormSubmission && this.props.setIsUploadReady) {
|
||||||
|
// also, lets check if after the completion of this upload,
|
||||||
|
// the form is ready for submission or not
|
||||||
|
if(this.props.isReadyForFormSubmission(this.state.filesToUpload)) {
|
||||||
|
// if so, set uploadstatus to true
|
||||||
|
this.props.setIsUploadReady(true);
|
||||||
|
} else {
|
||||||
|
this.props.setIsUploadReady(false);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.warn('You didn\'t define the functions isReadyForFormSubmission and/or setIsUploadReady in as a prop in react-s3-fine-uploader');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -309,11 +321,17 @@ var ReactS3FineUploader = React.createClass({
|
|||||||
let notification = new GlobalNotificationModel('File upload canceled', 'success', 5000);
|
let notification = new GlobalNotificationModel('File upload canceled', 'success', 5000);
|
||||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||||
|
|
||||||
if(this.props.isReadyForFormSubmission && this.props.isReadyForFormSubmission(this.state.filesToUpload)) {
|
// since the form validation props isReadyForFormSubmission, setIsUploadReady and submitKey
|
||||||
// if so, set uploadstatus to true
|
// are optional, we'll only trigger them when they're actually defined
|
||||||
this.props.setIsUploadReady(true);
|
if(this.props.isReadyForFormSubmission && this.props.setIsUploadReady) {
|
||||||
|
if(this.props.isReadyForFormSubmission(this.state.filesToUpload)) {
|
||||||
|
// if so, set uploadstatus to true
|
||||||
|
this.props.setIsUploadReady(true);
|
||||||
|
} else {
|
||||||
|
this.props.setIsUploadReady(false);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.props.setIsUploadReady(false);
|
console.warn('You didn\'t define the functions isReadyForFormSubmission and/or setIsUploadReady in as a prop in react-s3-fine-uploader');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -367,11 +385,19 @@ var ReactS3FineUploader = React.createClass({
|
|||||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.props.isReadyForFormSubmission && this.props.isReadyForFormSubmission(this.state.filesToUpload)) {
|
// since the form validation props isReadyForFormSubmission, setIsUploadReady and submitKey
|
||||||
// if so, set uploadstatus to true
|
// are optional, we'll only trigger them when they're actually defined
|
||||||
this.props.setIsUploadReady(true);
|
if(this.props.isReadyForFormSubmission && this.props.setIsUploadReady) {
|
||||||
|
// also, lets check if after the completion of this upload,
|
||||||
|
// the form is ready for submission or not
|
||||||
|
if(this.props.isReadyForFormSubmission(this.state.filesToUpload)) {
|
||||||
|
// if so, set uploadstatus to true
|
||||||
|
this.props.setIsUploadReady(true);
|
||||||
|
} else {
|
||||||
|
this.props.setIsUploadReady(false);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.props.setIsUploadReady(false);
|
console.warn('You didn\'t define the functions isReadyForFormSubmission and/or setIsUploadReady in as a prop in react-s3-fine-uploader');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -224,6 +224,20 @@ let FileUploader = React.createClass({
|
|||||||
sendCredentials: true
|
sendCredentials: true
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
signature={{
|
||||||
|
endpoint: AppConstants.serverUrl + 's3/signature/',
|
||||||
|
customHeaders: {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
deleteFile={{
|
||||||
|
enabled: true,
|
||||||
|
method: 'DELETE',
|
||||||
|
endpoint: AppConstants.serverUrl + 's3/delete',
|
||||||
|
customHeaders: {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
}}
|
||||||
areAssetsDownloadable={true}
|
areAssetsDownloadable={true}
|
||||||
areAssetsEditable={true}/>
|
areAssetsEditable={true}/>
|
||||||
</Property>
|
</Property>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user