User facing challenge mentions now point to coursewares, remove completed view from account/show
This commit is contained in:
24
app.js
24
app.js
@ -372,18 +372,6 @@ app.post(
|
|||||||
storyController.upvote
|
storyController.upvote
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
|
||||||
* Challenge related routes
|
|
||||||
*/
|
|
||||||
app.get(
|
|
||||||
'/challenges/',
|
|
||||||
challengesController.returnNextChallenge
|
|
||||||
);
|
|
||||||
app.get(
|
|
||||||
'/challenges/:challengeNumber',
|
|
||||||
challengesController.returnChallenge
|
|
||||||
);
|
|
||||||
|
|
||||||
app.all('/account', passportConf.isAuthenticated);
|
app.all('/account', passportConf.isAuthenticated);
|
||||||
app.get('/account/api', userController.getAccountAngular);
|
app.get('/account/api', userController.getAccountAngular);
|
||||||
|
|
||||||
@ -422,10 +410,10 @@ app.post('/completed-bonfire/', bonfireController.completedBonfire);
|
|||||||
* Courseware related routes
|
* Courseware related routes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
app.get('/coursewares/', coursewareController.returnNextCourseware);
|
app.get('/challenges/', coursewareController.returnNextCourseware);
|
||||||
app.get('/coursewares/getCoursewareList', coursewareController.showAllCoursewares);
|
app.get('/challenges/getCoursewareList', coursewareController.showAllCoursewares);
|
||||||
app.get(
|
app.get(
|
||||||
'/coursewares/:coursewareName',
|
'/challenges/:coursewareName',
|
||||||
coursewareController.returnIndividualCourseware
|
coursewareController.returnIndividualCourseware
|
||||||
);
|
);
|
||||||
app.post('/completed-courseware/', coursewareController.completedCourseware);
|
app.post('/completed-courseware/', coursewareController.completedCourseware);
|
||||||
@ -441,12 +429,6 @@ app.post('/account/delete', userController.postDeleteAccount);
|
|||||||
app.get('/account/unlink/:provider', userController.getOauthUnlink);
|
app.get('/account/unlink/:provider', userController.getOauthUnlink);
|
||||||
app.get('/sitemap.xml', resourcesController.sitemap);
|
app.get('/sitemap.xml', resourcesController.sitemap);
|
||||||
|
|
||||||
/**
|
|
||||||
* API examples routes.
|
|
||||||
* accepts a post request. the challenge id req.body.challengeNumber
|
|
||||||
* and updates user.challengesHash & user.challengesCompleted
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,7 +23,7 @@ exports.showAllCoursewares = function(req, res) {
|
|||||||
|
|
||||||
exports.returnNextCourseware = function(req, res) {
|
exports.returnNextCourseware = function(req, res) {
|
||||||
if (!req.user) {
|
if (!req.user) {
|
||||||
return res.redirect('../coursewares/start-our-challenges');
|
return res.redirect('../challenges/learn-how-free-code-camp-works');
|
||||||
}
|
}
|
||||||
var completed = req.user.completedCoursewares.map(function (elem) {
|
var completed = req.user.completedCoursewares.map(function (elem) {
|
||||||
return elem._id;
|
return elem._id;
|
||||||
@ -50,10 +50,10 @@ exports.returnNextCourseware = function(req, res) {
|
|||||||
req.flash('errors', {
|
req.flash('errors', {
|
||||||
msg: "It looks like you've completed all the courses we have available. Good job!"
|
msg: "It looks like you've completed all the courses we have available. Good job!"
|
||||||
});
|
});
|
||||||
return res.redirect('../coursewares/start-our-challenges');
|
return res.redirect('../challenges/learn-how-free-code-camp-works');
|
||||||
}
|
}
|
||||||
nameString = courseware.name.toLowerCase().replace(/\s/g, '-');
|
nameString = courseware.name.toLowerCase().replace(/\s/g, '-');
|
||||||
return res.redirect('../coursewares/' + nameString);
|
return res.redirect('../challenges/' + nameString);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -71,14 +71,14 @@ exports.returnIndividualCourseware = function(req, res, next) {
|
|||||||
req.flash('errors', {
|
req.flash('errors', {
|
||||||
msg: "404: We couldn't find a challenge with that name. Please double check the name."
|
msg: "404: We couldn't find a challenge with that name. Please double check the name."
|
||||||
});
|
});
|
||||||
return res.redirect('/coursewares')
|
return res.redirect('/challenges');
|
||||||
}
|
}
|
||||||
courseware = courseware.pop();
|
courseware = courseware.pop();
|
||||||
|
|
||||||
// Redirect to full name if the user only entered a partial
|
// Redirect to full name if the user only entered a partial
|
||||||
var dashedNameFull = courseware.name.toLowerCase().replace(/\s/g, '-');
|
var dashedNameFull = courseware.name.toLowerCase().replace(/\s/g, '-');
|
||||||
if (dashedNameFull != dashedName) {
|
if (dashedNameFull != dashedName) {
|
||||||
return res.redirect('../coursewares/' + dashedNameFull);
|
return res.redirect('../challenges/' + dashedNameFull);
|
||||||
}
|
}
|
||||||
|
|
||||||
var challengeType = {
|
var challengeType = {
|
||||||
|
@ -297,7 +297,6 @@ exports.returnUser = function(req, res, next) {
|
|||||||
website3Link: user.portfolio.website3Link,
|
website3Link: user.portfolio.website3Link,
|
||||||
website3Title: user.portfolio.website3Title,
|
website3Title: user.portfolio.website3Title,
|
||||||
website3Image: user.portfolio.website3Image,
|
website3Image: user.portfolio.website3Image,
|
||||||
challenges: user.completedCoursewares,
|
|
||||||
ch: user.challengesHash,
|
ch: user.challengesHash,
|
||||||
calender: data,
|
calender: data,
|
||||||
moment: moment
|
moment: moment
|
||||||
|
@ -864,8 +864,11 @@ iframe.iphone {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#cal-heatmap {
|
#cal-heatmap {
|
||||||
margin: 0 auto;
|
width: 361px;
|
||||||
background-color: #fefefe;
|
}
|
||||||
|
|
||||||
|
.cal-heatmap-container {
|
||||||
|
background-color: #EEEEEE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//uncomment this to see the dimensions of all elements outlined in red
|
//uncomment this to see the dimensions of all elements outlined in red
|
||||||
|
@ -34,10 +34,6 @@ editor.setOption("extraKeys", {
|
|||||||
var spaces = Array(cm.getOption("indentUnit") + 1).join(" ");
|
var spaces = Array(cm.getOption("indentUnit") + 1).join(" ");
|
||||||
cm.replaceSelection(spaces);
|
cm.replaceSelection(spaces);
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"Ctrl-Enter": function() {
|
|
||||||
bonfireExecute();
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -115,7 +111,7 @@ var allSeeds = '';
|
|||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
|
||||||
editor.setValue('test');
|
editor.setValue(allSeeds);
|
||||||
|
|
||||||
function doLinting () {
|
function doLinting () {
|
||||||
editor.operation(function () {
|
editor.operation(function () {
|
||||||
|
@ -118,7 +118,7 @@ $(document).ready(function() {
|
|||||||
}).success(
|
}).success(
|
||||||
function(res) {
|
function(res) {
|
||||||
if (res) {
|
if (res) {
|
||||||
window.location.href = '/coursewares';
|
window.location.href = '/challenges';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -97,7 +97,7 @@ block content
|
|||||||
| Try it out
|
| Try it out
|
||||||
|
|
||||||
.hidden-xs.col-sm-12
|
.hidden-xs.col-sm-12
|
||||||
#cal-heatmap
|
#cal-heatmap.img-center
|
||||||
script(src="//d3js.org/d3.v3.min.js")
|
script(src="//d3js.org/d3.v3.min.js")
|
||||||
script(src="//cdn.jsdelivr.net/cal-heatmap/3.3.10/cal-heatmap.min.js")
|
script(src="//cdn.jsdelivr.net/cal-heatmap/3.3.10/cal-heatmap.min.js")
|
||||||
link(rel="stylesheet", href="//cdn.jsdelivr.net/cal-heatmap/3.3.10/cal-heatmap.css")
|
link(rel="stylesheet", href="//cdn.jsdelivr.net/cal-heatmap/3.3.10/cal-heatmap.css")
|
||||||
@ -119,17 +119,3 @@ block content
|
|||||||
legendColors: ["#cccccc", "#215f1e"],
|
legendColors: ["#cccccc", "#215f1e"],
|
||||||
legend: [1, 2, 3]
|
legend: [1, 2, 3]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
.col-sm-12
|
|
||||||
table.table.table-striped
|
|
||||||
thead
|
|
||||||
tr
|
|
||||||
th Challenge
|
|
||||||
th Date Finished
|
|
||||||
for challenge in challenges
|
|
||||||
tr
|
|
||||||
td= challenge.name
|
|
||||||
td= moment(challenge.completedDate, 'X').format("MMM DD, YYYY")
|
|
||||||
br
|
|
||||||
|
|
||||||
|
@ -18,8 +18,6 @@ block content
|
|||||||
script(src='/js/lib/codemirror/mode/xml/xml.js')
|
script(src='/js/lib/codemirror/mode/xml/xml.js')
|
||||||
script(src='/js/lib/codemirror/mode/css/css.js')
|
script(src='/js/lib/codemirror/mode/css/css.js')
|
||||||
script(src='/js/lib/codemirror/mode/htmlmixed/htmlmixed.js')
|
script(src='/js/lib/codemirror/mode/htmlmixed/htmlmixed.js')
|
||||||
script(src="https://cdn.jsdelivr.net/ramda/0.10.0/ramda.min.js")
|
|
||||||
|
|
||||||
.row.courseware-height
|
.row.courseware-height
|
||||||
.col-xs-12.col-sm-12.col-md-3.col-lg-3
|
.col-xs-12.col-sm-12.col-md-3.col-lg-3
|
||||||
.well
|
.well
|
||||||
@ -40,23 +38,19 @@ block content
|
|||||||
span.ion-arrow-up-b
|
span.ion-arrow-up-b
|
||||||
| Less information
|
| Less information
|
||||||
br
|
br
|
||||||
.btn.btn-info#showAllCoursewares
|
|
||||||
|
|
||||||
- if (cc)
|
- if (cc)
|
||||||
a.btn.btn-primary.btn-lg.btn-block#complete-courseware
|
a.btn.btn-primary.btn-lg.btn-block#next-courseware-button
|
||||||
| Go to my next challenge
|
| Go to my next challenge
|
||||||
br
|
br
|
||||||
| (ctrl + enter)
|
| (ctrl + enter)
|
||||||
script.
|
script.
|
||||||
var userLoggedIn = true;
|
var userLoggedIn = true;
|
||||||
|
|
||||||
- else
|
- else
|
||||||
a.btn.btn-lg.signup-btn.btn-block(href='/login') Sign in so you can save your progress
|
a.btn.btn-lg.signup-btn.btn-block(href='/login') Sign in so you can save your progress
|
||||||
script.
|
script.
|
||||||
var userLoggedIn = false;
|
var userLoggedIn = false;
|
||||||
br
|
br
|
||||||
ul#testSuite.list-group
|
ul#testSuite.list-group
|
||||||
|
|
||||||
br
|
br
|
||||||
script(type="text/javascript").
|
script(type="text/javascript").
|
||||||
$('#next-courseware-button').attr('disabled', 'disabled');
|
$('#next-courseware-button').attr('disabled', 'disabled');
|
||||||
@ -64,60 +58,27 @@ block content
|
|||||||
var challengeSeed = !{JSON.stringify(challengeSeed)};
|
var challengeSeed = !{JSON.stringify(challengeSeed)};
|
||||||
var passedCoursewareHash = !{JSON.stringify(coursewareHash)};
|
var passedCoursewareHash = !{JSON.stringify(coursewareHash)};
|
||||||
var challengeName = !{JSON.stringify(name)};
|
var challengeName = !{JSON.stringify(name)};
|
||||||
|
var passedCoursewareName = challengeName;
|
||||||
var prodOrDev = !{JSON.stringify(environment)};
|
var prodOrDev = !{JSON.stringify(environment)};
|
||||||
var started = Math.floor(Date.now() / 1000);
|
var started = Math.floor(Date.now() / 1000);
|
||||||
var url = '';
|
|
||||||
var dashed = !{JSON.stringify(dashedName)};
|
|
||||||
console.log(dashed);
|
|
||||||
|
|
||||||
.col-xs-12.col-sm-12.col-md-5.col-lg-6
|
.col-xs-12.col-sm-12.col-md-5.col-lg-6
|
||||||
#mainEditorPanel
|
#mainEditorPanel
|
||||||
form.code
|
form.code
|
||||||
.form-group.codeMirrorView
|
.form-group.codeMirrorView
|
||||||
|
|
||||||
script(src='/js/lib/coursewares/coursewaresHCJQFramework_v0.1.1.js')
|
|
||||||
textarea#codeEditor(autofocus=true, style='display: none;')
|
textarea#codeEditor(autofocus=true, style='display: none;')
|
||||||
|
|
||||||
.col-md-4.col-lg-3
|
.col-md-4.col-lg-3
|
||||||
.hidden-xs.hidden-sm
|
.hidden-xs.hidden-sm
|
||||||
img.iphone-position(src="https://s3.amazonaws.com/freecodecamp/iphone6-frame.png")
|
img.iphone-position(src="https://s3.amazonaws.com/freecodecamp/iphone6-frame.png")
|
||||||
iframe.iphone#preview
|
iframe.iphone#preview
|
||||||
|
#complete-courseware-dialog.modal(tabindex='-1')
|
||||||
#complete-courseware-dialog.modal(tabindex='-1')
|
.modal-dialog.animated.zoomIn.fast-animation
|
||||||
.modal-dialog.animated.zoomIn.fast-animation
|
.modal-content
|
||||||
.modal-content
|
.modal-header.challenge-list-header
|
||||||
.modal-header.challenge-list-header= compliment
|
= compliment
|
||||||
a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') ×
|
a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') ×
|
||||||
.modal-body
|
.modal-body
|
||||||
.text-center
|
.text-center
|
||||||
.animated.zoomInDown.delay-half
|
.animated.zoomInDown.delay-half
|
||||||
span.completion-icon.ion-checkmark-circled.text-primary
|
span.completion-icon.ion-checkmark-circled.text-primary
|
||||||
- if (cc)
|
a.animated.fadeIn.btn.btn-lg.signup-btn.btn-block(href='/login') Sign in so you can save your progress
|
||||||
|
script(src="/js/lib/coursewares/coursewaresHCJQFramework_v0.1.1.js")
|
||||||
a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block#next-courseware-button(name='_csrf', value=_csrf, ng-disabled='completedWithForm.$invalid && existingUser.length > 0') Go to my next challenge (ctrl + enter)
|
|
||||||
- if (points && points > 2)
|
|
||||||
a.animated.fadeIn.btn.btn-lg.btn-block.btn-twitter(target="_blank")
|
|
||||||
i.fa.fa-twitter
|
|
||||||
= phrase
|
|
||||||
|
|
||||||
- else
|
|
||||||
a.animated.fadeIn.btn.btn-lg.signup-btn.btn-block(href='/login') Sign in so you can save your progress
|
|
||||||
|
|
||||||
#all-coursewares-dialog.modal(tabindex='-1')
|
|
||||||
.modal-dialog.animated.fadeInUp.fast-animation
|
|
||||||
.modal-content
|
|
||||||
.modal-header.all-list-header Challenges
|
|
||||||
a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') ×
|
|
||||||
.modal-body
|
|
||||||
include ../partials/coursewares
|
|
||||||
script.
|
|
||||||
$.ajax({
|
|
||||||
url: 'https://api-ssl.bitly.com/v3/shorten?access_token=75e7931a19befaafcf108021b6d597e554b2c5c3&longUrl=http%3A%2F%2Ffreecodecamp.com%2Fchallenges%2F' + dashed + '&format=txt'
|
|
||||||
})
|
|
||||||
.success(
|
|
||||||
function(data) {
|
|
||||||
console.log(data);
|
|
||||||
url = "https://twitter.com/intent/tweet?text=I%20just%20#{verb}%20%40FreeCodeCamp%20Challenge:%20#{name}&url=" + data + "&hashtags=LearnToCode, JavaScript";
|
|
||||||
$('.btn-twitter').attr('href', url);
|
|
||||||
}
|
|
||||||
);
|
|
Reference in New Issue
Block a user