mirror of
https://github.com/ascribe/onion.git
synced 2025-01-03 10:25:08 +01:00
Fix bug in RegisterPieceForm when defining no editions
This commit is contained in:
parent
6d08540d8b
commit
2aab5d2d0d
@ -93,8 +93,12 @@ let RegisterPieceForm = React.createClass({
|
|||||||
const thumbnailKeyDialogExpanded = AppConstants.supportedThumbnailFileFormats.indexOf(mimeSubType) === -1;
|
const thumbnailKeyDialogExpanded = AppConstants.supportedThumbnailFileFormats.indexOf(mimeSubType) === -1;
|
||||||
this.setState({ thumbnailKeyDialogExpanded });
|
this.setState({ thumbnailKeyDialogExpanded });
|
||||||
} else {
|
} else {
|
||||||
|
// Reset the thumbnail that has been set in `handleSelectFilesThumbnail`
|
||||||
|
let file = this.refs.form.refs.digital_work_key.refs.input.refs.fineuploader.state.filesToUpload[0];
|
||||||
|
file.type = '';
|
||||||
|
file.url = '';
|
||||||
|
|
||||||
this.refs.form.refs.thumbnail_file.reset();
|
this.refs.form.refs.thumbnail_file.reset();
|
||||||
this.refs.form.refs.digital_work_key.reset();
|
|
||||||
this.setState({ thumbnailKeyDialogExpanded: false });
|
this.setState({ thumbnailKeyDialogExpanded: false });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -100,13 +100,13 @@ const Property = React.createClass({
|
|||||||
// from native HTML elements.
|
// from native HTML elements.
|
||||||
// To enable developers to create input elements, they can expose a property called value
|
// To enable developers to create input elements, they can expose a property called value
|
||||||
// in their state that will be picked up by property.js
|
// in their state that will be picked up by property.js
|
||||||
} else if(childInput.state && typeof childInput.state.value !== 'undefined') {
|
} else if(childInput && childInput.state && typeof childInput.state.value !== 'undefined') {
|
||||||
this.setState({
|
this.setState({
|
||||||
value: childInput.state.value
|
value: childInput.state.value
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!this.state.initialValue && childInput.props.defaultValue) {
|
if(!this.state.initialValue && childInput && childInput.props.defaultValue) {
|
||||||
this.setState({
|
this.setState({
|
||||||
initialValue: childInput.props.defaultValue
|
initialValue: childInput.props.defaultValue
|
||||||
});
|
});
|
||||||
@ -227,17 +227,21 @@ const Property = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
renderChildren(style) {
|
renderChildren(style) {
|
||||||
return ReactAddons.Children.map(this.props.children, (child) => {
|
// Input's props should only be cloned and propagated down the tree,
|
||||||
return ReactAddons.addons.cloneWithProps(child, {
|
// if the component is actually being shown (!== 'expanded === false')
|
||||||
style,
|
if((this.state.expanded && this.props.checkboxLabel) || !this.props.checkboxLabel) {
|
||||||
onChange: this.handleChange,
|
return ReactAddons.Children.map(this.props.children, (child) => {
|
||||||
onFocus: this.handleFocus,
|
return ReactAddons.addons.cloneWithProps(child, {
|
||||||
onBlur: this.handleBlur,
|
style,
|
||||||
disabled: !this.props.editable,
|
onChange: this.handleChange,
|
||||||
ref: 'input',
|
onFocus: this.handleFocus,
|
||||||
name: this.props.name
|
onBlur: this.handleBlur,
|
||||||
|
disabled: !this.props.editable,
|
||||||
|
ref: 'input',
|
||||||
|
name: this.props.name
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getLabelAndErrors() {
|
getLabelAndErrors() {
|
||||||
|
Loading…
Reference in New Issue
Block a user