From bd7c5310b1303231b1e6c19b0dc6087c7bcc3113 Mon Sep 17 00:00:00 2001 From: Michael Q Larson Date: Tue, 7 Apr 2015 00:11:31 -0700 Subject: [PATCH] improve the footer --- app.js | 2 + controllers/courseware.js | 1 + controllers/resources.js | 8 +++- controllers/story.js | 68 ++++++++++++++++++++++++++++++ public/css/main.less | 11 ++++- seed_data/coursewares.json | 18 -------- views/account/show.jade | 8 ++-- views/partials/flash.jade | 39 ++++++++--------- views/partials/footer.jade | 16 +++---- views/resources/learn-to-code.jade | 36 ++++++++-------- views/resources/twitch.jade | 59 ++++++++++++++++++++++++++ 11 files changed, 196 insertions(+), 70 deletions(-) create mode 100644 views/resources/twitch.jade diff --git a/app.js b/app.js index 1038c73400..39ef393fe9 100644 --- a/app.js +++ b/app.js @@ -249,6 +249,8 @@ app.get('/jquery-exercises', resourcesController.jqueryExercises); app.get('/chat', resourcesController.chat); +app.get('/twitch', resourcesController.twitch); + app.get('/map', challengeMapController.challengeMap); app.get('/live-pair-programming', function(req, res) { diff --git a/controllers/courseware.js b/controllers/courseware.js index 08cb36a680..0c91997672 100644 --- a/controllers/courseware.js +++ b/controllers/courseware.js @@ -364,6 +364,7 @@ exports.completedZiplineOrBasejump = function (req, res, next) { }); var index = req.user.uncompletedCoursewares.indexOf(coursewareHash); + console.log('index here', index) if (index > -1) { req.user.progressTimestamps.push(Date.now() || 0); req.user.uncompletedCoursewares.splice(index, 1); diff --git a/controllers/resources.js b/controllers/resources.js index e8eb803609..ec1d7466f2 100644 --- a/controllers/resources.js +++ b/controllers/resources.js @@ -87,7 +87,7 @@ module.exports = { res.redirect('http://gitter.im/freecodecamp/freecodecamp'); } else { res.render('resources/chat', { - title: "Enter Free Code Camp's Chat Rooms" + title: "Watch us code live on Twitch.tv" }); } }, @@ -98,6 +98,12 @@ module.exports = { }); }, + twitch: function twitch(req, res) { + res.render('resources/twitch', { + title: "Enter Free Code Camp's Chat Rooms" + }); + }, + 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) { diff --git a/controllers/story.js b/controllers/story.js index 27bbf47916..f788670330 100644 --- a/controllers/story.js +++ b/controllers/story.js @@ -9,6 +9,7 @@ var R = require('ramda'), mongodb = require('mongodb'), MongoClient = mongodb.MongoClient, secrets = require('../config/secrets'), + nodemailer = require('nodemailer'), sanitizeHtml = require('sanitize-html'); function hotRank(timeValue, rank) { @@ -384,6 +385,7 @@ exports.commentSubmit = function(req, res, next) { topLevel: true, commentOn: Date.now() }); + commentSave(comment, Story, res, next); }; @@ -438,8 +440,74 @@ function commentSave(comment, Context, res, next) { res.send(true); }); } + User.findOne({'profile.username': associatedStory.author.username}, function(err, recipient) { + if (err) { + return next(err); + } + Comment.findById(associatedStory._id, function(err, originalStory) { + if (err) { + return next(err); + } + debug('is it a comment?', originalStory); + if (!originalStory) { + Story.findById(associatedStory.associatedPost, function(err, originalStory) { + debug('is it a story?', originalStory); + if (err) { + return next(err); + } + var transporter = nodemailer.createTransport({ + service: 'Mandrill', + auth: { + user: secrets.mandrill.user, + pass: secrets.mandrill.password + } + }); + console.log('1!'); + var mailOptions = { + to: recipient.email, + from: 'Team@freecodecamp.com', + subject: originalStory.author.username + " replied to you on Camper News!", + text: [ + "Here.", + '- the Volunteer Camp Counselor Team' + ].join('') + }; + console.log('2!'); + transporter.sendMail(mailOptions, function(err) { + if (err) { return err; } + done(null, null); + }); + }); + } else { + console.log('definitely a comment'); + var transporter = nodemailer.createTransport({ + service: 'Mandrill', + auth: { + user: secrets.mandrill.user, + pass: secrets.mandrill.password + } + }); + console.log('1!'); + var mailOptions = { + to: recipient.email, + from: 'Team@freecodecamp.com', + subject: originalStory.author.username + " replied to you on Camper News!", + text: [ + "Here.", + '- the Volunteer Camp Counselor Team' + ].join('') + }; + console.log('2!'); + transporter.sendMail(mailOptions, function(err) { + if (err) { return err; } + done(null, null); + }); + } + }); + }); }); } catch (e) { + debug('hey there\'s error'); // delete comment return next(err); } diff --git a/public/css/main.less b/public/css/main.less index a660554f09..3b9f63a04e 100644 --- a/public/css/main.less +++ b/public/css/main.less @@ -608,16 +608,23 @@ thead { .fcc-footer { width: 100%; + height: 50px; text-align: center; background-color: #4a2b0f; - height: 40px; + padding: 12px; bottom: 0; left: 0; position: absolute; a { - font-size: 28px; + font-size: 20px; color: #eee; + margin-left: 0px; + margin-right: 0px; + padding-left: 10px; + padding-right: 10px; &:hover { + padding-top: 14px; + padding-bottom: 14px; color: #4a2b0f; background-color: #eee; text-decoration: none; diff --git a/seed_data/coursewares.json b/seed_data/coursewares.json index ebec8b18af..c80ad7a291 100644 --- a/seed_data/coursewares.json +++ b/seed_data/coursewares.json @@ -112,24 +112,6 @@ "challengeType": 2, "tests": [] }, - { - "_id": "bd7110d8c441eddfaeb5bdef", - "name": "Tweak HTML and CSS in CodePen", - "difficulty": 0.08, - "challengeSeed": "110752744", - "description": [ - "Now we're going to learn how to use a tool called CodePen, which lets you experiment with HTML and CSS, and even create single-page web applications, right in your browser!", - "Go to http://www.newsweek.com/", - "Change the window size. Note that Newsweek.com is using Responsive Design.", - "Right-click an area of the page that doesn't have any HTML elements on it, then choose 'view page source'.", - "Select all the text, then copy it.", - "Go to http://codepen.io/pen/", - "Paste the HTML you copied from Newsweek.com into the HTML field of CodePen.", - "You now have your own customizable version of the Newsweek.com website. See if you can change some of the text and images." - ], - "challengeType": 2, - "tests": [] - }, { "_id": "bd7111d8c441eddfaeb5bdef", "name": "Build a CSS Robot", diff --git a/views/account/show.jade b/views/account/show.jade index dab650715e..8f3aa810ae 100644 --- a/views/account/show.jade +++ b/views/account/show.jade @@ -21,13 +21,13 @@ block content img.img-center.img-responsive.public-profile-img(src='https://s3.amazonaws.com/freecodecamp/camper-image-placeholder.png') h1.text-center.negative-5 - if (twitterHandle) - a.ion-social-twitter.text-primary(title="@#{username}'s Twitter Profile", href="http://twitter.com/#{twitterHandle}", target='_blank') + a.ion-social-twitter.text-primary(title="@#{username}'s Twitter Profile", href="http://twitter.com/#{twitterHandle}", target='_blank') - if (githubProfile) - a.ion-social-github.text-primary(title="@#{username}'s GitHub Profile", href=githubProfile, target='_blank') + a.ion-social-github.text-primary(title="@#{username}'s GitHub Profile", href=githubProfile, target='_blank') - if (linkedinProfile) - a.ion-social-linkedin.text-primary(title="@#{username}'s LinkedIn Profile", href=linkedinProfile, target='_blank') + a.ion-social-linkedin.text-primary(title="@#{username}'s LinkedIn Profile", href=linkedinProfile, target='_blank') - if (codepenProfile) - a.ion-social-codepen.text-primary(title="@#{username}'s CodePen Profile", href=codepenProfile, target='_blank') + a.ion-social-codepen.text-primary(title="@#{username}'s CodePen Profile", href=codepenProfile, target='_blank') .visible-md.visible-lg .col-xs-12.col-sm-12.col-md-4.text-justify h1.flat-top.wrappable= name diff --git a/views/partials/flash.jade b/views/partials/flash.jade index 415005645f..e69a6d69bc 100644 --- a/views/partials/flash.jade +++ b/views/partials/flash.jade @@ -1,19 +1,20 @@ -.col-xs-12 - if messages.errors - .alert.alert-danger.fade.in - button.close(type='button', data-dismiss='alert') - span.ion-close-circled - for error in messages.errors - div!= error.msg - if messages.info - .alert.alert-info.fade.in - button.close(type='button', data-dismiss='alert') - span.ion-close-circled - for info in messages.info - div!= info.msg - if messages.success - .alert.alert-success.fade.in - button.close(type='button', data-dismiss='alert') - span.ion-close-circled - for success in messages.success - div!= success.msg +.row + .col-xs-12 + if messages.errors + .alert.alert-danger.fade.in + button.close(type='button', data-dismiss='alert') + span.ion-close-circled + for error in messages.errors + div!= error.msg + if messages.info + .alert.alert-info.fade.in + button.close(type='button', data-dismiss='alert') + span.ion-close-circled + for info in messages.info + div!= info.msg + if messages.success + .alert.alert-success.fade.in + button.close(type='button', data-dismiss='alert') + span.ion-close-circled + for success in messages.success + div!= success.msg diff --git a/views/partials/footer.jade b/views/partials/footer.jade index 8be0eefa28..3004dcbcf1 100644 --- a/views/partials/footer.jade +++ b/views/partials/footer.jade @@ -1,15 +1,15 @@ .fcc-footer .col-xs-12.hidden-xs.hidden-sm - a.ion-speakerphone(href='http://blog.freecodecamp.com', target='_blank')  Blog   - a.ion-social-twitch-outline(href="http://www.twitch.tv/freecodecamp", target='_blank')  Twitch   - a.ion-social-github(href="http://github.com/freecodecamp", target='_blank')  Github   - a.ion-social-twitter(href="http://twitter.com/freecodecamp", target='_blank')  Twitter   - a.ion-information-circled(href="/learn-to-code")  About   - a.ion-locked(href="/privacy")  Privacy   + a.ion-speakerphone(href='http://blog.freecodecamp.com', target='_blank')  Blog   + a.ion-social-twitch-outline(href="/twitch")  Twitch  + a.ion-social-github(href="http://github.com/freecodecamp", target='_blank')  Github   + a.ion-social-twitter(href="http://twitter.com/freecodecamp", target='_blank')  Twitter   + a.ion-information-circled(href="/learn-to-code")  About   + a.ion-locked(href="/privacy")  Privacy   .col-xs-12.visible-xs.visible-sm a.ion-speakerphone(href='http://blog.freecodecamp.com', target='_blank') span.sr-only Free Code Camp's Blog - a.ion-social-twitch-outline(href="http://www.twitch.tv/freecodecamp", target='_blank') + a.ion-social-twitch-outline(href="/twitch") span.sr-only Free Code Camp Live Pair Programming on Twitch.tv a.ion-social-github(href="http://github.com/freecodecamp", target='_blank') span.sr-only Free Code Camp on GitHub @@ -18,4 +18,4 @@ a.ion-information-circled(href="/learn-to-code") span.sr-only About Free Code Camp a.ion-locked(href="/privacy") - span.sr-only Free Code Camp's Privacy Policy \ No newline at end of file + span.sr-only Free Code Camp's Privacy Policy diff --git a/views/resources/learn-to-code.jade b/views/resources/learn-to-code.jade index 3d2b986f0e..723f89874f 100644 --- a/views/resources/learn-to-code.jade +++ b/views/resources/learn-to-code.jade @@ -76,21 +76,21 @@ block content .col-xs-12.github-and-twitter-button-text html. - //#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"; - // } - // }); + #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"; + } + }); diff --git a/views/resources/twitch.jade b/views/resources/twitch.jade new file mode 100644 index 0000000000..e6c4ff4913 --- /dev/null +++ b/views/resources/twitch.jade @@ -0,0 +1,59 @@ +extends ../layout +block content + .col-xs-12 + .panel.panel-info + .panel-heading.text-center Watch us code on our Twitch.tv channel + .panel-body.text-center + h2 Watch the live stream below or on our   + a(href="http://twitch.tv/freecodecamp", target='_blank') Twitch.tv channel + | . + .spacer + .row + .col-md-8.col-xs-12 + .embed-responsive.embed-responsive-16by9 + iframe(src='http://www.twitch.tv/freecodecamp/embed', frameborder='0', scrolling='no') + .col-md-4.col-xs-12 + .visible-sm.visible-xs + .embed-responsive.embed-responsive-16by9 + iframe(src='http://www.twitch.tv/freecodecamp/chat?popout=', frameborder='0', scrolling='no') + .visible-md.visible-lg + .embed-responsive.embed-responsive-twitch-chat + iframe(src='http://www.twitch.tv/freecodecamp/chat?popout=', frameborder='0', scrolling='no') + .row + .col-xs-12 + h2 Check out our scheduled shows. You can add them to your calendar. + .embed-responsive.embed-responsive-16by9 + iframe.embed-responsive-item(src="https://www.google.com/calendar/embed?src=freecodecamp.com_r06116ile3o6ucpif7s0g281tc%40group.calendar.google.com&ctz=America/New_York&mode=AGENDA" style="border: 0" width="800" height="600" frameborder="0" scrolling="no") + .row + .col-xs-12 + h2 Here are some of our previous shows (you can full-screen them) + .row + .col-xs-12.col-sm-12.col-md-6 + .embed-responsive.embed-responsive-16by9.big-break + iframe.embed-responsive-item(src='//www.youtube.com/embed/_BErpDdmBOw') + p.wrappable.negative-45 link:   + a(href="http://www.youtube.com/watch/_BErpDdmBOw") http://www.youtube.com/watch/_BErpDdmBOw + .col-xs-12.col-sm-12.col-md-6 + .embed-responsive.embed-responsive-16by9.big-break + iframe.embed-responsive-item(src='//www.youtube.com/embed/Fn9HMn79KH0') + p.wrappable.negative-45 link:   + a(href="http://www.youtube.com/watch/Fn9HMn79KH0") http://www.youtube.com/watch/Fn9HMn79KH0 + .col-xs-12.col-sm-12.col-md-6 + .embed-responsive.embed-responsive-16by9.big-break + iframe.embed-responsive-item(src='//www.youtube.com/embed/S7iRBZJwOAs') + p.wrappable.negative-45 link:   + a(href="http://www.youtube.com/watch/S7iRBZJwOAs") http://www.youtube.com/watch/S7iRBZJwOAs + .col-xs-12.col-sm-12.col-md-6 + .embed-responsive.embed-responsive-16by9.big-break + iframe.embed-responsive-item(src='//www.youtube.com/embed/BHNRg39ZblE') + p.wrappable.negative-45 link:   + a(href="http://www.youtube.com/watch/BHNRg39ZblE") http://www.youtube.com/watch/BHNRg39ZblE + .col-xs-12.col-sm-12.col-md-6 + .embed-responsive.embed-responsive-16by9.big-break + iframe.embed-responsive-item(src='//www.youtube.com/embed/YDfkHlDmehA') + p.wrappable.negative-45 link:   + a(href="http://www.youtube.com/watch/YDfkHlDmehA") http://www.youtube.com/watch/YDfkHlDmehA + .row + .col-xs-12.text-center + if !user + a.btn.btn-cta.signup-btn.btn-primary(href="/login") Start learning to code (it's free)