1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 09:23:13 +01:00

Use FileStatus in UploadButton, register form

This commit is contained in:
Brett Sun 2015-12-08 18:29:26 +01:00
parent 5bc447ecc8
commit 5250427ce0
3 changed files with 10 additions and 7 deletions

View File

@ -11,9 +11,12 @@ import InputFineUploader from './input_fineuploader';
import UploadButton from '../ascribe_uploader/ascribe_upload_button/upload_button';
import FormSubmitButton from '../ascribe_buttons/form_submit_button';
import { FileStatus } from '../ascribe_uploader/react_s3_fine_uploader_utils';
import AscribeSpinner from '../ascribe_spinner';
import ApiUrls from '../../constants/api_urls';
import AppConstants from '../../constants/application_constants';
import AscribeSpinner from '../ascribe_spinner';
import { getLangText } from '../../utils/lang_utils';
import { mergeOptions } from '../../utils/general_utils';
@ -84,7 +87,7 @@ let RegisterPieceForm = React.createClass({
handleChangedDigitalWork(digitalWorkFile) {
if (digitalWorkFile &&
(digitalWorkFile.status === 'deleted' || digitalWorkFile.status === 'canceled')) {
(digitalWorkFile.status === FileStatus.DELETED || digitalWorkFile.status === FileStatus.CANCELED)) {
this.refs.form.refs.thumbnail_file.reset();
this.setState({ digitalWorkFile: null });
} else {

View File

@ -10,7 +10,7 @@ import AppConstants from '../../constants/application_constants';
import { getCookie } from '../../utils/fetch_api_utils';
const { func, bool, shape, string, number, element, oneOf, arrayOf } = React.PropTypes;
const { func, bool, shape, string, number, element, oneOf, oneOfType, arrayOf } = React.PropTypes;
const InputFineUploader = React.createClass({
propTypes: {

View File

@ -2,7 +2,7 @@
import React from 'react';
import { displayValidProgressFilesFilter } from '../react_s3_fine_uploader_utils';
import { displayValidProgressFilesFilter, FileStatus } from '../react_s3_fine_uploader_utils';
import { getLangText } from '../../../utils/lang_utils';
import { truncateTextAtCharIndex } from '../../../utils/general_utils';
@ -43,11 +43,11 @@ export default function UploadButton({ className = 'btn btn-default btn-sm' } =
},
getUploadingFiles() {
return this.props.filesToUpload.filter((file) => file.status === 'uploading');
return this.props.filesToUpload.filter((file) => file.status === FileStatus.UPLOADING);
},
getUploadedFile() {
return this.props.filesToUpload.filter((file) => file.status === 'upload successful')[0];
return this.props.filesToUpload.filter((file) => file.status === FileStatus.UPLOAD_SUCESSFUL)[0];
},
handleOnClick() {
@ -144,4 +144,4 @@ export default function UploadButton({ className = 'btn btn-default btn-sm' } =
);
}
});
}
}