Merge pull request #73 from ascribe/AD-1510-limit-create-editions-to-100

AD-1510 Limit edition creation to 1-100
This commit is contained in:
Brett Sun 2016-01-19 16:29:32 +01:00
commit 93c2ea99e9
3 changed files with 17 additions and 5 deletions

View File

@ -19,7 +19,7 @@ let CreateEditionsForm = React.createClass({
pieceId: React.PropTypes.number
},
getFormData(){
getFormData() {
return {
piece_id: parseInt(this.props.pieceId, 10)
};
@ -58,11 +58,12 @@ let CreateEditionsForm = React.createClass({
<input
type="number"
placeholder="(e.g. 32)"
min={1}/>
min={1}
max={100} />
</Property>
</Form>
);
}
});
export default CreateEditionsForm;
export default CreateEditionsForm;

View File

@ -240,7 +240,17 @@ const Property = React.createClass({
},
handleCheckboxToggle() {
this.setExpanded(!this.state.expanded);
const expanded = !this.state.expanded;
this.setExpanded(expanded);
// Reset the value to be the initial value when the checkbox is unticked since the
// user doesn't want to specify their own value.
if (!expanded) {
this.setState({
value: this.state.initialValue
});
}
},
renderChildren(style) {

View File

@ -89,7 +89,8 @@ let RegisterPiece = React.createClass( {
<input
type="number"
placeholder="(e.g. 32)"
min={0}/>
min={1}
max={100} />
</Property>
);
}