make new landing pages and forms for project managers and nonprofits

This commit is contained in:
Quincy Larson
2015-04-27 16:17:29 -07:00
parent c50ce70749
commit fd456ec9be
21 changed files with 209 additions and 489 deletions

View File

@@ -1,78 +0,0 @@
var nodemailer = require('nodemailer'),
debug = require('debug')('freecc:cntr:contact'),
secrets = require('../config/secrets');
var transporter = nodemailer.createTransport({
service: 'Mandrill',
auth: {
user: secrets.mandrill.user,
pass: secrets.mandrill.password
}
});
module.exports = {
/**
* GET /contact
* Contact form page.
*/
getNonprofitsForm: function(req, res) {
res.render('contact/nonprofits', {
title: 'Free Code Work for Nonprofits Project Submission Page'
});
},
/**
* POST /contact
* Send a contact form via Nodemailer.
*/
postNonprofitsForm: function(req, res) {
var mailOptions = {
to: 'team@freecodecamp.com',
name: req.body.name,
from: req.body.email,
subject: 'CodeNonprofit Project Idea from ' + req.body.name,
text: req.body.message
};
transporter.sendMail(mailOptions, function (err) {
if (err) {
req.flash('errors', {msg: err.message});
return res.redirect('/nonprofits');
}
req.flash('success', {msg: 'Email has been sent successfully!'});
res.redirect('/nonprofits');
});
},
getDoneWithFirst100Hours: function(req, res) {
if (req.user.points >= 53) {
res.render('contact/done-with-first-100-hours', {
title: 'Congratulations on finishing the first 100 hours of Free Code Camp!'
});
} else {
req.flash('errors', {msg: 'Hm... have you finished all the challenges?'});
res.redirect('/');
}
},
postDoneWithFirst100Hours: function(req, res) {
var mailOptions = {
to: 'team@freecodecamp.com',
name: 'Completionist',
from: req.body.email,
subject: 'Camper at ' + req.body.email + ' has completed the first 100 hours',
text: ''
};
transporter.sendMail(mailOptions, function (err) {
if (err) {
req.flash('errors', {msg: err.message});
return res.redirect('/done-with-first-100-hours');
}
req.flash('success', {msg: 'Email has been sent successfully!'});
res.redirect('/nonprofit-project-instructions');
});
}
};

View File

@@ -6,12 +6,6 @@ var async = require('async'),
debug = require('debug')('freecc:cntr:nonprofits'),
R = require('ramda');
exports.nonprofitsHome = function(req, res) {
res.render('nonprofits/home', {
title: 'A guide to our Nonprofit Projects'
});
};
exports.nonprofitsDirectory = function(req, res) {
Nonprofit.find({estimatedHours: { $gt: 0 } }, function(err, nonprofits) {
if (err) {

View File

@@ -155,6 +155,30 @@ module.exports = {
}
},
nonprofits: function nonprofits(req, res) {
res.render('resources/nonprofits', {
title: 'A guide to our Nonprofit Projects'
});
},
nonprofitsForm: function nonprofitsForm(req, res) {
res.render('resources/nonprofits-form', {
title: 'A guide to our Nonprofit Projects'
});
},
agileProjectManagers: function agileProjectManagers(req, res) {
res.render('resources/pmi-acp-agile-project-managers', {
title: 'Get Agile Project Management Experience for the PMI-ACP'
});
},
agileProjectManagersForm: function agileProjectManagersForm(req, res) {
res.render('resources/pmi-acp-agile-project-managers-form', {
title: 'Get Agile Project Management Experience for the PMI-ACP'
});
},
twitch: function twitch(req, res) {
res.render('resources/twitch', {
title: "Enter Free Code Camp's Chat Rooms"