mirror of
https://github.com/ascribe/onion.git
synced 2025-02-14 21:10:27 +01:00
implement template functionality for react fineuploader
This commit is contained in:
parent
280f3bc73a
commit
8b1193f05b
@ -118,7 +118,12 @@ var ReactS3FineUploader = React.createClass({
|
|||||||
fileClassToUpload: React.PropTypes.shape({
|
fileClassToUpload: React.PropTypes.shape({
|
||||||
singular: React.PropTypes.string,
|
singular: React.PropTypes.string,
|
||||||
plural: React.PropTypes.string
|
plural: React.PropTypes.string
|
||||||
})
|
}),
|
||||||
|
|
||||||
|
// Uploading functionality of react fineuploader is disconnected from its UI
|
||||||
|
// layer, which means that literally every (properly adjusted) react element
|
||||||
|
// can handle the UI handling.
|
||||||
|
fileInputElement: React.PropTypes.func
|
||||||
},
|
},
|
||||||
|
|
||||||
mixins: [Router.State],
|
mixins: [Router.State],
|
||||||
@ -174,7 +179,8 @@ var ReactS3FineUploader = React.createClass({
|
|||||||
fileClassToUpload: {
|
fileClassToUpload: {
|
||||||
singular: getLangText('file'),
|
singular: getLangText('file'),
|
||||||
plural: getLangText('files')
|
plural: getLangText('files')
|
||||||
}
|
},
|
||||||
|
fileInputElement: FileDragAndDrop
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -822,28 +828,38 @@ var ReactS3FineUploader = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
let {
|
||||||
<div>
|
multiple,
|
||||||
<FileDragAndDrop
|
areAssetsDownloadable,
|
||||||
className="file-drag-and-drop"
|
areAssetsEditable,
|
||||||
onDrop={this.handleUploadFile}
|
onInactive,
|
||||||
filesToUpload={this.state.filesToUpload}
|
enableLocalHashing,
|
||||||
handleDeleteFile={this.handleDeleteFile}
|
fileClassToUpload,
|
||||||
handleCancelFile={this.handleCancelFile}
|
validation,
|
||||||
handlePauseFile={this.handlePauseFile}
|
fileInputElement
|
||||||
handleResumeFile={this.handleResumeFile}
|
} = this.props;
|
||||||
handleCancelHashing={this.handleCancelHashing}
|
|
||||||
multiple={this.props.multiple}
|
// Here we initialize the template that has been either provided from the outside
|
||||||
areAssetsDownloadable={this.props.areAssetsDownloadable}
|
// or the default input that is FileDragAndDrop.
|
||||||
areAssetsEditable={this.props.areAssetsEditable}
|
return React.createElement(fileInputElement, {
|
||||||
onInactive={this.props.onInactive}
|
className: 'file-drag-and-drop',
|
||||||
dropzoneInactive={this.isDropzoneInactive()}
|
onDrop: this.handleUploadFile,
|
||||||
hashingProgress={this.state.hashingProgress}
|
filesToUpload: this.state.filesToUpload,
|
||||||
enableLocalHashing={this.props.enableLocalHashing}
|
handleDeleteFile: this.handleDeleteFile,
|
||||||
fileClassToUpload={this.props.fileClassToUpload}
|
handleCancelFile: this.handleCancelFile,
|
||||||
validation={this.props.validation}/>
|
handlePauseFile: this.handlePauseFile,
|
||||||
</div>
|
handleResumeFile: this.handleResumeFile,
|
||||||
);
|
handleCancelHashing: this.handleCancelHashing,
|
||||||
|
multiple: multiple,
|
||||||
|
areAssetsDownloadable: areAssetsDownloadable,
|
||||||
|
areAssetsEditable: areAssetsEditable,
|
||||||
|
onInactive: onInactive,
|
||||||
|
dropzoneInactive: this.isDropzoneInactive(),
|
||||||
|
hashingProgress: this.state.hashingProgress,
|
||||||
|
enableLocalHashing: enableLocalHashing,
|
||||||
|
fileClassToUpload: fileClassToUpload,
|
||||||
|
validation: validation
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user