diff --git a/app.js b/app.js index 04df5cdf07..e431ac361f 100755 --- a/app.js +++ b/app.js @@ -43,6 +43,7 @@ var express = require('express'), fieldGuideController = require('./controllers/fieldGuide'), challengeMapController = require('./controllers/challengeMap'), challengeController = require('./controllers/challenge'), + jobsController = require('./controllers/jobs'), /** * Stories @@ -159,9 +160,8 @@ var trusted = [ '*.ytimg.com', '*.bitly.com', 'http://cdn.inspectlet.com/', - 'http://hn.inspectlet.com/', - '*.simplyhired.com', - '*.simply-partner.com' + 'wss://inspectletws.herokuapp.com/', + 'http://hn.inspectlet.com/' ]; app.use(helmet.csp({ @@ -269,8 +269,6 @@ app.get('/pmi-acp-agile-project-managers-form', app.get('/nonprofits', resourcesController.nonprofits); -app.get('/nonprofits/getNonprofitList', nonprofitController.showAllNonprofits); - app.get('/nonprofits-form', resourcesController.nonprofitsForm); app.get('/map', @@ -354,7 +352,7 @@ app.get( app.get( '/jobs', - resourcesController.jobs + jobsController.jobsDirectory ); app.get( diff --git a/controllers/jobs.js b/controllers/jobs.js new file mode 100644 index 0000000000..5d0cd348cf --- /dev/null +++ b/controllers/jobs.js @@ -0,0 +1,14 @@ +var moment = require('moment'), + Job = require('./../models/Job'), + resources = require('./resources'); + +exports.jobsDirectory = function(req, res, next) { + Job.find({}, function(err, jobs) { + if (err) { return next(err); } + + res.render('jobs/directory', { + title: 'Junior JavaScript Engineer Jobs', + jobs: jobs + }); + }); +}; diff --git a/controllers/nonprofits.js b/controllers/nonprofits.js index 77a2f04a8f..d0a3aa0798 100644 --- a/controllers/nonprofits.js +++ b/controllers/nonprofits.js @@ -13,92 +13,6 @@ exports.nonprofitsDirectory = function(req, res, next) { }); }; -exports.areYouWithARegisteredNonprofit = function(req, res) { - res.render('nonprofits/are-you-with-a-registered-nonprofit', { - title: 'Are you with a with a registered nonprofit', - step: 1 - }); -}; - -exports.areTherePeopleThatAreAlreadyBenefitingFromYourServices = - function(req, res) { - res.render( - 'nonprofits/' + - 'are-there-people-that-are-already-benefiting-from-your-services', - { - title: 'Are there people already benefiting from your services', - step: 2 - } - ); - }; - -exports.okWithJavaScript = function(req, res) { - res.render('nonprofits/ok-with-javascript', { - title: 'Are you OK with us using JavaScript', - step: 3 - }); -}; - -exports.inExchangeWeAsk = function(req, res) { - res.render('nonprofits/in-exchange-we-ask', { - title: 'In exchange we ask that you ...', - step: 4 - }); -}; - -exports.howCanFreeCodeCampHelpYou = function(req, res) { - res.render('nonprofits/how-can-free-code-camp-help-you', { - title: 'Are you with a with a registered nonprofit', - step: 5 - }); -}; - -exports.whatDoesYourNonprofitDo = function(req, res) { - res.render('nonprofits/what-does-your-nonprofit-do', { - existingParams: req.params, - title: 'What does your nonprofit do?', - step: 6 - }); -}; - -exports.linkUsToYourWebsite = function(req, res) { - res.render('nonprofits/link-us-to-your-website', { - title: 'Link us to your website', - step: 7 - }); -}; - -exports.tellUsYourEmail = function(req, res) { - res.render('nonprofits/tell-us-your-email', { - title: 'Tell us your email', - step: 8 - }); -}; - -exports.tellUsYourName = function(req, res) { - res.render('nonprofits/tell-us-your-name', { - title: 'Tell us your name', - step: 9 - }); -}; - -exports.yourNonprofitProjectApplicationHasBeenSubmitted = function(req, res) { - res.render( - 'nonprofits/your-nonprofit-project-application-has-been-submitted', - { - title: 'Your Nonprofit Project application has been submitted!', - step: 10, - getBackDay: moment().weekday(5).format('dddd') - } - ); -}; - -exports.otherSolutions = function(req, res) { - res.render('nonprofits/other-solutions', { - title: 'Here are some other possible solutions for you' - }); -}; - exports.returnIndividualNonprofit = function(req, res, next) { var dashedName = req.params.nonprofitName; var nonprofitName = dashedName.replace(/\-/g, ' '); @@ -179,12 +93,6 @@ exports.returnIndividualNonprofit = function(req, res, next) { ); }; -exports.showAllNonprofits = function(req, res) { - var data = {}; - data.nonprofitsList = resources.allNonprofitNames(); - res.send(data); -}; - exports.interestedInNonprofit = function(req, res, next) { if (req.user) { Nonprofit.findOne( diff --git a/controllers/resources.js b/controllers/resources.js index 7ccc73e9a8..28030eacf1 100644 --- a/controllers/resources.js +++ b/controllers/resources.js @@ -234,12 +234,6 @@ module.exports = { } }, - jobs: function jobs(req, res) { - res.render('resources/jobs', { - title: 'Job Board for Front End Developer and Full Stack JavaScript Developer Jobs' - }); - }, - jobsForm: function jobsForm(req, res) { res.render('resources/jobs-form', { title: 'Employer Partnership Form for Job Postings, Recruitment and Corporate Sponsorships' @@ -607,8 +601,8 @@ module.exports = { var challenge = req.body.payload.challenge; slack.send({ - text: "*" + userName + "* wants help with " + challenge + ". " + - code + "Hey, *" + userName + "*, if no one helps you right " + + text: "*@" + userName + "* wants help with " + challenge + ". " + + code + "Hey, *@" + userName + "*, if no one helps you right " + "away, try typing out your problem in detail to me. Like this: " + "http://en.wikipedia.org/wiki/Rubber_duck_debugging", channel: '#help', @@ -622,11 +616,11 @@ module.exports = { var userName = req.user.profile.username; var challenge = req.body.payload.challenge; slack.send({ - text: "Anyone want to pair with @" + userName + " on " + challenge + - "?\nMake sure you install Screen Hero here:" + + text: "Anyone want to pair with *@" + userName + "* on " + challenge + + "?\nMake sure you install Screen Hero here: " + "http://freecodecamp.com/field-guide/how-do-i-install-screenhero\n" + - "Then start your pair program session with *" + userName + - "* by typing \"/hero @" + userName + "\" into Slack.\n And *"+ userName + + "Then start your pair program session with *@" + userName + + "* by typing \"/hero @" + userName + "\" into Slack.\n And *@"+ userName + "*, be sure to launch Screen Hero, then keep coding. " + "Another camper may pair with you soon.", channel: '#letspair', diff --git a/models/Job.js b/models/Job.js new file mode 100644 index 0000000000..9f5f444e14 --- /dev/null +++ b/models/Job.js @@ -0,0 +1,18 @@ +var mongoose = require('mongoose'); +var secrets = require('../config/secrets'); + +/** + * + * @type {exports.Schema} + */ + +var Long = mongoose.Types.Long; +var jobSchema = new mongoose.Schema({ + position: String, + company: String, + logoUrl: String, + postingUrl: String, + copy: Array +}); + +module.exports = mongoose.model('Job', jobSchema); diff --git a/public/js/main_0.0.2.js b/public/js/main_0.0.2.js index b2791bdaeb..2d92d33321 100644 --- a/public/js/main_0.0.2.js +++ b/public/js/main_0.0.2.js @@ -17,7 +17,7 @@ $(document).ready(function() { setCSRFToken($('meta[name="csrf-token"]').attr('content')); $('#i-want-help').on('click', function() { - /* + $('#help-modal').modal('hide'); var editorValue = editor.getValue(); var currentLocation = window.location.href; $.post( @@ -34,11 +34,10 @@ $(document).ready(function() { } } ); - */ }); $('#i-want-help-editorless').on('click', function() { - /* + $('#help-editorless-modal').modal('hide'); var currentLocation = window.location.href; $.post( '/get-help', @@ -53,14 +52,15 @@ $(document).ready(function() { } } ); - */ }); $('#report-issue').on('click', function() { - window.open('https://github.com/freecodecamp/freecodecamp/issues/new?title=Challenge '+ window.location.href +' has an issue &body=Please%20tell%20us%20in%20detail%20here%20how%20we%20can%20make%20this%20challenge%20better.', '_blank') + $('#issue-modal').modal('hide'); + window.open('https://github.com/freecodecamp/freecodecamp/issues/new?&body=Challenge '+ window.location.href +' has an issue. Please describe how to reproduce it, and include links to screen shots if possible.', '_blank') }); $('#i-want-to-pair').on('click', function() { + $('#pair-modal').modal('hide'); var currentLocation = window.location.href; $.post( '/get-pair', @@ -138,6 +138,26 @@ $(document).ready(function() { $('#complete-courseware-dialog').modal('show'); }); + $('#completed-courseware-editorless').on('click', function() { + $('#complete-courseware-editorless-dialog').modal('show'); + }); + + $('#trigger-pair-modal').on('click', function() { + $('#pair-modal').modal('show'); + }); + + $('#trigger-help-modal').on('click', function() { + $('#help-modal').modal('show'); + }); + + $('#trigger-help-editorless-modal').on('click', function() { + $('#help-editorless-modal').modal('show'); + }); + + $('#trigger-issue-modal').on('click', function() { + $('#issue-modal').modal('show'); + }); + $('#completed-zipline-or-basejump').on('click', function() { $('#complete-zipline-or-basejump-dialog').modal('show'); }); @@ -145,6 +165,11 @@ $(document).ready(function() { $('#complete-courseware-dialog').on('hidden.bs.modal', function() { editor.focus(); }); + + $('#complete-challenge-dialog').on('hidden.bs.modal', function() { + editor.focus(); + }); + var challengeTypes = { 'HTML_CSS_JQ': 0, 'JAVASCRIPT': 1, @@ -160,7 +185,6 @@ $(document).ready(function() { case challengeTypes.HTML_CSS_JQ: case challengeTypes.JAVASCRIPT: case challengeTypes.VIDEO: - console.log(challenge_Id); $.post( '/completed-challenge/', { diff --git a/seed_data/challenges/basic-html5-and-css.json b/seed_data/challenges/basic-html5-and-css.json index 7a3a07c47a..a05e23160c 100644 --- a/seed_data/challenges/basic-html5-and-css.json +++ b/seed_data/challenges/basic-html5-and-css.json @@ -16,7 +16,7 @@ "To enable the \"Go to my next challenge\" button on this exercise, change your h1 tag's text to say \"Hello World\" instead of \"Hello\"." ], "tests": [ - "assert.isTrue((/hello(\\s)+world/gi).test($('h1').text()), 'Your h1 element should have the text \"Hello World\"')" + "assert.isTrue((/hello(\\s)+world/gi).test($('h1').text()), 'Your h1 element should have the text \"Hello World\"')" ], "challengeSeed": [ "

Hello

" @@ -39,14 +39,15 @@ "difficulty": 0.010, "description": [ "Add an h2 tag that says \"CatPhotoApp\" to create a second HTML element below your \"Hello World\" h1 element.", - "The h2 element you enter will create an h2 element on the website.", + "The h2 element you enter will create an h2 element on the website.", "This element tells the browser how to render the text that it contains.", "h2 elements are slightly smaller than h1 elements. There are also h3, h4, h5 and h6 elements." ], "tests": [ - "assert(($('h2').length > 0), 'Create an h2 elements.')", - "assert.isTrue((/cat(\\s)?photo(\\s)?app/gi).test($('h2').text()), 'Your h2 element should have the text \"CatPhotoApp\"')", - "assert.isTrue((/hello(\\s)+world/gi).test($('h1').text()), 'Your h1 element should have the text \"Hello World\"')" + "assert(($('h2').length > 0), 'Create an h2 element.')", + "assert(new RegExp('', 'gi').test(editor), 'Be sure to complete your h2 element with a closing tag.')", + "assert.isTrue((/cat(\\s)?photo(\\s)?app/gi).test($('h2').text()), 'Your h2 element should have the text \"CatPhotoApp\"')", + "assert.isTrue((/hello(\\s)+world/gi).test($('h1').text()), 'Your h1 element should have the text \"Hello World\"')" ], "challengeSeed": [ "

Hello World

" @@ -68,13 +69,14 @@ "name": "Waypoint: Inform with the Paragraph Element", "difficulty": 0.011, "description": [ - "Create a paragraph element below your h2 element, and give it the text \"Hello Paragraph\". As soon as you create the opening <p> tag, one of our tests will pass (since this is valid HTML). Be sure to close the element by adding a closing </p> tag.", - "Paragraph elements are the preferred element for normal-sized paragraph text on websites.", - "You can create a paragraph element like so: <p>I'm a p tag!</p>" + "Create a p element below your h2 element, and give it the text \"Hello Paragraph\".", + "p elements are the preferred element for normal-sized paragraph text on websites. P is short for \"paragraph\".", + "You can create a p element like so: <p>I'm a p tag!</p>" ], "tests": [ - "assert(($('p').length > 0), 'Create a paragraph element.')", - "assert.isTrue((/hello(\\s)+paragraph/gi).test($('p').text()), 'Your paragraph element should have the text \"Hello Paragraph\"')" + "assert(($('p').length > 0), 'Create a p element.')", + "assert.isTrue((/hello(\\s)+paragraph/gi).test($('p').text()), 'Your p element should have the text \"Hello Paragraph\".')", + "assert(new RegExp('

', 'gi').test(editor), 'Be sure to complete your p element with a closing tag.')" ], "challengeSeed": [ "

Hello World

", @@ -97,13 +99,13 @@ "name": "Waypoint: Visually Separate Elements with Line Breaks", "difficulty": 0.012, "description": [ - "Add a line break between the <h2> and <p> elements.", - "You can create a line break element with <br/>.", - "Note that <br/> has no closing tag. It is a self-closing element. See how a forward-slash precedes the closing bracket?", - "You'll encounter other self-closing element tags soon." + "Add a br element to your page, preferably between two of your elements.", + "br elements, also known as \"line break\" elements, can be created with <br>.", + "Note that <br> has no closing tag. It is a \"self-closing\" element.", + "You'll encounter other self-closing element tags soon." ], "tests": [ - "assert(($('br').length > 0), 'You should have a br element between your h2 and paragraph elements.')" + "assert(($('br').length > 0), 'Add a br element to your page, preferably between two of your elements.')" ], "challengeSeed": [ "

Hello World

", @@ -127,15 +129,16 @@ "name": "Waypoint: Uncomment HTML", "difficulty": 0.013, "description": [ - "Uncomment the h1, h2 and p elements.", + "Uncomment your h1, h2 and p elements.", "Commenting is a way that you can leave comments within your code without affecting the code itself.", "Commenting is also a convenient way to make code inactive without having to delete it entirely.", "You can start a comment with <!-- and end a comment with -->." ], "tests": [ - "assert($('h1').length > 0, 'The h1 element should not be commented. It should be visible in the browser.')", - "assert($('h2').length > 0, 'The h2 element should not be commented. It should be visible in the browser.')", - "assert($('p').length > 0, 'The paragraph element should not be commented. It should be visible in the browser.')" + "assert($('h1').length > 0, 'Make your h1 element visible on your page by uncommenting it.')", + "assert($('h2').length > 0, 'Make your h2 element visible on your page by uncommenting it.')", + "assert($('p').length > 0, 'Make your p element visible on your page by uncommenting it.')", + "assert(!new RegExp('-->', 'gi').test(editor), 'Be sure to delete the --> that ends the comment.')" ], "challengeSeed": [ "