1
0
mirror of https://github.com/ascribe/onion.git synced 2024-11-15 01:25:17 +01:00
This commit is contained in:
Tim Daubenschütz 2015-06-29 16:57:31 +02:00
parent e44ae60b75
commit dbbf9fd233
3 changed files with 27 additions and 10 deletions

View File

@ -17,6 +17,10 @@ let FileDragAndDropPreview = React.createClass({
handleCancelFile: React.PropTypes.func
},
toggleUploadProcess() {
},
handleDeleteFile() {
// handleDeleteFile is optional, so if its not submitted,
// don't run it
@ -40,12 +44,14 @@ let FileDragAndDropPreview = React.createClass({
previewElement = (<FileDragAndDropPreviewImage
onClick={this.handleDeleteFile}
progress={this.props.file.progress}
url={this.props.file.url}/>);
url={this.props.file.url}
toggleUploadProcess={this.toggleUploadProcess}/>);
} else {
previewElement = (<FileDragAndDropPreviewOther
onClick={this.handleDeleteFile}
progress={this.props.file.progress}
type={this.props.file.type.split('/')[1]}/>);
type={this.props.file.type.split('/')[1]}
toggleUploadProcess={this.toggleUploadProcess}/>);
}
return (

View File

@ -3,18 +3,17 @@
import React from 'react';
import ProgressBar from 'react-progressbar';
import AppConstants from '../../constants/application_constants';
let FileDragAndDropPreviewImage = React.createClass({
propTypes: {
progress: React.PropTypes.number,
url: React.PropTypes.string,
onClick: React.PropTypes.func
toggleUploadProcess: React.PropTypes.func,
downloadFile: React.PropTypes.func
},
getInitialState() {
return {
paused: false
paused: true
};
},
@ -38,20 +37,32 @@ let FileDragAndDropPreviewImage = React.createClass({
});
},
downloadFile() {
},
render() {
let imageStyle = {
backgroundImage: 'url("' + this.props.url + '")',
backgroundSize: 'cover'
};
//let actionSymbol = this.state.loading ? <img src={AppConstants.baseUrl + 'static/img/ascribe_animated_medium.gif'} /> : <span className="glyphicon glyphicon-remove delete-file" aria-hidden="true" title="Delete or cancel upload" onClick={this.onClick} />;
let actionSymbol = this.state.paused ? <span className="glyphicon glyphicon-pause action-file" aria-hidden="true" title="Pause upload" onClick={this.toggleUploadProcess}/> : <span className="glyphicon glyphicon-play action-file" aria-hidden="true" title="Pause upload" onClick={this.toggleUploadProcess}/>
let actionSymbol;
if(this.props.progress !== 100 && this.state.paused) {
actionSymbol = <span className="glyphicon glyphicon-pause action-file" aria-hidden="true" title="Pause upload" onClick={this.toggleUploadProcess}/>;
} else if(this.props.progress !== 100 && !this.state.paused) {
actionSymbol = <span className="glyphicon glyphicon-play action-file" aria-hidden="true" title="Resume uploading" onClick={this.toggleUploadProcess}/>;
} else {
actionSymbol = <span className="glyphicon glyphicon-download action-file" aria-hidden="true" title="Download file" onClick={this.props.downloadFile}/>;
}
return (
<div
className="file-drag-and-drop-preview-image"
style={imageStyle}>
<ProgressBar completed={this.props.progress} color="black"/>
{actionSymbol}
</div>
);
}

View File

@ -530,7 +530,7 @@ let FileUploader = React.createClass({
setUploadStatus={this.props.setUploadStatus}
isReadyForFormSubmission={this.props.isReadyForFormSubmission}
session={{
endpoint: AppConstants.serverUrl + 'api/ownership/loans/contract/',
endpoint: AppConstants.serverUrl + 'api/blob/otherdatas/fineuploader_session/',
customHeaders: {
'X-CSRFToken': getCookie('csrftoken')
}