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

finish delete functionality

This commit is contained in:
Tim Daubenschütz 2015-06-25 14:15:02 +02:00
parent ae17d2cb03
commit 08f574a42b
4 changed files with 12 additions and 9 deletions

View File

@ -22,7 +22,7 @@ let FileDragAndDropPreviewImage = React.createClass({
className="file-drag-and-drop-preview-image" className="file-drag-and-drop-preview-image"
style={imageStyle}> style={imageStyle}>
<ProgressBar completed={this.props.progress} color="black"/> <ProgressBar completed={this.props.progress} color="black"/>
<span className="glyphicon glyphicon-remove delete-file" aria-hidden="true" title="Delete"></span> {this.props.progress === 100 ? <span className="glyphicon glyphicon-remove delete-file" aria-hidden="true" title="Delete"></span> : null}
</div> </div>
); );
} }

View File

@ -18,7 +18,7 @@ let FileDragAndDropPreviewOther = React.createClass({
<ProgressBar completed={this.props.progress} color="black"/> <ProgressBar completed={this.props.progress} color="black"/>
<div className="file-drag-and-drop-preview-table-wrapper"> <div className="file-drag-and-drop-preview-table-wrapper">
<div className="file-drag-and-drop-preview-other"> <div className="file-drag-and-drop-preview-other">
<span className="glyphicon glyphicon-remove delete-file" aria-hidden="true" title="Delete"></span> {this.props.progress === 100 ? <span className="glyphicon glyphicon-remove delete-file" aria-hidden="true" title="Delete"></span> : null}
<span>{'.' + this.props.type}</span> <span>{'.' + this.props.type}</span>
</div> </div>
</div> </div>

View File

@ -229,18 +229,23 @@ var ReactS3FineUploader = React.createClass({
onDeleteComplete(id, xhr, isError) { onDeleteComplete(id, xhr, isError) {
if(isError) { if(isError) {
let notification = new GlobalNotificationModel('Couldn\'t delete file', 'danger', 10000);
GlobalNotificationActions.appendGlobalNotification(notification);
} else {
// also, sync files from state with the ones from fineuploader // also, sync files from state with the ones from fineuploader
let filesToUpload = JSON.parse(JSON.stringify(this.state.filesToUpload)); let filesToUpload = JSON.parse(JSON.stringify(this.state.filesToUpload));
// splice because I can // splice because I can
filesToUpload.splice(id, 1); filesToUpload.splice(id, 1);
// set state // set state
this.setState({ let newState = React.addons.update(this.state, {
filesToUpload: React.addons.update(this.state.filesToUpload, {$set: filesToUpload}) filesToUpload: { $set: filesToUpload }
}); });
} else { this.setState(newState);
console.log(id);
// TODO: add global notification let notification = new GlobalNotificationModel('File deleted', 'success', 10000);
GlobalNotificationActions.appendGlobalNotification(notification);
} }
}, },

View File

@ -93,8 +93,6 @@
} }
.file-drag-and-drop-preview-other span:not(:first-child) { .file-drag-and-drop-preview-other span:not(:first-child) {
font-size: 1.2em;
font-family: mercury_light;
display: block; display: block;
margin-top: 1.5em; margin-top: 1.5em;
} }