Change full stack to back end
This commit is contained in:
@ -5,8 +5,8 @@ import { Observable } from 'rx';
|
||||
import debugFactory from 'debug';
|
||||
|
||||
import {
|
||||
frontEndChallangeId,
|
||||
fullStackChallangeId
|
||||
frontEndChallengeId,
|
||||
backEndChallengeId
|
||||
} from '../utils/constantStrings.json';
|
||||
import { ifNoUser401, ifNoUserRedirectTo } from '../utils/middleware';
|
||||
import { observeQuery } from '../utils/rx';
|
||||
@ -126,6 +126,11 @@ module.exports = function(app) {
|
||||
|
||||
router.get(
|
||||
'/:username/full-stack-certification',
|
||||
(req, res) => res.redirect(req.url.replace('full-stack', 'back-end'))
|
||||
);
|
||||
|
||||
router.get(
|
||||
'/:username/back-end-certification',
|
||||
showCert
|
||||
);
|
||||
|
||||
@ -243,6 +248,7 @@ module.exports = function(app) {
|
||||
pledge: profileUser.pledge,
|
||||
|
||||
isFrontEndCert: profileUser.isFrontEndCert,
|
||||
isBackEndCert: profileUser.isBackEndCert,
|
||||
isFullStackCert: profileUser.isFullStackCert,
|
||||
isHonest: profileUser.isHonest,
|
||||
|
||||
@ -275,7 +281,8 @@ module.exports = function(app) {
|
||||
function showCert(req, res, next) {
|
||||
const username = req.params.username.toLowerCase();
|
||||
const { user } = req;
|
||||
const showFront = req.path.split('/').pop() === 'front-end-certification';
|
||||
const whichCert = req.path.split('/').pop();
|
||||
const showFront = whichCert === 'front-end-certification';
|
||||
Observable.just(user)
|
||||
.flatMap(user => {
|
||||
if (user && user.username === username) {
|
||||
@ -285,6 +292,7 @@ module.exports = function(app) {
|
||||
isGithubCool: true,
|
||||
isFrontEndCert: true,
|
||||
isFullStackCert: true,
|
||||
isBackEndCert: true,
|
||||
isHonest: true,
|
||||
completedChallenges: true,
|
||||
username: true,
|
||||
@ -329,19 +337,19 @@ module.exports = function(app) {
|
||||
|
||||
if (
|
||||
showFront && user.isFrontEndCert ||
|
||||
!showFront && user.isFullStackCert
|
||||
!showFront && user.isBackEndCert
|
||||
) {
|
||||
var { completedDate = new Date() } =
|
||||
_.find(user.completedChallenges, {
|
||||
id: showFront ?
|
||||
frontEndChallangeId :
|
||||
fullStackChallangeId
|
||||
frontEndChallengeId :
|
||||
backEndChallengeId
|
||||
}) || {};
|
||||
|
||||
return res.render(
|
||||
showFront ?
|
||||
'certificate/front-end.jade' :
|
||||
'certificate/full-stack.jade',
|
||||
'certificate/back-end.jade',
|
||||
{
|
||||
username: user.username,
|
||||
date: moment(new Date(completedDate))
|
||||
@ -353,7 +361,7 @@ module.exports = function(app) {
|
||||
req.flash('errors', {
|
||||
msg: showFront ?
|
||||
`Looks like user ${username} is not Front End certified` :
|
||||
`Looks like user ${username} is not Full Stack certified`
|
||||
`Looks like user ${username} is not Back End certified`
|
||||
});
|
||||
res.redirect('back');
|
||||
},
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"gitHubUserAgent": "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",
|
||||
"frontEndChallangeId": "561add10cb82ac38a17513be",
|
||||
"fullStackChallangeId": "660add10cb82ac38a17513be"
|
||||
"frontEndChallengeId": "561add10cb82ac38a17513be",
|
||||
"backEndChallengeId": "660add10cb82ac38a17513be"
|
||||
}
|
||||
|
@ -67,9 +67,9 @@ block content
|
||||
.spacer
|
||||
if isFrontEndCert
|
||||
a.btn.btn-primary(href='/' + username + '/front-end-certification') View My Front End Development Certification
|
||||
if isFullStackCert
|
||||
if isBackEndCert
|
||||
.button-spacer
|
||||
a.btn.btn-success(href='/' + username + '/full-stack-certification') View My Full Stack Development Certification
|
||||
a.btn.btn-success(href='/' + username + '/back-end-certification') View My Back End Development Certification
|
||||
//if (user && user.username !== username)
|
||||
// a.btn.btn-lg.btn-block.btn-twitter.btn-link-social(href='/leaderboard/add?username=#{username}')
|
||||
// i.fa.fa-plus-square
|
||||
|
6
server/views/certificate/back-end.jade
Normal file
6
server/views/certificate/back-end.jade
Normal file
@ -0,0 +1,6 @@
|
||||
include font
|
||||
#name.cert-name= name
|
||||
img#cert.img-abs(src='http://i.imgur.com/yBKoMVP.jpg')
|
||||
.cert-date= date
|
||||
.cert-link verify this certification at: http://freecodecamp.com/#{username}/back-end-certification
|
||||
include script
|
Reference in New Issue
Block a user