Add certs/isRemote flags to job form and model
This commit is contained in:
@ -10,11 +10,10 @@ a.jobs-list-highlight:hover {
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
cursor: hand;
|
cursor: hand;
|
||||||
}
|
}
|
||||||
|
.jobs-checkbox {
|
||||||
|
text-align: left
|
||||||
|
}
|
||||||
|
|
||||||
.jobs-checkbox-spacer input[type="checkbox"] {
|
.jobs-checkbox-spacer input[type="checkbox"] {
|
||||||
margin-left: -23px
|
margin-left: -23px
|
||||||
}
|
}
|
||||||
|
|
||||||
.jobs-checkbox-spacer label {
|
|
||||||
padding-left: 130px
|
|
||||||
}
|
|
||||||
|
@ -2,6 +2,8 @@ import React, { PropTypes } from 'react';
|
|||||||
import { History } from 'react-router';
|
import { History } from 'react-router';
|
||||||
import { contain } from 'thundercats-react';
|
import { contain } from 'thundercats-react';
|
||||||
import debugFactory from 'debug';
|
import debugFactory from 'debug';
|
||||||
|
import dedent from 'dedent';
|
||||||
|
|
||||||
import { getDefaults } from '../utils';
|
import { getDefaults } from '../utils';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -41,6 +43,25 @@ const hightlightCopy = `
|
|||||||
Highlight my post to make it stand out. (+$50)
|
Highlight my post to make it stand out. (+$50)
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
const isFullStackCopy = `
|
||||||
|
Only allow full stack certified students to apply.
|
||||||
|
`;
|
||||||
|
|
||||||
|
const isFrontEndCopy = `
|
||||||
|
Only allow front end certified students to apply.
|
||||||
|
`;
|
||||||
|
|
||||||
|
const isRemoteCopy = `
|
||||||
|
This job can be done remotely.
|
||||||
|
`;
|
||||||
|
|
||||||
|
const checkboxClass = dedent`
|
||||||
|
jobs-checkbox
|
||||||
|
jobs-checkbox-spacer
|
||||||
|
col-sm-offset-2
|
||||||
|
col-sm-6 col-md-offset-3
|
||||||
|
`;
|
||||||
|
|
||||||
function formatValue(value, validator, type = 'string') {
|
function formatValue(value, validator, type = 'string') {
|
||||||
const formated = getDefaults(type);
|
const formated = getDefaults(type);
|
||||||
if (validator && type === 'string') {
|
if (validator && type === 'string') {
|
||||||
@ -78,7 +99,10 @@ export default contain({
|
|||||||
url,
|
url,
|
||||||
logo,
|
logo,
|
||||||
company,
|
company,
|
||||||
highlight
|
highlight,
|
||||||
|
isFullStackCert,
|
||||||
|
isFrontEndCert,
|
||||||
|
isRemoteOk
|
||||||
} = form;
|
} = form;
|
||||||
return {
|
return {
|
||||||
position: formatValue(position, makeRequired(isAscii)),
|
position: formatValue(position, makeRequired(isAscii)),
|
||||||
@ -89,7 +113,10 @@ export default contain({
|
|||||||
url: formatValue(url, isValidURL),
|
url: formatValue(url, isValidURL),
|
||||||
logo: formatValue(logo, isValidURL),
|
logo: formatValue(logo, isValidURL),
|
||||||
company: formatValue(company, makeRequired(isAscii)),
|
company: formatValue(company, makeRequired(isAscii)),
|
||||||
highlight: formatValue(highlight, null, 'bool')
|
highlight: formatValue(highlight, null, 'bool'),
|
||||||
|
isFullStackCert: formatValue(isFullStackCert, null, 'bool'),
|
||||||
|
isFrontEndCert: formatValue(isFrontEndCert, null, 'bool'),
|
||||||
|
isRemoteOk: formatValue(isRemoteOk, null, 'bool')
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
subscribeOnWillMount() {
|
subscribeOnWillMount() {
|
||||||
@ -109,7 +136,10 @@ export default contain({
|
|||||||
url: PropTypes.object,
|
url: PropTypes.object,
|
||||||
logo: PropTypes.object,
|
logo: PropTypes.object,
|
||||||
company: PropTypes.object,
|
company: PropTypes.object,
|
||||||
highlight: PropTypes.object
|
highlight: PropTypes.object,
|
||||||
|
isFullStackCert: PropTypes.object,
|
||||||
|
isFrontEndCert: PropTypes.object,
|
||||||
|
isRemoteOk: PropTypes.object
|
||||||
},
|
},
|
||||||
|
|
||||||
mixins: [History],
|
mixins: [History],
|
||||||
@ -131,6 +161,9 @@ export default contain({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
jobActions,
|
||||||
|
|
||||||
|
// form values
|
||||||
position,
|
position,
|
||||||
locale,
|
locale,
|
||||||
description,
|
description,
|
||||||
@ -140,7 +173,9 @@ export default contain({
|
|||||||
logo,
|
logo,
|
||||||
company,
|
company,
|
||||||
highlight,
|
highlight,
|
||||||
jobActions
|
isFullStackCert,
|
||||||
|
isFrontEndCert,
|
||||||
|
isRemoteOk
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
// sanitize user output
|
// sanitize user output
|
||||||
@ -153,7 +188,10 @@ export default contain({
|
|||||||
url: uriInSingleQuotedAttr(url.value),
|
url: uriInSingleQuotedAttr(url.value),
|
||||||
logo: uriInSingleQuotedAttr(logo.value),
|
logo: uriInSingleQuotedAttr(logo.value),
|
||||||
company: inHTMLData(company.value),
|
company: inHTMLData(company.value),
|
||||||
highlight: !!highlight.value
|
highlight: !!highlight.value,
|
||||||
|
isFrontEndCert: !!isFrontEndCert.value,
|
||||||
|
isFullStackCert: !!isFullStackCert.value,
|
||||||
|
isRemoteOk: !!isRemoteOk.value
|
||||||
};
|
};
|
||||||
|
|
||||||
const job = Object.keys(jobValues).reduce((accu, prop) => {
|
const job = Object.keys(jobValues).reduce((accu, prop) => {
|
||||||
@ -191,6 +229,9 @@ export default contain({
|
|||||||
logo,
|
logo,
|
||||||
company,
|
company,
|
||||||
highlight,
|
highlight,
|
||||||
|
isFrontEndCert,
|
||||||
|
isFullStackCert,
|
||||||
|
isRemoteOk,
|
||||||
jobActions: { handleForm }
|
jobActions: { handleForm }
|
||||||
} = this.props;
|
} = this.props;
|
||||||
const { handleChange } = this;
|
const { handleChange } = this;
|
||||||
@ -298,14 +339,43 @@ export default contain({
|
|||||||
<Input
|
<Input
|
||||||
checked={ highlight.value }
|
checked={ highlight.value }
|
||||||
label={ hightlightCopy }
|
label={ hightlightCopy }
|
||||||
labelClassName={ 'col-sm-offset-1 col-sm-6' }
|
|
||||||
onChange={
|
onChange={
|
||||||
({ target: { checked } }) => handleForm({
|
({ target: { checked } }) => handleForm({
|
||||||
highlight: !!checked
|
highlight: !!checked
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
type='checkbox'
|
type='checkbox'
|
||||||
wrapperClassName='jobs-checkbox-spacer' />
|
wrapperClassName={ checkboxClass } />
|
||||||
|
<Input
|
||||||
|
checked={ isFrontEndCert.value }
|
||||||
|
label={ isFrontEndCopy }
|
||||||
|
onChange={
|
||||||
|
({ target: { checked } }) => handleForm({
|
||||||
|
isFrontEndCert: !!checked
|
||||||
|
})
|
||||||
|
}
|
||||||
|
type='checkbox'
|
||||||
|
wrapperClassName={ checkboxClass } />
|
||||||
|
<Input
|
||||||
|
checked={ isFullStackCert.value }
|
||||||
|
label={ isFullStackCopy }
|
||||||
|
onChange={
|
||||||
|
({ target: { checked } }) => handleForm({
|
||||||
|
isFullStackCert: !!checked
|
||||||
|
})
|
||||||
|
}
|
||||||
|
type='checkbox'
|
||||||
|
wrapperClassName={ checkboxClass } />
|
||||||
|
<Input
|
||||||
|
checked={ isRemoteOk.value }
|
||||||
|
label={ isRemoteCopy }
|
||||||
|
onChange={
|
||||||
|
({ target: { checked } }) => handleForm({
|
||||||
|
isRemoteOk: !!checked
|
||||||
|
})
|
||||||
|
}
|
||||||
|
type='checkbox'
|
||||||
|
wrapperClassName={ checkboxClass } />
|
||||||
<div className='spacer' />
|
<div className='spacer' />
|
||||||
<Row>
|
<Row>
|
||||||
<Col
|
<Col
|
||||||
|
@ -66,6 +66,21 @@
|
|||||||
"postedOn": {
|
"postedOn": {
|
||||||
"type": "date",
|
"type": "date",
|
||||||
"defaultFn": "now"
|
"defaultFn": "now"
|
||||||
|
},
|
||||||
|
"isFrontEndCert": {
|
||||||
|
"type": "boolean",
|
||||||
|
"defaut": false,
|
||||||
|
"description": "Camper must be front end certified to apply"
|
||||||
|
},
|
||||||
|
"isFullStackCert": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "Camper must be full stack certified to apply"
|
||||||
|
},
|
||||||
|
"isRemoteOk": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "Camper may work remotely"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"validations": [],
|
"validations": [],
|
||||||
|
Reference in New Issue
Block a user