diff --git a/js/components/ascribe_forms/input_checkbox.js b/js/components/ascribe_forms/input_checkbox.js index 28f75bc3..dfb13ada 100644 --- a/js/components/ascribe_forms/input_checkbox.js +++ b/js/components/ascribe_forms/input_checkbox.js @@ -2,48 +2,43 @@ import React from 'react'; -import AlertMixin from '../../mixins/alert_mixin'; +import { getLangText } from '../../utils/lang_utils'; let InputCheckbox = React.createClass({ propTypes: { - submitted: React.PropTypes.bool.isRequired, required: React.PropTypes.string.isRequired, label: React.PropTypes.string.isRequired }, - mixins: [AlertMixin], - getInitialState() { return { - value: null, - alerts: null // needed in AlertMixin + show: false }; }, - - handleChange(event) { - this.setState({value: event.target.value}); + + handleFocus() { + this.refs.checkbox.getDOMNode().checked = !this.refs.checkbox.getDOMNode().checked; + this.setState({ + show: this.refs.checkbox.getDOMNode().checked + }); }, render() { - let alerts = (this.props.submitted) ? null : this.state.alerts; return ( -
- {alerts} -
-
- -
-
-
+ + + + + {getLangText('I agree to the Terms of Service') + ' '} + ( + {getLangText('read')} + ) + + + ); - } }); diff --git a/js/components/ascribe_forms/property.js b/js/components/ascribe_forms/property.js index df3df761..40b5af6e 100644 --- a/js/components/ascribe_forms/property.js +++ b/js/components/ascribe_forms/property.js @@ -18,13 +18,21 @@ let Property = React.createClass({ ]), footer: React.PropTypes.element, handleChange: React.PropTypes.func, - ignoreFocus: React.PropTypes.bool + ignoreFocus: React.PropTypes.bool, + className: React.PropTypes.string, + onClick: React.PropTypes.func, + onChange: React.PropTypes.func, + children: React.PropTypes.oneOfType([ + React.PropTypes.arrayOf(React.PropTypes.element), + React.PropTypes.element + ]) }, getDefaultProps() { return { editable: true, - hidden: false + hidden: false, + className: '' }; }, @@ -36,12 +44,14 @@ let Property = React.createClass({ errors: null }; }, + componentWillReceiveProps(){ this.setState({ initialValue: this.refs.input.getDOMNode().defaultValue, value: this.refs.input.getDOMNode().value }); }, + reset(){ // maybe do reset by reload instead of frontend state? this.setState({value: this.state.initialValue}); @@ -62,26 +72,39 @@ let Property = React.createClass({ } this.setState({value: event.target.value}); }, + handleFocus() { + // if ignoreFocus (bool) is defined, then just ignore focusing on + // the property and input if(this.props.ignoreFocus) { return; } + + // if onClick is defined from the outside, + // just call it + if(this.props.onClick) { + this.props.onClick(); + } + this.refs.input.getDOMNode().focus(); this.setState({ isFocused: true }); }, + handleBlur() { this.setState({ isFocused: false }); }, + handleSuccess(){ this.setState({ isFocused: false, errors: null }); }, + setErrors(errors){ this.setState({ errors: errors.map((error) => { @@ -89,9 +112,11 @@ let Property = React.createClass({ }) }); }, + clearErrors(){ this.setState({errors: null}); }, + getClassName() { if(this.props.hidden){ return 'is-hidden'; @@ -108,6 +133,7 @@ let Property = React.createClass({ return ''; } }, + renderChildren() { return ReactAddons.Children.map(this.props.children, (child) => { return ReactAddons.addons.cloneWithProps(child, { @@ -120,6 +146,7 @@ let Property = React.createClass({ }); }); }, + render() { let tooltip = ; if (this.props.tooltip){ @@ -139,12 +166,12 @@ let Property = React.createClass({
+ onFocus={this.handleFocus}> -
+
{this.state.errors} { this.props.label} {this.renderChildren()} diff --git a/js/components/signup_container.js b/js/components/signup_container.js index f71a37b0..1ec500f1 100644 --- a/js/components/signup_container.js +++ b/js/components/signup_container.js @@ -15,6 +15,7 @@ import Form from './ascribe_forms/form'; import Property from './ascribe_forms/property'; import InputCheckbox from './ascribe_forms/input_checkbox'; + import apiUrls from '../constants/api_urls'; @@ -77,6 +78,10 @@ let SignupContainer = React.createClass({ let SignupForm = React.createClass({ + propTypes: { + handleSuccess: React.PropTypes.func + }, + mixins: [Router.Navigation], handleSuccess(response){ @@ -142,16 +147,11 @@ let SignupForm = React.createClass({ type="text" placeholder={getLangText('Enter a promocode here (Optional)')}/> -
- - - {getLangText('I agree to the')} {getLangText('Terms of Service')} - -
}/> + + + ); } diff --git a/js/constants/languages.js b/js/constants/languages.js index 742ed32c..78c2b148 100644 --- a/js/constants/languages.js +++ b/js/constants/languages.js @@ -207,6 +207,8 @@ const languages = { 'Specify editions': 'Specify editions', 'Editions': 'Editions', 'Create editions': 'Create editions', + 'I agree to the Terms of Service': 'I agree to the Terms of Service', + 'read': 'read', }, 'de': { 'ID': 'ID', @@ -414,6 +416,8 @@ const languages = { 'Specify editions': 'Specify editions', 'Editions': 'Editions', 'Create editions': 'Create editions', + 'I agree to the Terms of Service': 'I agree to the Terms of Service', + 'read': 'read', }, 'fr': { 'ID': 'ID', @@ -621,6 +625,8 @@ const languages = { 'Specify editions': 'Specify editions', 'Editions': 'Editions', 'Create editions': 'Create editions', + 'I agree to the Terms of Service': 'I agree to the Terms of Service', + 'read': 'read', } }; diff --git a/sass/ascribe_accordion_list.scss b/sass/ascribe_accordion_list.scss index 526fbc34..6a8208ce 100644 --- a/sass/ascribe_accordion_list.scss +++ b/sass/ascribe_accordion_list.scss @@ -122,8 +122,11 @@ $ascribe-accordion-list-font: 'Source Sans Pro'; } span.ascribe-accordion-list-table-toggle { - ::selection { background: transparent; } - ::-moz-selection { background: transparent; } + -webkit-user-select: none; + -moz-user-select: none; + -khtml-user-select: none; + -ms-user-select: none; + &:hover { color: $ascribe-color-dark; cursor:pointer; diff --git a/sass/ascribe_settings.scss b/sass/ascribe_settings.scss index 7c655547..85de4915 100644 --- a/sass/ascribe_settings.scss +++ b/sass/ascribe_settings.scss @@ -58,8 +58,6 @@ } } - - .ascribe-settings-property { display: inline-block; width: 100%; @@ -145,7 +143,7 @@ cursor:pointer; /* Taken from: http://www.htmllion.com/css3-checkbox.html */ - .checkbox { + > .checkbox { display: inline-block; cursor: pointer; @@ -155,14 +153,15 @@ color: rgba(0, 0, 0, .5); vertical-align:middle; - span { + > span { position: relative; top: 1px; left: 5px; - &:hover { - color: rgba(2, 182, 163, 1); - } + -webkit-user-select: none; + -moz-user-select: none; + -khtml-user-select: none; + -ms-user-select: none; } } diff --git a/sass/main.scss b/sass/main.scss index df8b4285..d6adc5b2 100644 --- a/sass/main.scss +++ b/sass/main.scss @@ -92,6 +92,11 @@ hr { padding-right:0; } +.clear-margins { + margin-top:0; + margin-bottom:0; +} + .ascribe-color { color: $ascribe-color; }