mirror of
https://github.com/ascribe/onion.git
synced 2024-11-15 01:25:17 +01:00
Merge remote-tracking branch 'remotes/origin/AD-499-whitelabel-prize-with-sluice-as-k' into AD-419-decouple-piece-registration-from-
This commit is contained in:
commit
08137cdb09
@ -125,7 +125,7 @@ let FileUploader = React.createClass({
|
||||
return (
|
||||
<Form>
|
||||
<Property
|
||||
label="Additional files">
|
||||
label="Additional files (max. 10MB)">
|
||||
<ReactS3FineUploader
|
||||
keyRoutine={{
|
||||
url: AppConstants.serverUrl + 's3/key/',
|
||||
|
@ -113,7 +113,7 @@ let FileDragAndDrop = React.createClass({
|
||||
this.props.handleResumeFile(fileId);
|
||||
},
|
||||
|
||||
handleOnClick() {
|
||||
handleOnClick(event) {
|
||||
// when multiple is set to false and the user already uploaded a piece,
|
||||
// do not propagate event
|
||||
if(this.props.dropzoneInactive) {
|
||||
@ -128,6 +128,7 @@ let FileDragAndDrop = React.createClass({
|
||||
bubbles: true,
|
||||
cancelable: true
|
||||
});
|
||||
|
||||
evt.stopPropagation();
|
||||
this.refs.fileinput.getDOMNode().dispatchEvent(evt);
|
||||
},
|
||||
|
@ -22,11 +22,11 @@ let FileDragAndDropDialog = React.createClass({
|
||||
<span className="file-drag-and-drop-dialog">
|
||||
<p>Drag a file here</p>
|
||||
<p>or</p>
|
||||
<button
|
||||
<span
|
||||
className="btn btn-default"
|
||||
onClick={this.props.onClick}>
|
||||
choose a file to upload
|
||||
</button>
|
||||
</span>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
@ -197,7 +197,8 @@ var ReactS3FineUploader = React.createClass({
|
||||
onProgress: this.onProgress,
|
||||
onDeleteComplete: this.onDeleteComplete,
|
||||
onSessionRequestComplete: this.onSessionRequestComplete,
|
||||
onError: this.onError
|
||||
onError: this.onError,
|
||||
onValidate: this.onValidate
|
||||
}
|
||||
};
|
||||
},
|
||||
@ -235,6 +236,7 @@ var ReactS3FineUploader = React.createClass({
|
||||
|
||||
createBlob(file) {
|
||||
let defer = new fineUploader.Promise();
|
||||
|
||||
window.fetch(this.props.createBlobRoutine.url, {
|
||||
method: 'post',
|
||||
headers: {
|
||||
@ -312,6 +314,14 @@ var ReactS3FineUploader = React.createClass({
|
||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||
},
|
||||
|
||||
onValidate(data) {
|
||||
if(data.size > this.props.validation.sizeLimit) {
|
||||
this.state.uploader.cancelAll();
|
||||
let notification = new GlobalNotificationModel('Your file is bigger than 10MB', 'danger', 5000);
|
||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||
}
|
||||
},
|
||||
|
||||
onCancel(id) {
|
||||
this.removeFileWithIdFromFilesToUpload(id);
|
||||
|
||||
|
@ -142,7 +142,7 @@ let RegisterPiece = React.createClass( {
|
||||
},
|
||||
|
||||
getSpecifyEditions() {
|
||||
if (this.state.whitelabel.acl_editions) {
|
||||
if(this.state.whitelabel.acl_editions || Object.keys(this.state.whitelabel).length === 0) {
|
||||
return (
|
||||
<PropertyCollapsible
|
||||
name="num_editions"
|
||||
|
Loading…
Reference in New Issue
Block a user