1
0
mirror of https://github.com/ascribe/onion.git synced 2024-11-15 01:25:17 +01:00

readd delete functionality

This commit is contained in:
Tim Daubenschütz 2015-06-29 17:59:35 +02:00
parent f1d3b3968f
commit 52db729a4d
3 changed files with 25 additions and 1 deletions

View File

@ -32,6 +32,7 @@ let FileDragAndDropPreview = React.createClass({
// don't run it // don't run it
// On the other hand, if the files progress is not yet at a 100%, // On the other hand, if the files progress is not yet at a 100%,
// just run fineuploader.cancel // just run fineuploader.cancel
console.log(this.props.file);
if(this.props.handleDeleteFile && this.props.file.progress === 100) { if(this.props.handleDeleteFile && this.props.file.progress === 100) {
this.props.handleDeleteFile(this.props.file.id); this.props.handleDeleteFile(this.props.file.id);
} else if(this.props.handleCancelFile && this.props.file.progress !== 100) { } else if(this.props.handleCancelFile && this.props.file.progress !== 100) {
@ -63,6 +64,9 @@ let FileDragAndDropPreview = React.createClass({
return ( return (
<div <div
className="file-drag-and-drop-position"> className="file-drag-and-drop-position">
<div className="delete-file">
<span className="glyphicon glyphicon-remove text-center" aria-hidden="true" title="Remove file" onClick={this.handleDeleteFile}/>
</div>
{previewElement} {previewElement}
</div> </div>
); );

View File

@ -242,7 +242,7 @@ var ReactS3FineUploader = React.createClass({
this.setState(newState); this.setState(newState);
this.createBlob(files[id]); this.createBlob(files[id]);
this.props.submitKey(files[id].key); this.props.submitKey(files[id].key);
// also, lets check if after the completion of this upload, // also, lets check if after the completion of this upload,
// the form is ready for submission or not // the form is ready for submission or not
if(this.props.isReadyForFormSubmission && this.props.isReadyForFormSubmission(this.state.filesToUpload)) { if(this.props.isReadyForFormSubmission && this.props.isReadyForFormSubmission(this.state.filesToUpload)) {

View File

@ -43,9 +43,29 @@
} }
.file-drag-and-drop-position { .file-drag-and-drop-position {
position: relative;
display: inline-block; display: inline-block;
margin: 0 0 4% 4%; margin: 0 0 4% 4%;
float:left; float:left;
.delete-file {
display: block;
background-color: black;
width: 20px;
height: 20px;
position: absolute;
right: -7px;
top: -7px;
border-radius: 1em;
text-align: center;
cursor: pointer;
span {
color: white;
}
}
} }
.file-drag-and-drop-preview-table-wrapper { .file-drag-and-drop-preview-table-wrapper {