import { helpers } from 'rx'; import React, { PropTypes } from 'react'; import PureComponent from 'react-pure-render/component'; import { push } from 'react-router-redux'; import { reduxForm } from 'redux-form'; // import debug from 'debug'; import dedent from 'dedent'; import { isAscii, isEmail } from 'validator'; import { Button, Col, Input, Row } from 'react-bootstrap'; import { isValidURL, makeOptional, makeRequired, createFormValidator, getValidationState } from '../../../utils/form'; import { saveForm, loadSavedForm } from '../redux/actions'; // const log = debug('fcc:jobs:newForm'); const hightlightCopy = ` Highlight my post to make it stand out. (+$250) `; const isRemoteCopy = ` This job can be performed remotely. `; const howToApplyCopy = dedent` Examples: click here to apply yourcompany.com/jobs/33 Or email jobs@yourcompany.com `; const checkboxClass = dedent` text-left jobs-checkbox-spacer col-sm-offset-2 col-sm-6 col-md-offset-3 `; const certTypes = { isFrontEndCert: 'isFrontEndCert', isBackEndCert: 'isBackEndCert' }; const fields = [ 'position', 'locale', 'description', 'email', 'url', 'logo', 'company', 'isHighlighted', 'isRemoteOk', 'isFrontEndCert', 'isBackEndCert', 'howToApply' ]; const fieldValidators = { position: makeRequired(isAscii), locale: makeRequired(isAscii), description: makeRequired(helpers.identity), email: makeRequired(isEmail), url: makeRequired(isValidURL), logo: makeOptional(isValidURL), company: makeRequired(isAscii), howToApply: makeRequired(isAscii) }; export class NewJob extends PureComponent { static displayName = 'NewJob'; static propTypes = { fields: PropTypes.object, handleSubmit: PropTypes.func, loadSavedForm: PropTypes.func, push: PropTypes.func, saveForm: PropTypes.func }; componentDidMount() { this.props.loadSavedForm(); } handleSubmit(job) { this.props.saveForm(job); this.props.push('/jobs/new/preview'); } handleCertClick(name) { const { fields } = this.props; Object.keys(certTypes).forEach(certType => { if (certType === name) { return fields[certType].onChange(true); } return fields[certType].onChange(false); }); } render() { const { fields: { position, locale, description, email, url, logo, company, isHighlighted, isRemoteOk, howToApply, isFrontEndCert, isBackEndCert }, handleSubmit } = this.props; const { handleChange } = this; const labelClass = 'col-sm-offset-1 col-sm-2'; const inputClass = 'col-sm-6'; return (
this.handleSubmit(data)) }>

First, select your ideal applicant:

Tell us about the position



How should they apply?


Tell us about your organization

handleChange('company', e) } type='text' wrapperClassName={ inputClass } { ...company } />

Make it stand out

Highlight this ad to give it extra attention.
Featured listings receive more clicks and more applications.
); } } export default reduxForm( { form: 'NewJob', fields, validate: createFormValidator(fieldValidators) }, state => ({ initialValues: state.jobsApp.initialValues }), { loadSavedForm, push, saveForm } )(NewJob);