From c8b72499abb27cda2597d1529d215218ede00145 Mon Sep 17 00:00:00 2001 From: Michael Q Larson Date: Sun, 5 Apr 2015 00:16:23 -0700 Subject: [PATCH] dynamically redirect chat link in navbar --- controllers/resources.js | 10 +++++++--- views/partials/navbar.jade | 10 ++++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/controllers/resources.js b/controllers/resources.js index 4b39ceb9ca..32b6f99924 100644 --- a/controllers/resources.js +++ b/controllers/resources.js @@ -83,9 +83,13 @@ module.exports = { }, chat: function chat(req, res) { - res.render('resources/chat', { - title: "Enter Free Code Camp's Chat Rooms" - }); + if (req.user && req.user.progressTimestamps.length > 5) { + res.redirect('http://gitter.im/freecodecamp/freecodecamp'); + } else { + res.render('resources/chat', { + title: "Enter Free Code Camp's Chat Rooms" + }); + } }, jqueryExercises: function jqueryExercises(req, res) { diff --git a/views/partials/navbar.jade b/views/partials/navbar.jade index 719644207e..340f15cf8a 100644 --- a/views/partials/navbar.jade +++ b/views/partials/navbar.jade @@ -13,14 +13,12 @@ ul.nav.navbar-nav.navbar-right.hamburger-dropdown li a(href='/challenge-map') Challenges - if (user && user.progressTimestamps.length > 5) - li - a(href='https://gitter.im/freecodecamp/freecodecamp') Chat - else - li - a(href='/chat') Chat + li + a(href='/chat' target='_blank') Chat li a(href='/stories/hot') News + li + a(href='/wiki') Wiki if !user li       li