1
0
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:
diminator 2015-07-15 16:56:38 +02:00
commit 08137cdb09
5 changed files with 17 additions and 6 deletions

View File

@ -125,7 +125,7 @@ let FileUploader = React.createClass({
return ( return (
<Form> <Form>
<Property <Property
label="Additional files"> label="Additional files (max. 10MB)">
<ReactS3FineUploader <ReactS3FineUploader
keyRoutine={{ keyRoutine={{
url: AppConstants.serverUrl + 's3/key/', url: AppConstants.serverUrl + 's3/key/',

View File

@ -113,7 +113,7 @@ let FileDragAndDrop = React.createClass({
this.props.handleResumeFile(fileId); this.props.handleResumeFile(fileId);
}, },
handleOnClick() { handleOnClick(event) {
// when multiple is set to false and the user already uploaded a piece, // when multiple is set to false and the user already uploaded a piece,
// do not propagate event // do not propagate event
if(this.props.dropzoneInactive) { if(this.props.dropzoneInactive) {
@ -128,6 +128,7 @@ let FileDragAndDrop = React.createClass({
bubbles: true, bubbles: true,
cancelable: true cancelable: true
}); });
evt.stopPropagation(); evt.stopPropagation();
this.refs.fileinput.getDOMNode().dispatchEvent(evt); this.refs.fileinput.getDOMNode().dispatchEvent(evt);
}, },

View File

@ -22,11 +22,11 @@ let FileDragAndDropDialog = React.createClass({
<span className="file-drag-and-drop-dialog"> <span className="file-drag-and-drop-dialog">
<p>Drag a file here</p> <p>Drag a file here</p>
<p>or</p> <p>or</p>
<button <span
className="btn btn-default" className="btn btn-default"
onClick={this.props.onClick}> onClick={this.props.onClick}>
choose a file to upload choose a file to upload
</button> </span>
</span> </span>
); );
} }

View File

@ -197,7 +197,8 @@ var ReactS3FineUploader = React.createClass({
onProgress: this.onProgress, onProgress: this.onProgress,
onDeleteComplete: this.onDeleteComplete, onDeleteComplete: this.onDeleteComplete,
onSessionRequestComplete: this.onSessionRequestComplete, onSessionRequestComplete: this.onSessionRequestComplete,
onError: this.onError onError: this.onError,
onValidate: this.onValidate
} }
}; };
}, },
@ -235,6 +236,7 @@ var ReactS3FineUploader = React.createClass({
createBlob(file) { createBlob(file) {
let defer = new fineUploader.Promise(); let defer = new fineUploader.Promise();
window.fetch(this.props.createBlobRoutine.url, { window.fetch(this.props.createBlobRoutine.url, {
method: 'post', method: 'post',
headers: { headers: {
@ -312,6 +314,14 @@ var ReactS3FineUploader = React.createClass({
GlobalNotificationActions.appendGlobalNotification(notification); 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) { onCancel(id) {
this.removeFileWithIdFromFilesToUpload(id); this.removeFileWithIdFromFilesToUpload(id);

View File

@ -142,7 +142,7 @@ let RegisterPiece = React.createClass( {
}, },
getSpecifyEditions() { getSpecifyEditions() {
if (this.state.whitelabel.acl_editions) { if(this.state.whitelabel.acl_editions || Object.keys(this.state.whitelabel).length === 0) {
return ( return (
<PropertyCollapsible <PropertyCollapsible
name="num_editions" name="num_editions"