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:
parent
ae17d2cb03
commit
08f574a42b
@ -22,7 +22,7 @@ let FileDragAndDropPreviewImage = React.createClass({
|
||||
className="file-drag-and-drop-preview-image"
|
||||
style={imageStyle}>
|
||||
<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>
|
||||
);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ let FileDragAndDropPreviewOther = React.createClass({
|
||||
<ProgressBar completed={this.props.progress} color="black"/>
|
||||
<div className="file-drag-and-drop-preview-table-wrapper">
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -229,18 +229,23 @@ var ReactS3FineUploader = React.createClass({
|
||||
|
||||
onDeleteComplete(id, xhr, 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
|
||||
let filesToUpload = JSON.parse(JSON.stringify(this.state.filesToUpload));
|
||||
|
||||
// splice because I can
|
||||
filesToUpload.splice(id, 1);
|
||||
|
||||
// set state
|
||||
this.setState({
|
||||
filesToUpload: React.addons.update(this.state.filesToUpload, {$set: filesToUpload})
|
||||
let newState = React.addons.update(this.state, {
|
||||
filesToUpload: { $set: filesToUpload }
|
||||
});
|
||||
} else {
|
||||
console.log(id);
|
||||
// TODO: add global notification
|
||||
this.setState(newState);
|
||||
|
||||
let notification = new GlobalNotificationModel('File deleted', 'success', 10000);
|
||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -93,8 +93,6 @@
|
||||
}
|
||||
|
||||
.file-drag-and-drop-preview-other span:not(:first-child) {
|
||||
font-size: 1.2em;
|
||||
font-family: mercury_light;
|
||||
display: block;
|
||||
margin-top: 1.5em;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user