1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-23 01:39:36 +01:00

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

View File

@ -240,7 +240,17 @@ const Property = React.createClass({
}, },
handleCheckboxToggle() { 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) { renderChildren(style) {

View File

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