mirror of
https://github.com/ascribe/onion.git
synced 2025-02-14 21:10:27 +01:00
Merge remote-tracking branch 'remotes/origin/AD-606-login-returns-this-field-may-not-' into AD-435-hash-locally-for-when-a-artist-do
Conflicts: js/components/ascribe_forms/input_checkbox.js js/components/ascribe_forms/property.js
This commit is contained in:
commit
3031fcdbe1
@ -123,7 +123,8 @@ let SignupForm = React.createClass({
|
|||||||
name="terms"
|
name="terms"
|
||||||
className="ascribe-settings-property-collapsible-toggle"
|
className="ascribe-settings-property-collapsible-toggle"
|
||||||
style={{paddingBottom: 0}}>
|
style={{paddingBottom: 0}}>
|
||||||
<InputCheckbox>
|
<InputCheckbox
|
||||||
|
defaultChecked={true}>
|
||||||
<span>
|
<span>
|
||||||
{' ' + getLangText('I agree to the Terms of Service') + ' '}
|
{' ' + getLangText('I agree to the Terms of Service') + ' '}
|
||||||
(<a href="https://www.ascribe.io/terms" target="_blank" style={{fontSize: '0.9em', color: 'rgba(0,0,0,0.7)'}}>
|
(<a href="https://www.ascribe.io/terms" target="_blank" style={{fontSize: '0.9em', color: 'rgba(0,0,0,0.7)'}}>
|
||||||
|
@ -4,7 +4,8 @@ import React from 'react';
|
|||||||
|
|
||||||
let InputCheckbox = React.createClass({
|
let InputCheckbox = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
defaultValue: React.PropTypes.bool,
|
required: React.PropTypes.bool,
|
||||||
|
defaultChecked: React.PropTypes.bool,
|
||||||
children: React.PropTypes.oneOfType([
|
children: React.PropTypes.oneOfType([
|
||||||
React.PropTypes.arrayOf(React.PropTypes.element),
|
React.PropTypes.arrayOf(React.PropTypes.element),
|
||||||
React.PropTypes.element
|
React.PropTypes.element
|
||||||
@ -18,17 +19,26 @@ let InputCheckbox = React.createClass({
|
|||||||
|
|
||||||
getInitialState() {
|
getInitialState() {
|
||||||
return {
|
return {
|
||||||
//show: false
|
value: this.props.defaultChecked
|
||||||
value: this.props.defaultValue
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
onChange: function(event) {
|
componentDidMount() {
|
||||||
let newValue = !this.state.value;
|
this.props.onChange({
|
||||||
event.target.value = newValue;
|
target: {
|
||||||
this.props.onChange(event);
|
value: this.state.value
|
||||||
event.stopPropagation();
|
}
|
||||||
this.setState({value: newValue});
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
onChange() {
|
||||||
|
let value = !this.refs.checkbox.getDOMNode().checked;
|
||||||
|
this.setState({value: value});
|
||||||
|
this.props.onChange({
|
||||||
|
target: {
|
||||||
|
value: value
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@ -39,7 +49,8 @@ let InputCheckbox = React.createClass({
|
|||||||
type="checkbox"
|
type="checkbox"
|
||||||
ref="checkbox"
|
ref="checkbox"
|
||||||
onChange={this.onChange}
|
onChange={this.onChange}
|
||||||
checked={this.state.value}/>
|
checked={this.state.value}
|
||||||
|
defaultChecked={this.props.defaultChecked}/>
|
||||||
<span className="checkbox">
|
<span className="checkbox">
|
||||||
{this.props.children}
|
{this.props.children}
|
||||||
</span>
|
</span>
|
||||||
|
@ -1,39 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
import React from 'react';
|
|
||||||
|
|
||||||
import AlertMixin from '../../mixins/alert_mixin';
|
|
||||||
|
|
||||||
let InputHidden = React.createClass({
|
|
||||||
propTypes: {
|
|
||||||
submitted: React.PropTypes.bool,
|
|
||||||
value: React.PropTypes.string
|
|
||||||
},
|
|
||||||
|
|
||||||
mixins: [AlertMixin],
|
|
||||||
|
|
||||||
getInitialState() {
|
|
||||||
return {value: this.props.value,
|
|
||||||
alerts: null // needed in AlertMixin
|
|
||||||
};
|
|
||||||
},
|
|
||||||
handleChange(event) {
|
|
||||||
this.setState({value: event.target.value});
|
|
||||||
},
|
|
||||||
render() {
|
|
||||||
let alerts = (this.props.submitted) ? null : this.state.alerts;
|
|
||||||
return (
|
|
||||||
<div className="form-group">
|
|
||||||
{alerts}
|
|
||||||
<input
|
|
||||||
value={this.props.value}
|
|
||||||
type="hidden"
|
|
||||||
onChange={this.handleChange}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export default InputHidden;
|
|
@ -1,46 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
import React from 'react';
|
|
||||||
|
|
||||||
import AlertMixin from '../../mixins/alert_mixin';
|
|
||||||
|
|
||||||
let InputText = React.createClass({
|
|
||||||
propTypes: {
|
|
||||||
submitted: React.PropTypes.bool,
|
|
||||||
onBlur: React.PropTypes.func,
|
|
||||||
type: React.PropTypes.string,
|
|
||||||
required: React.PropTypes.string,
|
|
||||||
placeHolder: React.PropTypes.string
|
|
||||||
},
|
|
||||||
|
|
||||||
mixins: [AlertMixin],
|
|
||||||
|
|
||||||
getInitialState() {
|
|
||||||
return {value: null,
|
|
||||||
alerts: null // needed in AlertMixin
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
handleChange(event) {
|
|
||||||
this.setState({value: event.target.value});
|
|
||||||
},
|
|
||||||
|
|
||||||
render() {
|
|
||||||
let className = 'form-control input-text-ascribe';
|
|
||||||
let alerts = (this.props.submitted) ? null : this.state.alerts;
|
|
||||||
return (
|
|
||||||
<div className="form-group">
|
|
||||||
{alerts}
|
|
||||||
<input className={className}
|
|
||||||
placeholder={this.props.placeHolder}
|
|
||||||
required={this.props.required}
|
|
||||||
type={this.props.type}
|
|
||||||
onChange={this.handleChange}
|
|
||||||
onBlur={this.props.onBlur}/>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export default InputText;
|
|
@ -1,41 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
import React from 'react';
|
|
||||||
|
|
||||||
import AlertMixin from '../../mixins/alert_mixin';
|
|
||||||
|
|
||||||
let InputTextArea = React.createClass({
|
|
||||||
propTypes: {
|
|
||||||
submitted: React.PropTypes.bool,
|
|
||||||
required: React.PropTypes.string,
|
|
||||||
defaultValue: React.PropTypes.string
|
|
||||||
},
|
|
||||||
|
|
||||||
mixins: [AlertMixin],
|
|
||||||
|
|
||||||
getInitialState() {
|
|
||||||
return {
|
|
||||||
value: this.props.defaultValue,
|
|
||||||
alerts: null // needed in AlertMixin
|
|
||||||
};
|
|
||||||
},
|
|
||||||
handleChange(event) {
|
|
||||||
this.setState({value: event.target.value});
|
|
||||||
},
|
|
||||||
render() {
|
|
||||||
let className = 'form-control input-text-ascribe textarea-ascribe-message';
|
|
||||||
|
|
||||||
let alerts = (this.props.submitted) ? null : this.state.alerts;
|
|
||||||
return (
|
|
||||||
<div className="form-group">
|
|
||||||
{alerts}
|
|
||||||
<textarea className={className}
|
|
||||||
defaultValue={this.props.defaultValue}
|
|
||||||
required={this.props.required}
|
|
||||||
onChange={this.handleChange}></textarea>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export default InputTextArea;
|
|
@ -39,6 +39,9 @@ let Property = React.createClass({
|
|||||||
|
|
||||||
getInitialState() {
|
getInitialState() {
|
||||||
return {
|
return {
|
||||||
|
// Please don't confuse initialValue with react's defaultValue.
|
||||||
|
// initialValue is set by us to ensure that a user can reset a specific
|
||||||
|
// property (after editing) to its initial value
|
||||||
initialValue: null,
|
initialValue: null,
|
||||||
value: null,
|
value: null,
|
||||||
isFocused: false,
|
isFocused: false,
|
||||||
@ -158,7 +161,6 @@ let Property = React.createClass({
|
|||||||
renderChildren() {
|
renderChildren() {
|
||||||
return ReactAddons.Children.map(this.props.children, (child) => {
|
return ReactAddons.Children.map(this.props.children, (child) => {
|
||||||
return ReactAddons.addons.cloneWithProps(child, {
|
return ReactAddons.addons.cloneWithProps(child, {
|
||||||
//value: this.state.value,
|
|
||||||
onChange: this.handleChange,
|
onChange: this.handleChange,
|
||||||
onFocus: this.handleFocus,
|
onFocus: this.handleFocus,
|
||||||
onBlur: this.handleBlur,
|
onBlur: this.handleBlur,
|
||||||
|
@ -115,7 +115,7 @@ let AccountSettings = React.createClass({
|
|||||||
className="ascribe-settings-property-collapsible-toggle"
|
className="ascribe-settings-property-collapsible-toggle"
|
||||||
style={{paddingBottom: 0}}>
|
style={{paddingBottom: 0}}>
|
||||||
<InputCheckbox
|
<InputCheckbox
|
||||||
defaultValue={this.state.currentUser.profile.hash_locally}>
|
defaultChecked={this.state.currentUser.profile.hash_locally}>
|
||||||
<span>
|
<span>
|
||||||
{' ' + getLangText('Enable hash option for slow connections. ' +
|
{' ' + getLangText('Enable hash option for slow connections. ' +
|
||||||
'Computes and uploads a hash of the work instead.')}
|
'Computes and uploads a hash of the work instead.')}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user