1
0
mirror of https://github.com/ascribe/onion.git synced 2024-06-28 16:48:04 +02:00

finish register artwork for prize

This commit is contained in:
Tim Daubenschütz 2015-07-14 20:35:16 +02:00
parent 6a04a1a053
commit f8b87a8849
2 changed files with 26 additions and 7 deletions

View File

@ -2,8 +2,6 @@
import React from 'react';
import { getLangText } from '../../utils/lang_utils';
let InputCheckbox = React.createClass({
propTypes: {
required: React.PropTypes.string.isRequired,
@ -19,12 +17,22 @@ let InputCheckbox = React.createClass({
};
},
handleFocus() {
handleFocus(event) {
this.refs.checkbox.getDOMNode().checked = !this.refs.checkbox.getDOMNode().checked;
// This is calling property.js's method handleChange which
// expects an event object
// Since we don't have a valid one, we'll just manipulate the one we get and send
// it to handleChange
event.target.value = this.refs.checkbox.getDOMNode().checked;
this.props.onChange(event);
event.stopPropagation();
this.setState({
show: this.refs.checkbox.getDOMNode().checked,
value: this.refs.checkbox.getDOMNode().checked
});
},
render() {

View File

@ -46,10 +46,19 @@ let Property = React.createClass({
};
},
componentWillReceiveProps(){
componentWillReceiveProps() {
// In order to set this.state.value from another component
// the state of value should only be set if its not undefined and
// actually references something
if(typeof this.refs.input.getDOMNode().value !== 'undefined') {
this.setState({
value: this.refs.input.getDOMNode().value
});
}
this.setState({
initialValue: this.refs.input.getDOMNode().defaultValue,
value: this.refs.input.getDOMNode().value
initialValue: this.refs.input.getDOMNode().defaultValue
});
},
@ -67,11 +76,13 @@ let Property = React.createClass({
},
handleChange(event) {
this.props.handleChange(event);
if ('onChange' in this.props) {
this.props.onChange(event);
}
this.setState({value: event.target.value});
this.setState({value: true});
},
handleFocus() {