mirror of
https://github.com/ascribe/onion.git
synced 2025-02-14 21:10:27 +01:00
finish register artwork for prize
This commit is contained in:
parent
6a04a1a053
commit
f8b87a8849
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { getLangText } from '../../utils/lang_utils';
|
|
||||||
|
|
||||||
let InputCheckbox = React.createClass({
|
let InputCheckbox = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
required: React.PropTypes.string.isRequired,
|
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.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({
|
this.setState({
|
||||||
show: this.refs.checkbox.getDOMNode().checked,
|
show: this.refs.checkbox.getDOMNode().checked,
|
||||||
value: this.refs.checkbox.getDOMNode().checked
|
value: this.refs.checkbox.getDOMNode().checked
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -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({
|
this.setState({
|
||||||
initialValue: this.refs.input.getDOMNode().defaultValue,
|
initialValue: this.refs.input.getDOMNode().defaultValue
|
||||||
value: this.refs.input.getDOMNode().value
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -67,11 +76,13 @@ let Property = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
handleChange(event) {
|
handleChange(event) {
|
||||||
|
|
||||||
this.props.handleChange(event);
|
this.props.handleChange(event);
|
||||||
if ('onChange' in this.props) {
|
if ('onChange' in this.props) {
|
||||||
this.props.onChange(event);
|
this.props.onChange(event);
|
||||||
}
|
}
|
||||||
this.setState({value: event.target.value});
|
|
||||||
|
this.setState({value: true});
|
||||||
},
|
},
|
||||||
|
|
||||||
handleFocus() {
|
handleFocus() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user