Basic uploadfield

This commit is contained in:
James Barnsley
2018-07-08 20:20:51 +12:00
parent 528383cfe8
commit 0ef00e74ab
7 changed files with 43 additions and 17 deletions

View File

@ -25,14 +25,17 @@ export default class EditPlaylistModal extends React.Component{
this.setState({error: 'Name is required'})
return false
} else {
this.props.coreActions.savePlaylist(this.props.data.uri, this.state.name, this.state.description, this.state.public, this.state.collaborative, this.state.image)
this.props.uiActions.closeModal()
return false
this.props.coreActions.savePlaylist(this.props.data.uri, this.state.name, this.state.description, this.state.public, this.state.collaborative, this.state.image);
this.props.uiActions.closeModal();
return false;
}
}
setImage(e){
var self = this;
var self = this;
// Create a file-reader to import the selected image
// as a base64 string
var file_reader = new FileReader();
file_reader.addEventListener("load", function(e){
@ -69,13 +72,17 @@ export default class EditPlaylistModal extends React.Component{
/>
</div>
</div>
<div className="field text">
<div className="field file">
<div className="name">Cover image</div>
<div className="input">
<input
type="file"
placeholder="Leave empty to keep existing image"
onChange={e => this.setImage(e)}
/>
<div className="description">
Leave empty to keep cover image unchanged
</div>
</div>
</div>
<div className="field checkbox white">