Created
October 13, 2016 17:24
-
-
Save Kikimora/ac226adfa06346e781ed38b5d161b3e3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
onImageRemove(image) { | |
return ()=> { | |
var imageName = _.capitalize(image); | |
var command = this.context.viewModel[`remove${imageName}Command`]; | |
command.execute(); | |
} | |
} | |
onImageAdd(image) { | |
return (file)=> { | |
var imageName = _.capitalize(image); | |
var command = this.context.viewModel[`set${imageName}Command`]; | |
command.execute(file[0]); | |
} | |
} | |
onContentImagesListAdd(files) { | |
var command = this.context.viewModel.addFilesToContentImagesListCommand; | |
command.execute(files); | |
} | |
onContentImagesListRemove(file, idx) { | |
var command = this.context.viewModel.removeContentImagesListCommand; | |
command.execute(idx); | |
} | |
onContentImagesListRemoveAll() { | |
var command = this.context.viewModel.removeAllContentImagesListCommand; | |
command.execute(); | |
} | |
onContentImagesListReorder(newOrderOfItemsArray) { | |
var command = this.context.viewModel.reorderPhotosListCommand; | |
command.execute(newOrderOfItemsArray); | |
} | |
renderImages() { | |
let data = this.props.data; | |
return ( | |
<Tab eventKey={2} disabled={data.isNew} title="Images"> | |
<Upload title="Poster Image" | |
items={[data.posterImage]} | |
onRemove={this.onImageRemove("posterImage")} | |
onAdd={this.onImageAdd("posterImage")} | |
value={data.posterImage} | |
errors={data.posterImageErrors} | |
disabled={!data.id} | |
/> | |
<Upload title="Content Images" | |
items={data.contentImagesList.files} | |
onRemove={this.onContentImagesListRemove.bind(this)} | |
onAdd={this.onContentImagesListAdd.bind(this)} | |
onReorder={this.onContentImagesListReorder.bind(this)} | |
onRemoveAll={this.onContentImagesListRemoveAll.bind(this)} | |
errors={data.contentImagesListErrors} | |
disabled={!data.addFilesToContentImagesListCommand.canExecute} | |
/> | |
</Tab> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment