1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 17:33:14 +01:00

Add remove button for thumbnail creation dialog

This commit is contained in:
Tim Daubenschütz 2015-11-23 12:31:53 +01:00
parent e134db8915
commit 56d8268ceb
2 changed files with 11 additions and 6 deletions

View File

@ -2,8 +2,6 @@
import React from 'react'; import React from 'react';
import Glyphicon from 'react-bootstrap/lib/Glyphicon';
import { displayValidProgressFilesFilter } from '../react_s3_fine_uploader_utils'; import { displayValidProgressFilesFilter } from '../react_s3_fine_uploader_utils';
import { getLangText } from '../../../utils/lang_utils'; import { getLangText } from '../../../utils/lang_utils';
import { truncateTextAtCharIndex } from '../../../utils/general_utils'; import { truncateTextAtCharIndex } from '../../../utils/general_utils';
@ -29,7 +27,9 @@ export default function UploadButton({ className = 'btn btn-default btn-sm' } =
allowedExtensions: string, allowedExtensions: string,
handleCancelFile: func // provided by ReactS3FineUploader // provided by ReactS3FineUploader
handleCancelFile: func,
handleDeleteFile: func
}, },
handleDrop(event) { handleDrop(event) {
@ -74,6 +74,11 @@ export default function UploadButton({ className = 'btn btn-default btn-sm' } =
} }
}, },
onClickRemove() {
const uploadedFile = this.getUploadedFile();
this.props.handleDeleteFile(uploadedFile.id);
},
getButtonLabel() { getButtonLabel() {
let { filesToUpload, fileClassToUpload } = this.props; let { filesToUpload, fileClassToUpload } = this.props;
@ -94,8 +99,8 @@ export default function UploadButton({ className = 'btn btn-default btn-sm' } =
return ( return (
<span> <span>
<span className='ascribe-icon icon-ascribe-ok'/> <span className='ascribe-icon icon-ascribe-ok'/>
{' ' + truncateTextAtCharIndex(uploadedFile.name, 40)} {' ' + truncateTextAtCharIndex(uploadedFile.name, 40) + ' '}
[<a onClick={this.onClickRemove}>{getLangText('remove')}</a>]
</span> </span>
); );
} else { } else {

View File

@ -122,7 +122,7 @@
cursor: default; cursor: default;
color: lighten($ascribe--button-default-color, 20%); color: lighten($ascribe--button-default-color, 20%);
font-size: 4.2em; font-size: 4.2em;
top: .15em; top: .2em;
} }
} }