From 173c5110264d41b8c4f6e39a4211752fd18fe19e Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Wed, 4 Nov 2015 13:04:17 -0800 Subject: [PATCH 1/9] Remove old cert stuff --- common/app/routes/Jobs/components/NewJob.jsx | 47 -------------------- 1 file changed, 47 deletions(-) diff --git a/common/app/routes/Jobs/components/NewJob.jsx b/common/app/routes/Jobs/components/NewJob.jsx index e4f01d73c4..a3535290d8 100644 --- a/common/app/routes/Jobs/components/NewJob.jsx +++ b/common/app/routes/Jobs/components/NewJob.jsx @@ -45,18 +45,6 @@ const hightlightCopy = ` Highlight my post to make it stand out. (+$50) `; -const foo = ` - This will narrow the field substantially with higher quality applicants -`; - -const isFullStackCopy = ` -Applicants must have earned Free Code Camp’s Full Stack Certification to apply.* -`; - -const isFrontEndCopy = ` -Applicants must have earned Free Code Camp’s Front End Certification to apply.* -`; - const isRemoteCopy = ` This job can be performed remotely. `; @@ -126,8 +114,6 @@ export default contain({ logo, company, isHighlighted, - isFullStackCert, - isFrontEndCert, isRemoteOk, howToApply } = form; @@ -140,8 +126,6 @@ export default contain({ logo: formatValue(formatUrl(logo), isValidURL), company: formatValue(company, makeRequired(isAscii)), isHighlighted: formatValue(isHighlighted, null, 'bool'), - isFullStackCert: formatValue(isFullStackCert, null, 'bool'), - isFrontEndCert: formatValue(isFrontEndCert, null, 'bool'), isRemoteOk: formatValue(isRemoteOk, null, 'bool'), howToApply: formatValue(howToApply, makeRequired(isAscii)) }; @@ -163,8 +147,6 @@ export default contain({ logo: PropTypes.object, company: PropTypes.object, isHighlighted: PropTypes.object, - isFullStackCert: PropTypes.object, - isFrontEndCert: PropTypes.object, isRemoteOk: PropTypes.object, howToApply: PropTypes.object }, @@ -199,8 +181,6 @@ export default contain({ logo, company, isHighlighted, - isFullStackCert, - isFrontEndCert, isRemoteOk, howToApply } = this.props; @@ -215,8 +195,6 @@ export default contain({ logo: formatUrl(uriInSingleQuotedAttr(logo.value), false), company: inHTMLData(company.value), isHighlighted: !!isHighlighted.value, - isFrontEndCert: !!isFrontEndCert.value, - isFullStackCert: !!isFullStackCert.value, isRemoteOk: !!isRemoteOk.value, howToApply: inHTMLData(howToApply.value) }; @@ -255,8 +233,6 @@ export default contain({ logo, company, isHighlighted, - isFrontEndCert, - isFullStackCert, isRemoteOk, howToApply, jobActions: { handleForm } @@ -311,26 +287,6 @@ export default contain({ type='textarea' value={ description.value } wrapperClassName={ inputClass } /> - handleForm({ - isFrontEndCert: !!checked - }) - } - type='checkbox' - wrapperClassName={ checkboxClass } /> - handleForm({ - isFullStackCert: !!checked - }) - } - type='checkbox' - wrapperClassName={ checkboxClass } /> - - * { foo } -
From 1251b14d9de849ec7ef1f7353171af6340a642a8 Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Wed, 4 Nov 2015 13:45:22 -0800 Subject: [PATCH 2/9] Add job cert buttons --- common/app/routes/Jobs/components/NewJob.jsx | 53 ++++++++++++++++++-- 1 file changed, 50 insertions(+), 3 deletions(-) diff --git a/common/app/routes/Jobs/components/NewJob.jsx b/common/app/routes/Jobs/components/NewJob.jsx index a3535290d8..6dce6817c0 100644 --- a/common/app/routes/Jobs/components/NewJob.jsx +++ b/common/app/routes/Jobs/components/NewJob.jsx @@ -45,6 +45,7 @@ const hightlightCopy = ` Highlight my post to make it stand out. (+$50) `; + const isRemoteCopy = ` This job can be performed remotely. `; @@ -113,6 +114,8 @@ export default contain({ url, logo, company, + isFrontEndCert, + isFullStackCert, isHighlighted, isRemoteOk, howToApply @@ -127,7 +130,9 @@ export default contain({ company: formatValue(company, makeRequired(isAscii)), isHighlighted: formatValue(isHighlighted, null, 'bool'), isRemoteOk: formatValue(isRemoteOk, null, 'bool'), - howToApply: formatValue(howToApply, makeRequired(isAscii)) + howToApply: formatValue(howToApply, makeRequired(isAscii)), + isFrontEndCert, + isFullStackCert }; }, subscribeOnWillMount() { @@ -148,6 +153,8 @@ export default contain({ company: PropTypes.object, isHighlighted: PropTypes.object, isRemoteOk: PropTypes.object, + isFrontEndCert: PropTypes.bool, + isFullStackCert: PropTypes.bool, howToApply: PropTypes.object }, @@ -180,6 +187,8 @@ export default contain({ url, logo, company, + isFrontEndCert, + isFullStackCert, isHighlighted, isRemoteOk, howToApply @@ -196,7 +205,9 @@ export default contain({ company: inHTMLData(company.value), isHighlighted: !!isHighlighted.value, isRemoteOk: !!isRemoteOk.value, - howToApply: inHTMLData(howToApply.value) + howToApply: inHTMLData(howToApply.value), + isFrontEndCert, + isFullStackCert }; const job = Object.keys(jobValues).reduce((accu, prop) => { @@ -235,8 +246,11 @@ export default contain({ isHighlighted, isRemoteOk, howToApply, + isFrontEndCert, + isFullStackCert, jobActions: { handleForm } } = this.props; + const { handleChange } = this; const labelClass = 'col-sm-offset-1 col-sm-2'; const inputClass = 'col-sm-6'; @@ -253,7 +267,40 @@ export default contain({ onSubmit={ this.handleSubmit }>
-

First, tell us about the position

+

First, select your ideal applicant:

+
+ + + + + + +
+ + + + + +
+

Tell us about the position

Date: Wed, 4 Nov 2015 14:23:42 -0800 Subject: [PATCH 3/9] Add logic to cert buttons --- common/app/routes/Jobs/components/NewJob.jsx | 28 +++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/common/app/routes/Jobs/components/NewJob.jsx b/common/app/routes/Jobs/components/NewJob.jsx index 6dce6817c0..9697e420c4 100644 --- a/common/app/routes/Jobs/components/NewJob.jsx +++ b/common/app/routes/Jobs/components/NewJob.jsx @@ -114,7 +114,7 @@ export default contain({ url, logo, company, - isFrontEndCert, + isFrontEndCert = true, isFullStackCert, isHighlighted, isRemoteOk, @@ -171,7 +171,7 @@ export default contain({ } }); - if (!valid) { + if (!valid || !props.isFrontEndCert && !props.isFullStackCert ) { debug('form not valid'); return; } @@ -234,6 +234,18 @@ export default contain({ handleForm({ [name]: value }); }, + handleCertClick(name) { + const { jobActions: { handleForm } } = this.props; + const otherButton = name === 'isFrontEndCert' ? + 'isFullStackCert' : + 'isFrontEndCert'; + + handleForm({ + [name]: true, + [otherButton]: false + }); + }, + render() { const { position, @@ -275,7 +287,11 @@ export default contain({ xs={ 6 } xsOffset={ 3 }> - @@ -305,9 +307,11 @@ export default contain({ - ); - } - return null; - }, - - render: function() { - var isDescription = this.props.description && - this.props.description.length > 1; - - return ( -
-

{ this.props.name }

-

-
- Difficulty:  - { this._renderFlames() } -
-

- - - -
-

{ this.props.brief }

-
- { this._renderMoreInfo(isDescription) } - { this._renderMoreInfoButton(isDescription) } -
-
- -
-
- -
-
- ); - } -}); - -module.exports = SidePanel; diff --git a/common/app/routes/Bonfires/executeBonfire.js b/common/app/routes/Bonfires/executeBonfire.js deleted file mode 100644 index 0d1795894a..0000000000 --- a/common/app/routes/Bonfires/executeBonfire.js +++ /dev/null @@ -1,27 +0,0 @@ -var debug = require('debug')('freecc:executebonfire'); -var { - addTests, - runTests, - testCode -} = require('../../utils'); - -module.exports = executeBonfire; - -function executeBonfire(userCode, tests, cb) { - - // TODO: move this into componentDidMount - // ga('send', 'event', 'Bonfire', 'ran-code', bonfireName); - var testSalt = Math.random(); - var { preppedCode, userTests } = addTests(userCode, tests, testSalt); - - debug('sending code to web worker for testing'); - testCode(preppedCode, function(err, data) { - if (err) { return cb(err); } - var results = runTests(userTests, data, testSalt); - debug('testing complete', results); - cb(null, { - output: data.output, - results - }); - }); -} diff --git a/common/app/routes/Bonfires/index.js b/common/app/routes/Bonfires/index.js deleted file mode 100644 index ec633552eb..0000000000 --- a/common/app/routes/Bonfires/index.js +++ /dev/null @@ -1,8 +0,0 @@ -/* -export default { - path: 'bonfires/(:bonfireName)' - getComponents(cb) { - // TODO(berks): add bonfire component - } -}; -*/ diff --git a/common/app/routes/Jobs/components/JobNotFound.jsx b/common/app/routes/Jobs/components/JobNotFound.jsx index b921dfd4dc..c4981d22f8 100644 --- a/common/app/routes/Jobs/components/JobNotFound.jsx +++ b/common/app/routes/Jobs/components/JobNotFound.jsx @@ -1,8 +1,8 @@ -import React, { createClass } from 'react'; +import React from 'react'; import { LinkContainer } from 'react-router-bootstrap'; import { Button, Row, Col, Panel } from 'react-bootstrap'; -export default createClass({ +export default React.createClass({ displayName: 'NoJobFound', render() { diff --git a/common/app/routes/Jobs/components/NewJob.jsx b/common/app/routes/Jobs/components/NewJob.jsx index 661ea70367..2d0bd08937 100644 --- a/common/app/routes/Jobs/components/NewJob.jsx +++ b/common/app/routes/Jobs/components/NewJob.jsx @@ -162,16 +162,16 @@ export default contain({ handleSubmit(e) { e.preventDefault(); - const props = this.props; + const pros = this.props; let valid = true; checkValidity.forEach((prop) => { // if value exist, check if it is valid - if (props[prop].value && props[prop].type !== 'boolean') { - valid = valid && !!props[prop].valid; + if (pros[prop].value && pros[prop].type !== 'boolean') { + valid = valid && !!pros[prop].valid; } }); - if (!valid || !props.isFrontEndCert && !props.isFullStackCert ) { + if (!valid || !pros.isFrontEndCert && !pros.isFullStackCert ) { debug('form not valid'); return; } diff --git a/common/app/routes/Jobs/components/TwitterBtn.jsx b/common/app/routes/Jobs/components/TwitterBtn.jsx index fb5f8edf12..7998353ffc 100644 --- a/common/app/routes/Jobs/components/TwitterBtn.jsx +++ b/common/app/routes/Jobs/components/TwitterBtn.jsx @@ -1,4 +1,4 @@ -import React, { createClass, PropTypes } from 'react'; +import React, { PropTypes } from 'react'; import { Button } from 'react-bootstrap'; const followLink = 'https://twitter.com/intent/follow?' + @@ -9,7 +9,7 @@ function commify(count) { return Number(count).toLocaleString('en'); } -export default createClass({ +export default React.createClass({ displayName: 'FollowButton', diff --git a/common/app/shared/displayCode/Display.jsx b/common/app/shared/displayCode/Display.jsx deleted file mode 100644 index 9eb60db8da..0000000000 --- a/common/app/shared/displayCode/Display.jsx +++ /dev/null @@ -1,51 +0,0 @@ -var React = require('react'), - Tailspin = require('tailspin'); - -var Editor = React.createClass({ - - propTypes: { - value: React.PropTypes.string - }, - - getDefaultProps: function() { - return { - value: [ - '/**', - '* Your output will go here.', - '* Console.log() -type statements', - '* will appear in your browser\'s', - '* DevTools JavaScript console.', - '**/' - ].join('\n') - }; - }, - - render: function() { - var value = this.props.value; - var options = { - lineNumbers: false, - lineWrapping: true, - mode: 'text', - readOnly: 'noCursor', - textAreaClassName: 'hide-textarea', - theme: 'monokai', - value: value - }; - - var config = { - setSize: ['100%', '100%'] - }; - - return ( -
-
- -
-
- ); - } -}); - -module.exports = Editor; diff --git a/common/app/shared/displayCode/index.js b/common/app/shared/displayCode/index.js deleted file mode 100644 index d3e3560174..0000000000 --- a/common/app/shared/displayCode/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./Display.jsx'); diff --git a/common/app/shared/editor/Editor.jsx b/common/app/shared/editor/Editor.jsx deleted file mode 100644 index 8e72f5d4a0..0000000000 --- a/common/app/shared/editor/Editor.jsx +++ /dev/null @@ -1,91 +0,0 @@ -var React = require('react'), - debug = require('debug')('freecc:comp:editor'), - jshint = require('jshint').JSHINT, - Tailspin = require('tailspin'); - -var Editor = React.createClass({ - - propTypes: { - onValueChange: React.PropTypes.func, - value: React.PropTypes.string - }, - - getDefaultProps: function() { - return { - value: 'console.log(\'freeCodeCamp is awesome\')' - }; - }, - - getInitialState: function() { - return { - value: this.props.value - }; - }, - - render: function() { - var options = { - autoCloseBrackets: true, - gutters: ['CodeMirror-lint-markers'], - lint: true, - linter: jshint, - lineNumbers: true, - lineWrapping: true, - mode: 'javascript', - matchBrackets: true, - runnable: true, - scrollbarStyle: 'null', - theme: 'monokai', - textAreaClassName: 'hide-textarea', - value: this.state.value, - onChange: e => { - this.setState({ value: e.target.value}); - if (typeof this.props.onValueChange === 'function') { - this.props.onValueChange(e.target.value); - } - } - }; - - var config = { - setSize: ['100%', 'auto'], - extraKeys: { - Tab: function(cm) { - debug('tab pressed'); - if (cm.somethingSelected()) { - cm.indentSelection('add'); - } else { - var spaces = new Array(cm.getOption('indentUnit') + 1).join(' '); - cm.replaceSelection(spaces); - } - }, - 'Shift-Tab': function(cm) { - debug('shift-tab pressed'); - if (cm.somethingSelected()) { - cm.indentSelection('subtract'); - } else { - var spaces = new Array(cm.getOption('indentUnit') + 1).join(' '); - cm.replaceSelection(spaces); - } - }, - 'Ctrl-Enter': function() { - debug('C-enter pressed'); - // execute bonfire action - return false; - } - } - }; - - return ( -
-
-
- -
-
-
- ); - } -}); - -module.exports = Editor; diff --git a/common/app/shared/editor/index.js b/common/app/shared/editor/index.js deleted file mode 100644 index 5e431fabff..0000000000 --- a/common/app/shared/editor/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./Editor.jsx'); diff --git a/package.json b/package.json index ef06329143..4e36abf74f 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "lint-server": "jsonlint -q server/*.json", "lint-resources": "jsonlint -q server/resources/*.json", "lint-utils": "jsonlint -q server/utils/*.json", - "lint-js": "eslint --ext=.js,.jsx server/ common/models common/utils config/", + "lint-js": "eslint --ext=.js,.jsx server/ common/ common/utils config/ client/", "lint-json": "npm run lint-server && npm run lint-nonprofits && npm run lint-challenges && npm run lint-resources && npm run lint-utils", "test-challenges": "babel-node seed/test-challenges.js | tnyan", "pretest": "npm run lint",