From 0bf68fea5ffe377d3f196556b4e93f4fccd574a8 Mon Sep 17 00:00:00 2001 From: "A. Drake" Date: Mon, 23 Mar 2015 23:20:19 -0400 Subject: [PATCH 1/7] Links from database are being passed to the view. TODO create links --- controllers/bonfire.js | 23 +++++++++++++++++++++-- models/Bonfire.js | 3 ++- seed_data/bonfireMDNlinks.js | 22 ++++++++++++++++++++++ seed_data/bonfires.json | 3 ++- views/bonfire/show.jade | 1 + 5 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 seed_data/bonfireMDNlinks.js diff --git a/controllers/bonfire.js b/controllers/bonfire.js index 83431a390d..e600375752 100644 --- a/controllers/bonfire.js +++ b/controllers/bonfire.js @@ -2,7 +2,8 @@ var _ = require('lodash'), debug = require('debug')('freecc:cntr:bonfires'), Bonfire = require('./../models/Bonfire'), User = require('./../models/User'), - resources = require('./resources'); + resources = require('./resources') + MDNlinks = require('./../seed_data/bonfireMDNlinks'); /** * Bonfire controller @@ -110,7 +111,8 @@ exports.returnIndividualBonfire = function(req, res, next) { phrase: resources.randomPhrase(), compliment: resources.randomCompliment(), bonfires: bonfire, - bonfireHash: bonfire._id + bonfireHash: bonfire._id, + MDNlinks: getMDNlinks(bonfire.MDNlinks) }); }); @@ -147,6 +149,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; + +}; + /** * */ diff --git a/models/Bonfire.js b/models/Bonfire.js index cee4c8413a..8c0c4599ed 100644 --- a/models/Bonfire.js +++ b/models/Bonfire.js @@ -15,7 +15,8 @@ var bonfireSchema = new mongoose.Schema({ difficulty: String, description: Array, tests: Array, - challengeSeed: String + challengeSeed: String, + MDNlinks: [String] }); module.exports = mongoose.model('Bonfire', bonfireSchema); diff --git a/seed_data/bonfireMDNlinks.js b/seed_data/bonfireMDNlinks.js new file mode 100644 index 0000000000..9d80585185 --- /dev/null +++ b/seed_data/bonfireMDNlinks.js @@ -0,0 +1,22 @@ +// MDN Links + +/* These links are for Bonfires. Each key/value pair is used to render a Bonfire with approrpiate links. + Making an effort to keep methods in alphabetical order will help others behind you. + +*/ +var links = + { + // ========= GLOBAL OBJECTS + "Array-global" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array", + "Object-global" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object", + "String-global" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String", + + // ======== STRING METHODS + "string-split" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split", + + // ======== ARRAY METHODS + "array-join" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join", + "array-reverse": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse" + }; + +module.exports = links; diff --git a/seed_data/bonfires.json b/seed_data/bonfires.json index c298c97db7..00b9fa10bd 100644 --- a/seed_data/bonfires.json +++ b/seed_data/bonfires.json @@ -31,7 +31,8 @@ "You may need to turn the string into an array before you can reverse it.", "Your result must be a string." ], - "challengeSeed": "function reverseString(str) {\n return str;\r\n}\n\nreverseString('hello');" + "challengeSeed": "function reverseString(str) {\n return str;\r\n}\n\nreverseString('hello');", + "links" : ["String-global", "string-methods.split"] }, { "_id": "a302f7aae1aa3152a5b413bc", diff --git a/views/bonfire/show.jade b/views/bonfire/show.jade index 63e6be052e..007caa6fc5 100644 --- a/views/bonfire/show.jade +++ b/views/bonfire/show.jade @@ -92,6 +92,7 @@ block content var started = Math.floor(Date.now() / 1000); var _ = R; var dashed = !{JSON.stringify(dashedName)}; + var MDNlinks = !{JSON.stringify(MDNlinks)}; .col-xs-12.col-sm-12.col-md-8 #mainEditorPanel form.code From dbc57dd0cb0f32f47b7a66a0d65dcf935b520796 Mon Sep 17 00:00:00 2001 From: "A. Drake" Date: Mon, 23 Mar 2015 23:55:24 -0400 Subject: [PATCH 2/7] links iterated through on the page. TODO formatting and adding more data. --- controllers/bonfire.js | 1 + seed_data/bonfireMDNlinks.js | 14 ++++++++------ views/bonfire/show.jade | 7 ++++--- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/controllers/bonfire.js b/controllers/bonfire.js index e600375752..2615b5845b 100644 --- a/controllers/bonfire.js +++ b/controllers/bonfire.js @@ -112,6 +112,7 @@ exports.returnIndividualBonfire = function(req, res, next) { compliment: resources.randomCompliment(), bonfires: bonfire, bonfireHash: bonfire._id, + MDNkeys: bonfire.MDNlinks, MDNlinks: getMDNlinks(bonfire.MDNlinks) }); diff --git a/seed_data/bonfireMDNlinks.js b/seed_data/bonfireMDNlinks.js index 9d80585185..1bec840ac9 100644 --- a/seed_data/bonfireMDNlinks.js +++ b/seed_data/bonfireMDNlinks.js @@ -2,21 +2,23 @@ /* These links are for Bonfires. Each key/value pair is used to render a Bonfire with approrpiate links. Making an effort to keep methods in alphabetical order will help others behind you. + + The text of the key is what the link text will be, e.g. Global Array Object */ var links = { // ========= GLOBAL OBJECTS - "Array-global" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array", - "Object-global" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object", - "String-global" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String", + "Global Array Object" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array", + "Global Object" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object", + "Global String Object" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String", // ======== STRING METHODS - "string-split" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split", + "String.split()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split", // ======== ARRAY METHODS - "array-join" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join", - "array-reverse": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse" + "Array.join()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join", + "Array.reverse()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse" }; module.exports = links; diff --git a/views/bonfire/show.jade b/views/bonfire/show.jade index 007caa6fc5..96c573a84a 100644 --- a/views/bonfire/show.jade +++ b/views/bonfire/show.jade @@ -66,8 +66,8 @@ block content .bonfire-instructions p= brief #brief-instructions - #more-info.btn.btn-primary.btn-block.btn-primary-ghost - span.ion-arrow-down-b + #more-info.btn.btn-primary.btn-block.btn-primary-ghost + span.ion-arrow-down-b | More information #long-instructions.row.hide .col-xs-12 @@ -76,6 +76,7 @@ block content #less-info.btn.btn-primary.btn-block.btn-primary-ghost span.ion-arrow-up-b | Less information + #submitButton.btn.btn-primary.btn-big.btn-block Run code (ctrl + enter) br form.code @@ -92,7 +93,7 @@ block content var started = Math.floor(Date.now() / 1000); var _ = R; var dashed = !{JSON.stringify(dashedName)}; - var MDNlinks = !{JSON.stringify(MDNlinks)}; + .col-xs-12.col-sm-12.col-md-8 #mainEditorPanel form.code From 4dae91ff41dd717b5a9d52624c2fd064bbc2204a Mon Sep 17 00:00:00 2001 From: "A. Drake" Date: Mon, 23 Mar 2015 23:57:44 -0400 Subject: [PATCH 3/7] formatting done. --- views/bonfire/show.jade | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/views/bonfire/show.jade b/views/bonfire/show.jade index 96c573a84a..0fea3cd4b4 100644 --- a/views/bonfire/show.jade +++ b/views/bonfire/show.jade @@ -66,13 +66,17 @@ block content .bonfire-instructions p= brief #brief-instructions - #more-info.btn.btn-primary.btn-block.btn-primary-ghost - span.ion-arrow-down-b + #more-info.btn.btn-primary.btn-block.btn-primary-ghost + span.ion-arrow-down-b | More information #long-instructions.row.hide .col-xs-12 for sentence in details p!= sentence + #MDN-links + h4 Here are some helpful links. + for link, index in MDNlinks + ul: li: a(href=""+link, target="_blank") !{MDNkeys[index]} #less-info.btn.btn-primary.btn-block.btn-primary-ghost span.ion-arrow-up-b | Less information From c4624b7f20b34870e516a2e0cd74a2e33c17aa93 Mon Sep 17 00:00:00 2001 From: "A. Drake" Date: Tue, 24 Mar 2015 01:17:21 -0400 Subject: [PATCH 4/7] links added, basic functionality working across pages. --- seed_data/bonfireMDNlinks.js | 50 +++++++++++++++++++++++++++++++++--- seed_data/bonfires.json | 44 ++++++++++++++++++++----------- 2 files changed, 75 insertions(+), 19 deletions(-) diff --git a/seed_data/bonfireMDNlinks.js b/seed_data/bonfireMDNlinks.js index 1bec840ac9..e604b63919 100644 --- a/seed_data/bonfireMDNlinks.js +++ b/seed_data/bonfireMDNlinks.js @@ -1,10 +1,10 @@ // MDN Links /* These links are for Bonfires. Each key/value pair is used to render a Bonfire with approrpiate links. - Making an effort to keep methods in alphabetical order will help others behind you. + The text of the key is what the link text will be, e.g. Global Array Object - + General convention is to use the page title of the MDN reference page. */ var links = { @@ -12,13 +12,55 @@ var links = "Global Array Object" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array", "Global Object" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object", "Global String Object" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String", + "Boolean Objects" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean", + + // ========= PROPERTIES/MISC + "String.length" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length", + "Arguments object" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments", + + // ========== OBJECT METHODS + "Object.getOwnPropertyNames()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames", + "Object.keys()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys", + "Object.hasOwnProperty()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty", + // ======== STRING METHODS + "String.charAt()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charAt", + "String.charCodeAt()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charCodeAt", + "String.concat()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/concat", + "String.indexOf()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf", + "String.lastIndexOf()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf", + "String.match()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match", + "String.replace()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace", + "String.slice()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice", "String.split()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split", - + "String.substring()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substring", + "String.substr()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr", + "String.toLowerCase()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase", + "String.toString()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toString", + "String.toUpperCase()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase", // ======== ARRAY METHODS + "Array.concat()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat", + "Array.every()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every", + "Array.filter()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter", + "Array.forEach()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach", + "Array.indexOf()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf", "Array.join()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join", - "Array.reverse()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse" + "Array.lastIndexOf()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf", + "Array.map()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map", + "Array.pop()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/pop", + "Array.push()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push", + "Array.reduce()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce", + "Array.reverse()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse", + "Array.slice()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice", + "Array.some()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some", + "Array.sort()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort", + "Array.splice()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice", + "Array.toString()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString", + + // ======== GENERAL JAVASCRIPT REFERENCES + "Arithmetic Operators" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators", + "Comparison Operators" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators" }; module.exports = links; diff --git a/seed_data/bonfires.json b/seed_data/bonfires.json index 00b9fa10bd..6678027611 100644 --- a/seed_data/bonfires.json +++ b/seed_data/bonfires.json @@ -32,7 +32,7 @@ "Your result must be a string." ], "challengeSeed": "function reverseString(str) {\n return str;\r\n}\n\nreverseString('hello');", - "links" : ["String-global", "string-methods.split"] + "MDNlinks" : ["Global String Object", "String.split()", "Array.reverse()", "Array.join()"] }, { "_id": "a302f7aae1aa3152a5b413bc", @@ -50,7 +50,8 @@ "Factorials are often represented with the shorthand notation n!", "For example: 5! = 1 * 2 * 3 * 4 * 5 = 120f" ], - "challengeSeed": "function factorialize(num) {\n return num;\r\n}\n\nfactorialize(5);" + "challengeSeed": "function factorialize(num) {\n return num;\r\n}\n\nfactorialize(5);", + "MDNlinks" : ["Arithmetic Operators"] }, { "_id": "aaa48de84e1ecc7c742e1124", @@ -71,7 +72,8 @@ "assert.deepEqual(palindrome(\"never odd or even\"), true);", "assert.deepEqual(palindrome(\"nope\"), false);" ], - "challengeSeed": "function palindrome(str) {\n // Good luck!\n return true;\n}\n\n\n\npalindrome(\"eye\");" + "challengeSeed": "function palindrome(str) {\n // Good luck!\n return true;\n}\n\n\n\npalindrome(\"eye\");", + "MDNlinks" : ["String.replace()", "String.toLowerCase()"] }, { "_id": "a26cbbe9ad8655a977e1ceb5", @@ -88,7 +90,8 @@ "expect(findLongestWord('May the force be with you')).to.equal(5);", "expect(findLongestWord('Google do a barrel roll')).to.equal(6);", "expect(findLongestWord('What is the average airspeed velocity of an unladen swallow')).to.equal(8);" - ] + ], + "MDNlinks" : ["String.split()", "String.length"] }, { "_id": "ab6137d4e35944e21037b769", @@ -104,7 +107,8 @@ "expect(titleCase(\"I'm a little tea pot\")).to.equal(\"I'm A Little Tea Pot\");", "expect(titleCase(\"sHoRt AnD sToUt\")).to.equal(\"Short And Stout\");", "expect(titleCase(\"HERE IS MY HANDLE HERE IS MY SPOUT\")).to.equal(\"Here Is My Handle Here Is My Spout\");" - ] + ], + "MDNlinks" : ["String.charAt()"] }, { "_id": "a789b3483989747d63b0e427", @@ -120,7 +124,8 @@ "expect(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])).to.be.a('array');", "(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])).should.eql([5,27,39,1001]);", "assert(largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]).should.eql([9,35,97,1000000]));" - ] + ], + "MDNlinks" : ["Comparison Operators"] }, { "_id": "acda2fb1324d9b0fa741e6b5", @@ -135,7 +140,8 @@ "assert.strictEqual(end('Bastian', 'n'), true, 'should equal true if target equals end of string');", "assert.strictEqual(end('He has to give me a new name', 'name'), true, 'should equal true if target equals end of string');", "assert.strictEqual(end('If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing', 'mountain'), false, 'should equal false if target does not equal end of string');" - ] + ], + "MDNlinks" : ["String.substr()"] }, { "_id": "afcc8d540bea9ea2669306b6", @@ -149,7 +155,8 @@ "assert.strictEqual(repeat('*', 3), '***', 'should repeat a string n times');", "assert.strictEqual(repeat('abc', 3), 'abcabcabc', 'should repeat a string n times');", "assert.strictEqual(repeat('abc', -2), '', 'should return an empty string for negative numbers');" - ] + ], + "MDNlinks" : ["Global String Object"] }, { "_id": "ac6993d51946422351508a41", @@ -164,7 +171,8 @@ "expect(truncate('A-tisket a-tasket A green and yellow basket', 11)).to.eqls('A-tisket...');", "assert(truncate('A-tisket a-tasket A green and yellow basket', 'A-tisket a-tasket A green and yellow basket'.length) === 'A-tisket a-tasket A green and yellow basket', 'should not truncate if string is = length');", "assert.strictEqual(truncate('A-tisket a-tasket A green and yellow basket', 'A-tisket a-tasket A green and yellow basket'.length + 2), 'A-tisket a-tasket A green and yellow basket', 'should not truncate if string is < length');" - ] + ], + "MDNlinks" : ["String.slice()"] }, { "_id": "a9bd25c716030ec90084d8a1", @@ -178,7 +186,8 @@ "assert.deepEqual(chunk(['a', 'b', 'c', 'd'], 2), [['a', 'b'], ['c', 'd']], 'should return chunked arrays');", "assert.deepEqual(chunk([0, 1, 2, 3, 4, 5], 3), [[0, 1, 2], [3, 4, 5]], 'should return chunked arrays');", "assert.deepEqual(chunk([0, 1, 2, 3, 4, 5], 4), [[0, 1, 2, 3], [4, 5]], 'should return cthe last chunk as remaining elements');" - ] + ], + "MDNlinks" : ["Array.push()"] }, { "_id": "ab31c21b530c0dafa9e241ee", @@ -192,7 +201,8 @@ "assert.deepEqual(slasher([1, 2, 3], 2), [3], 'should drop the first two elements');", "assert.deepEqual(slasher([1, 2, 3], 0), [1, 2, 3], 'should return all elements when n < 1');", "assert.deepEqual(slasher([1, 2, 3], 9), [], 'should return an empty array when n >= array.length');" - ] + ], + "MDNlinks" : ["Array.slice()", "Array.splice()"] }, { "_id": "af2170cad53daa0770fabdea", @@ -211,7 +221,8 @@ "expect(mutation(['zyxwvutsrqponmlkjihgfedcba', 'qrstu'])).to.be.true;", "expect(mutation(['Mary', 'Army'])).to.be.true;", "expect(mutation(['Alien', 'line'])).to.be.true;" - ] + ], + "MDNlinks" : ["Array.sort()"] }, { "_id": "adf08ec01beb4f99fc7a68f2", @@ -226,7 +237,8 @@ "assert.deepEqual(bouncer([7, 'ate', '', false, 9]), [7, 'ate', 9], 'should remove falsey values');", "assert.deepEqual(bouncer(['a', 'b', 'c']), ['a', 'b', 'c'], 'should return full array if no falsey elements');", "assert.deepEqual(bouncer([false, null, 0]), [], 'should return empty array if all elements are falsey');" - ] + ], + "MDNlinks" : ["Boolean Objects", "Array.filter()"] }, { "_id":"a8e512fbe388ac2f9198f0fa", @@ -239,7 +251,8 @@ "tests":[ "assert.deepEqual(where([{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }], { last: 'Capulet' }), [{ first: 'Tybalt', last: 'Capulet' }], 'should return an array of objects');", "assert.deepEqual(where([{ 'a': 1 }, { 'a': 1 }, { 'a': 1, 'b': 2 }], { 'a': 1 }), [{ 'a': 1 }, { 'a': 1 }, { 'a': 1, 'b': 2 }], 'should return with multiples');" - ] + ], + "MDNlinks" : ["Global Object", "Object.hasOwnProperty()", "Object.keys()"] }, { "_id":"a39963a4c10bc8b4d4f06d7e", @@ -252,7 +265,8 @@ "tests": [ "assert.deepEqual(destroyer([1, 2, 3, 1, 2, 3], 2, 3), [1, 1], 'should remove correct values from an array');", "assert.deepEqual(destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3), [1, 5, 1], 'should remove correct values from an array');" - ] + ], + "MDNlinks" : ["Array.filter()"] }, { "_id": "a24c1a4622e3c05097f71d67", From b3174eeadf5e831c96adc6549ac52c5448678f7c Mon Sep 17 00:00:00 2001 From: "A. Drake" Date: Tue, 24 Mar 2015 01:24:06 -0400 Subject: [PATCH 5/7] If no links are present, the template does not show the helpful links header. --- views/bonfire/show.jade | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/views/bonfire/show.jade b/views/bonfire/show.jade index 0fea3cd4b4..aed449bdb5 100644 --- a/views/bonfire/show.jade +++ b/views/bonfire/show.jade @@ -149,5 +149,9 @@ block content $('.btn-twitter').attr('href', url); } ); + var MDNlinks = !{JSON.stringify(MDNlinks)}; + if (!MDNlinks.length) { + $('#MDN-links').addClass('collapse'); + } From a1ffc88b58b677b416725bc59ebfd7a572af71ff Mon Sep 17 00:00:00 2001 From: Michael Q Larson Date: Fri, 27 Mar 2015 23:30:06 -0700 Subject: [PATCH 6/7] add trello and blogger apis back in --- app.js | 2 ++ controllers/resources.js | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/app.js b/app.js index 6a50426361..ecbdc18fd5 100644 --- a/app.js +++ b/app.js @@ -397,6 +397,8 @@ app.get('/account/api', userController.getAccountAngular); */ app.get('/api/github', resourcesController.githubCalls); +app.get('/api/blogger', resourcesController.bloggerCalls); +app.get('/api/trello', resourcesController.trelloCalls); /** * Bonfire related routes diff --git a/controllers/resources.js b/controllers/resources.js index 6dc3b7e3ce..b6897857b0 100644 --- a/controllers/resources.js +++ b/controllers/resources.js @@ -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)); + }); + }, + about: function(req, res, next) { if (req.user) { if (!req.user.profile.picture || req.user.profile.picture === "https://s3.amazonaws.com/freecodecamp/favicons/apple-touch-icon-180x180.png") { From ef27fda537fdaa0bd331d542e78fff6b9a354f71 Mon Sep 17 00:00:00 2001 From: Michael Q Larson Date: Sat, 28 Mar 2015 10:14:49 -0700 Subject: [PATCH 7/7] remove references to meeting from announcements and notification modal --- controllers/resources.json | 1 - views/resources/learn-to-code.jade | 36 +++++++++++++++--------------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/controllers/resources.json b/controllers/resources.json index 47eb9fff75..847f4538a3 100644 --- a/controllers/resources.json +++ b/controllers/resources.json @@ -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"] ], diff --git a/views/resources/learn-to-code.jade b/views/resources/learn-to-code.jade index 4eb8198888..1aaea115b2 100644 --- a/views/resources/learn-to-code.jade +++ b/views/resources/learn-to-code.jade @@ -75,21 +75,21 @@ block content .col-xs-12.col-sm-12.col-md-6 include ../partials/faq - #announcementModal.modal(tabindex='-1') - .modal-dialog - .modal-content - .modal-header.challenge-list-header Camp-wide Meeting on Saturday at Noon EST - a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') × - .modal-body - h3.text-left We'll live-stream some of Free Code Camp's new features, and campers will show what they're building. Live Saturday, March 28 at Noon EST on our   - a(href='http://twitch.tv/freecodecamp', target='_blank') Twitch.tv channel - | . - a.btn.btn-lg.btn-info.btn-block(name='_csrf', value=_csrf, aria-hidden='true', href='http://twitch.tv/freecodecamp', target='_blank') Take me to Twitch so I can follow Free Code Camp - a.btn.btn-lg.btn-primary.btn-block(href='#', data-dismiss='modal', aria-hidden='true') Thanks for the heads-up! - script. - $(document).ready(function() { - if (!localStorage || !localStorage.campWideMeeting) { - $('#announcementModal').modal('show'); - localStorage.campWideMeeting = "true"; - } - }); \ No newline at end of file + //#announcementModal.modal(tabindex='-1') + // .modal-dialog + // .modal-content + // .modal-header.challenge-list-header Camp-wide Meeting on Saturday at Noon EST + // a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') × + // .modal-body + // h3.text-left We'll live-stream some of Free Code Camp's new features, and campers will show what they're building. Live Saturday, March 28 at Noon EST on our   + // a(href='http://twitch.tv/freecodecamp', target='_blank') Twitch.tv channel + // | . + // a.btn.btn-lg.btn-info.btn-block(name='_csrf', value=_csrf, aria-hidden='true', href='http://twitch.tv/freecodecamp', target='_blank') Take me to Twitch so I can follow Free Code Camp + // a.btn.btn-lg.btn-primary.btn-block(href='#', data-dismiss='modal', aria-hidden='true') Thanks for the heads-up! + //script. + // $(document).ready(function() { + // if (!localStorage || !localStorage.campWideMeeting) { + // $('#announcementModal').modal('show'); + // localStorage.campWideMeeting = "true"; + // } + // }); \ No newline at end of file