diff --git a/src/components/forms/checkbox-group.jsx b/src/components/forms/checkbox-group.jsx index 30fd85c7a..0a96857d9 100644 --- a/src/components/forms/checkbox-group.jsx +++ b/src/components/forms/checkbox-group.jsx @@ -2,6 +2,9 @@ var classNames = require('classnames'); var FRCCheckboxGroup = require('formsy-react-components').CheckboxGroup; var React = require('react'); var defaultValidationHOC = require('./validations.jsx').defaultValidationHOC; +var inputHOC = require('./input-hoc.jsx'); + +require('./row.scss'); var CheckboxGroup = React.createClass({ type: 'CheckboxGroup', @@ -16,4 +19,4 @@ var CheckboxGroup = React.createClass({ } }); -module.exports = defaultValidationHOC(CheckboxGroup); +module.exports = inputHOC(defaultValidationHOC(CheckboxGroup)); diff --git a/src/components/forms/checkbox.jsx b/src/components/forms/checkbox.jsx index 169549aa5..16aca05ee 100644 --- a/src/components/forms/checkbox.jsx +++ b/src/components/forms/checkbox.jsx @@ -2,6 +2,9 @@ var classNames = require('classnames'); var FRCCheckbox = require('formsy-react-components').Checkbox; var React = require('react'); var defaultValidationHOC = require('./validations.jsx').defaultValidationHOC; +var inputHOC = require('./input-hoc.jsx'); + +require('./row.scss'); var Checkbox = React.createClass({ type: 'Checkbox', @@ -16,4 +19,4 @@ var Checkbox = React.createClass({ } }); -module.exports = defaultValidationHOC(Checkbox); +module.exports = inputHOC(defaultValidationHOC(Checkbox)); diff --git a/src/components/forms/input-hoc.jsx b/src/components/forms/input-hoc.jsx new file mode 100644 index 000000000..1532eaefd --- /dev/null +++ b/src/components/forms/input-hoc.jsx @@ -0,0 +1,20 @@ +var React = require('react'); + +module.exports = function InputComponentMixin (Component) { + var InputComponent = React.createClass({ + getDefaultProps: function () { + return { + messages: { + 'general.notRequired': 'Not Required' + } + }; + }, + render: function () { + return ( + + ); + } + }); + return InputComponent; +}; diff --git a/src/components/forms/input.jsx b/src/components/forms/input.jsx index 23bea730e..d3427321e 100644 --- a/src/components/forms/input.jsx +++ b/src/components/forms/input.jsx @@ -2,8 +2,10 @@ var classNames = require('classnames'); var FRCInput = require('formsy-react-components').Input; var React = require('react'); var defaultValidationHOC = require('./validations.jsx').defaultValidationHOC; +var inputHOC = require('./input-hoc.jsx'); require('./input.scss'); +require('./row.scss'); var Input = React.createClass({ type: 'Input', @@ -22,4 +24,4 @@ var Input = React.createClass({ } }); -module.exports = defaultValidationHOC(Input); +module.exports = inputHOC(defaultValidationHOC(Input)); diff --git a/src/components/forms/phone-input.jsx b/src/components/forms/phone-input.jsx index 5189b0877..c16de6b5c 100644 --- a/src/components/forms/phone-input.jsx +++ b/src/components/forms/phone-input.jsx @@ -7,9 +7,12 @@ var defaultValidationHOC = require('./validations.jsx').defaultValidationHOC; var validationHOCFactory = require('./validations.jsx').validationHOCFactory; var Row = require('formsy-react-components').Row; var ComponentMixin = require('formsy-react-components').ComponentMixin; +var inputHOC = require('./input-hoc.jsx'); var allIso2 = allCountries.map(function (country) {return country.iso2;}); +require('./row.scss'); + var PhoneInput = React.createClass({ displayName: 'PhoneInput', mixins: [ @@ -61,4 +64,4 @@ var phoneValidationHOC = validationHOCFactory({ isPhone: 'Please enter a valid phone number' }); -module.exports = defaultValidationHOC(phoneValidationHOC(PhoneInput)); +module.exports = inputHOC(defaultValidationHOC(phoneValidationHOC(PhoneInput))); diff --git a/src/components/forms/radio-group.jsx b/src/components/forms/radio-group.jsx index 8f2a99033..cefed8d18 100644 --- a/src/components/forms/radio-group.jsx +++ b/src/components/forms/radio-group.jsx @@ -2,6 +2,9 @@ var classNames = require('classnames'); var FRCRadioGroup = require('formsy-react-components').RadioGroup; var React = require('react'); var defaultValidationHOC = require('./validations.jsx').defaultValidationHOC; +var inputHOC = require('./input-hoc.jsx'); + +require('./row.scss'); var RadioGroup = React.createClass({ type: 'RadioGroup', @@ -16,4 +19,4 @@ var RadioGroup = React.createClass({ } }); -module.exports = defaultValidationHOC(RadioGroup); +module.exports = inputHOC(defaultValidationHOC(RadioGroup)); diff --git a/src/components/forms/row.scss b/src/components/forms/row.scss new file mode 100644 index 000000000..10a8e12e8 --- /dev/null +++ b/src/components/forms/row.scss @@ -0,0 +1,11 @@ +/* + * Styles for the Row component used by formsy-react-components + * Should be imported for each component that extends one of + * the formsy-react-components + */ + +.form-group { + .required-symbol { + display: none; + } +} diff --git a/src/components/forms/select.jsx b/src/components/forms/select.jsx index 9ddab75dd..b2bca4c8f 100644 --- a/src/components/forms/select.jsx +++ b/src/components/forms/select.jsx @@ -3,7 +3,9 @@ var defaults = require('lodash.defaultsdeep'); var FRCSelect = require('formsy-react-components').Select; var React = require('react'); var defaultValidationHOC = require('./validations.jsx').defaultValidationHOC; +var inputHOC = require('./input-hoc.jsx'); +require('./row.scss'); require('./select.scss'); var Select = React.createClass({ @@ -26,4 +28,4 @@ var Select = React.createClass({ } }); -module.exports = defaultValidationHOC(Select); +module.exports = inputHOC(defaultValidationHOC(Select)); diff --git a/src/components/forms/textarea.jsx b/src/components/forms/textarea.jsx index f317e220e..9ac9e01fb 100644 --- a/src/components/forms/textarea.jsx +++ b/src/components/forms/textarea.jsx @@ -2,7 +2,9 @@ var classNames = require('classnames'); var FRCTextarea = require('formsy-react-components').Textarea; var React = require('react'); var defaultValidationHOC = require('./validations.jsx').defaultValidationHOC; +var inputHOC = require('./input-hoc.jsx'); +require('./row.scss'); require('./textarea.scss'); var TextArea = React.createClass({ @@ -18,4 +20,4 @@ var TextArea = React.createClass({ } }); -module.exports = defaultValidationHOC(TextArea); +module.exports = inputHOC(defaultValidationHOC(TextArea)); diff --git a/src/components/login/login.jsx b/src/components/login/login.jsx index c9cb031d9..d49419f4c 100644 --- a/src/components/login/login.jsx +++ b/src/components/login/login.jsx @@ -41,13 +41,13 @@ var Login = React.createClass({ id='general.username' defaultMessage={'Username'} /> - + - + {this.state.waiting ? [ @@ -126,7 +127,11 @@ module.exports = { {value: 'other', label: formatMessage({id: 'general.other'})} ]} required /> - +