diff --git a/app.js b/app.js index 1cd47c6a8e..3d6e59fcc9 100644 --- a/app.js +++ b/app.js @@ -351,6 +351,16 @@ app.get('/nonprofits/your-nonprofit-project-application-has-been-submitted', non app.get('/nonprofits/other-solutions', nonprofitController.otherSolutions); +app.get( + '/nonprofits/:nonprofitName', + nonprofitController.returnIndividualNonprofit +); + +app.get( + '/nonprofits', + nonprofitController.showAllNonprofits +); + app.get( '/done-with-first-100-hours', passportConf.isAuthenticated, @@ -496,6 +506,8 @@ app.get('/bonfire', function(req, res) { res.redirect(301, '/playground'); }); +app.post('/completed-bonfire/', bonfireController.completedBonfire); + /** * Wiki related routes */ @@ -507,10 +519,9 @@ app.get( app.get( '/wiki', - wikiController.showAllWikis + wikiController.returnHomeWiki ); -app.post('/completed-bonfire/', bonfireController.completedBonfire); /** * Courseware related routes @@ -548,6 +559,7 @@ app.post('/account/delete', userController.postDeleteAccount); app.get('/account/unlink/:provider', userController.getOauthUnlink); app.get('/sitemap.xml', resourcesController.sitemap); + /** * OAuth sign-in routes. */ diff --git a/controllers/nonprofits.js b/controllers/nonprofits.js index 4ceda4de1e..502dd05b56 100644 --- a/controllers/nonprofits.js +++ b/controllers/nonprofits.js @@ -1,17 +1,8 @@ var async = require('async'), - User = require('../models/User'), - Challenge = require('./../models/Challenge'), - Bonfire = require('./../models/Bonfire'), - Story = require('./../models/Story'), - Comment = require('./../models/Comment'), resources = require('./resources.json'), - steps = resources.steps, secrets = require('./../config/secrets'), moment = require('moment'), - https = require('https'), debug = require('debug')('freecc:cntr:resources'), - cheerio = require('cheerio'), - request = require('request'), R = require('ramda'); exports.nonprofitsHome = function(req, res) { @@ -99,3 +90,39 @@ exports.otherSolutions = function(req, res) { 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, ' '); + + Nonprofit.find({'name': new RegExp(nonprofitName, 'i')}, function(err, nonprofit) { + if (err) { + next(err); + } + + if (nonprofit.length < 1) { + req.flash('errors', { + msg: "404: We couldn't find a nonprofit with that name. Please double check the name." + }); + + return res.redirect('/nonprofits'); + } + + nonprofit = nonprofit.pop(); + var dashedNameFull = nonprofit.name.toLowerCase().replace(/\s/g, '-'); + if (dashedNameFull != dashedName) { + return res.redirect('../nonprofit/' + dashedNameFull); + } + res.render('nonprofits/show', { + title: nonprofit.name, + description: nonprofit.description.join('') + }); + }); +}; + +exports.showAllNonprofits = function(req, res) { + var data = {}; + data.nonprofitList = resources.allNonprofitNames(); + res.send(data); +}; diff --git a/controllers/wiki.js b/controllers/wiki.js index f7bf1a22c4..360b748409 100644 --- a/controllers/wiki.js +++ b/controllers/wiki.js @@ -23,7 +23,7 @@ exports.returnIndividualWiki = function(req, res, next) { } wiki = wiki.pop(); - var dashedNameFull = wiki.name.toLowerCase().replace(/\s/g, '-'); + var dashedNameFull = wiki.name.toLowerCase().replace(/\s/g, '-').replace(/\?/g, ''); if (dashedNameFull != dashedName) { return res.redirect('../wiki/' + dashedNameFull); } @@ -39,3 +39,31 @@ exports.showAllWikis = function(req, res) { data.wikiList = resources.allWikiNames(); res.send(data); }; + +exports.returnHomeWiki = function(req, res) { + var dashedName = req.params.wikiName; + + Wiki.find({'name': 'A Guide to our Wiki'}, function(err, wiki) { + if (err) { + next(err); + } + + if (wiki.length < 1) { + req.flash('errors', { + msg: "404: We couldn't find a wiki entry with that name. Please double check the name." + }); + + return res.redirect('/wiki'); + } + + wiki = wiki.pop(); + var dashedNameFull = wiki.name.toLowerCase().replace(/\s/g, '-'); + if (dashedNameFull != dashedName) { + return res.redirect('../wiki/' + dashedNameFull); + } + res.render('wiki/show', { + title: wiki.name, + description: wiki.description.join('') + }); + }); +}; diff --git a/package.json b/package.json index b535c5739b..f3209e0e29 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "method-override": "^2.3.0", "moment": "^2.8.4", "mongodb": "^1.4.33", - "mongoose": "^4.0.0", + "mongoose": "^4.0.1", "mongoose-long": "0.0.2", "morgan": "^1.5.0", "newrelic": "^1.13.3", diff --git a/seed_data/wikis.json b/seed_data/wikis.json index 853b3391bd..1236041247 100644 --- a/seed_data/wikis.json +++ b/seed_data/wikis.json @@ -1,4 +1,138 @@ [ + { + "_id": "bd7158d9c441eddfaeb5bdef", + "name": "A Guide to our Wiki", + "description": [ + "
First, you'll learn basic web design tools like:", + "
Then you'll learn computer science and the art of programming:", + "
You'll spend the last half of Free Code Camp using Agile Methodologies and Full Stack JavaScript to build projects for nonprofits:", + "
At the end of Free Code Camp, you will have pair programmed around 1,000 hours with dozens of other students, built a portfolio of projects that people are actively using, and a roster of glowing references from nonprofits you've helped. This is more coding than most coding bootcamps provide, and on average, 75% of bootcamp graduates get software engineering jobs within 6 months, and earn an average annual salary of $76,000.
", + "It takes about 1,000 hours of coding to develop the skills you'll need to get an entry level software engineering job. Most coding bootcamps try to jam all this into 12 weeks of intensive study. Free Code Camp is fully online, and there will always be other people at your skill level that you can pair program with, so you can learn at your own pace. Here are some example coding schedules:
", + "Time budgeted | ", + "Hours per week | ", + "Weeks to complete | ", + " ", + "
---|---|---|
Weekends | ", + "10 hours/week | ", + "100 weeks (2 years) | ", + "
Nights and Weekends | ", + "20 hours/week | ", + "50 weeks (1 year) | ", + "
Full time | ", + "40 hours/week | ", + "25 weeks (6 months) | ", + "
Traditional Bootcamp Pacing | ", + "80 hours/week | ", + "12 weeks (3 months) | ", + "
Like JavaScript, Ruby and Python are high-level scripting languages that can be used for full stack web development. But even if you learned these languages, you'd still need to learn JavaScript. That's because JavaScript is the only language that runs in web browsers. JavaScript has been around for 20 years, and it is still growing in popularity. Because of this, JavaScript has more tools and online learning resources than any other language.
", + "Pair programming is where two people code together on one computer. You discuss different approaches to solving problems, and keep each other motivated. The result is better code than either of you could have written by yourselves. Because of its benefits, many engineers pair program full time. And it's the best way to learn coding. Thanks to tools that allow two people to share mouse and keyboard inputs, you can pair program with a friend without needing to be in the same room.
", + "By pair programming with other Free Code Camp students on our coding challenges. Eventually, you'll work with people at nonprofits to build real-life software solutions.
", + "We are completely free for both students and for nonprofits.
", + "Our name is Free Code Camp. We are a free code camp. If you had to pay us (or sign over future earnings), we'd have to change our name. And we are not going to do that.
", + "We don't make any money at all. Everyone working on our community and our open source projects is a volunteer.
", + "We plan to eventually cover our operational costs by earning job placement bonuses from companies who hire our graduates. Note that we will not actually garnish any wages from our graduates - employers are already paying recruiters thousands of dollars to find successful candidates. Employers will simply pay the recruitment bonus to Free Code Camp instead of paying a recruiter.
", + "Unlike coding bootcamps, anyone can study at Free Code Camp. We're not going to tell you that you can't become a software engineer. We believe the only person who should be able to tell you that is you.
", + "If you persevere, and keep working through our challenges and nonprofit projects, you will become an employable software engineer.
", + "