Merge branch 'master' into ux-improvements

Conflicts:
	controllers/bonfire.js
	controllers/resources.js
	views/bonfire/show.jade
This commit is contained in:
Michael Q Larson
2015-03-29 13:05:39 -07:00
9 changed files with 191 additions and 53 deletions

View File

@ -4,6 +4,7 @@ var _ = require('lodash'),
User = require('./../models/User'),
resources = require('./resources'),
R = require('ramda');
MDNlinks = require('./../seed_data/bonfireMDNlinks');
/**
* Bonfire controller
@ -100,24 +101,25 @@ exports.returnIndividualBonfire = function(req, res, next) {
if (dashedNameFull != dashedName) {
return res.redirect('../bonfires/' + dashedNameFull);
}
res.render('bonfire/show', {
completedWith: null,
title: bonfire.name,
dashedName: dashedName,
name: bonfire.name,
difficulty: Math.floor(+bonfire.difficulty),
brief: bonfire.description[0],
details: bonfire.description.slice(1),
tests: bonfire.tests,
challengeSeed: bonfire.challengeSeed,
cc: !!req.user,
progressTimestamps: req.user ? req.user.progressTimestamps : undefined,
verb: resources.randomVerb(),
phrase: resources.randomPhrase(),
compliment: resources.randomCompliment(),
bonfires: bonfire,
bonfireHash: bonfire._id
completedWith: null,
title: bonfire.name,
dashedName: dashedName,
name: bonfire.name,
difficulty: Math.floor(+bonfire.difficulty),
brief: bonfire.description[0],
details: bonfire.description.slice(1),
tests: bonfire.tests,
challengeSeed: bonfire.challengeSeed,
cc: !!req.user,
points: req.user ? req.user.points : undefined,
verb: resources.randomVerb(),
phrase: resources.randomPhrase(),
compliment: resources.randomCompliment(),
bonfires: bonfire,
bonfireHash: bonfire._id,
MDNkeys: bonfire.MDNlinks,
MDNlinks: getMDNlinks(bonfire.MDNlinks)
});
});
};
@ -157,6 +159,23 @@ function randomString() {
return randomstring;
}
/**
* Helper function to populate the MDN links array.
*/
function getMDNlinks(links) {
// takes in an array of links, which are strings
var populatedLinks = [];
// for each key value, push the corresponding link from the MDNlinks object into a new array
links.forEach(function(value, index) {
populatedLinks.push(MDNlinks[value]);
});
return populatedLinks;
};
/**
*
*/

View File

@ -150,6 +150,21 @@ module.exports = {
});
},
trelloCalls: function(req, res, next) {
request('https://trello.com/1/boards/BA3xVpz9/cards?key=' + secrets.trello.key, function(err, status, trello) {
if (err) { return next(err); }
trello = (status && status.statusCode == 200) ? (JSON.parse(trello)) : "Can't connect to to Trello";
res.end(JSON.stringify(trello));
});
},
bloggerCalls: function(req, res, next) {
request('https://www.googleapis.com/blogger/v3/blogs/2421288658305323950/posts?key=' + secrets.blogger.key, function (err, status, blog) {
if (err) { return next(err); }
blog = (status && status.statusCode == 200) ? JSON.parse(blog) : "Can't connect to Blogger";
res.end(JSON.stringify(blog));
});
},
githubCalls: function(req, res) {
var githubHeaders = {headers: {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1521.3 Safari/537.36'}, port:80 };
request('https://api.github.com/repos/freecodecamp/freecodecamp/pulls?client_id=' + secrets.github.clientID + '&client_secret=' + secrets.github.clientSecret, githubHeaders, function(err, status1, pulls) {

View File

@ -1,6 +1,5 @@
{
"announcements": [
["We'll live-stream our Camp-wide Meeting Saturday, March 27 at Noon EST. We'll show some of Free Code Camp's new features, and campers will show what they're building.", "http://twitch.tv/freecodecamp"],
["Some of Code School's courses are no longer free. We're switching to NodeSchool.io for our Node.js and Express.js challenges.", "http://freecodecamp.com/nodeschool-challenges"],
["Screen Hero is now free on Windows and Mac! Follow these special instructions to install it.", "http://freecodecamp.com/install-screenhero"]
],