work with @brndnb to improve usability of completion modals and write client-side jquery to prevent post if user isn't authenticated, which fixes a javascript error we were experiencing on serverside
This commit is contained in:
2
app.js
2
app.js
@ -271,7 +271,7 @@ app.get('/account/unlink/:provider', userController.getOauthUnlink);
|
|||||||
* and updates user.challengesHash & user.challengesCompleted
|
* and updates user.challengesHash & user.challengesCompleted
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
app.post('/completed_challenge', function (req, res) {
|
app.post('/completed-challenge', function (req, res) {
|
||||||
req.user.challengesHash[parseInt(req.body.challengeNumber)] =
|
req.user.challengesHash[parseInt(req.body.challengeNumber)] =
|
||||||
Math.round(+new Date() / 1000);
|
Math.round(+new Date() / 1000);
|
||||||
var ch = req.user.challengesHash;
|
var ch = req.user.challengesHash;
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
@import url(http://fonts.googleapis.com/css?family=Lato:300);
|
@import url(http://fonts.googleapis.com/css?family=Lato:300);
|
||||||
@import url(http://fonts.googleapis.com/css?family=Lato:400);
|
@import url(http://fonts.googleapis.com/css?family=Lato:400);
|
||||||
|
@import url(http://fonts.googleapis.com/css?family=Inconsolata);
|
||||||
|
|
||||||
html,body,div,span,a,li,td,th {
|
html,body,div,span,a,li,td,th {
|
||||||
font-family: 'Lato', sans-serif;
|
font-family: 'Lato', sans-serif;
|
||||||
@ -525,8 +526,10 @@ thead {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
form.code {
|
.codeMirrorView {
|
||||||
font-size: 22px;
|
font-size: 22px;
|
||||||
|
font-family: 'Inconsolata', monospace;
|
||||||
|
font-weight: 300;
|
||||||
}
|
}
|
||||||
|
|
||||||
//uncomment this to see the dimensions of all elements outlined in red
|
//uncomment this to see the dimensions of all elements outlined in red
|
||||||
|
@ -21,14 +21,16 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
$('.completed-challenge').on('click', function() {
|
$('.completed-challenge').on('click', function() {
|
||||||
$('#complete-dialog').modal('show');
|
$('#complete-dialog').modal('show');
|
||||||
|
// Only post to server if there is an authenticated user
|
||||||
l = location.pathname.split('/');
|
if ($('.signup-btn-nav').length < 1) {
|
||||||
cn = l[l.length - 1];
|
l = location.pathname.split('/');
|
||||||
$.ajax({
|
cn = l[l.length - 1];
|
||||||
type: 'POST',
|
$.ajax({
|
||||||
data: {challengeNumber: cn},
|
type: 'POST',
|
||||||
url: '/completed_challenge/'
|
data: {challengeNumber: cn},
|
||||||
});
|
url: '/completed-challenge/'
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.all-challenges').on('click', function() {
|
$('.all-challenges').on('click', function() {
|
||||||
|
@ -23,16 +23,16 @@ block content
|
|||||||
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.zoomInUp.delay-half
|
.animated.zoomInDown.delay-half
|
||||||
span.landing-icon.ion-checkmark-circled.text-primary
|
span.landing-icon.ion-checkmark-circled.text-primary
|
||||||
- if (cc)
|
- if (cc)
|
||||||
a.animated.fadeIn.delay-1.btn.btn-lg.btn-primary.btn-block.next-button(name='_csrf', value=_csrf, aria-hidden='true') Take me to my next challenge
|
a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block.next-button(name='_csrf', value=_csrf, aria-hidden='true') Take me to my next challenge
|
||||||
- if (points && points > 2)
|
- if (points && points > 2)
|
||||||
a.animated.fadeIn.delay-1.btn.btn-lg.btn-block.btn-twitter(href="https://twitter.com/intent/tweet?text=I%20just%20#{verb}%20Free%20Code%20Camp%20Challenge%20%23#{number}:%20#{name}&url=http%3A%2F%2Ffreecodecamp.com/challenges/#{number}&hashtags=learntocode, javascript" target="_blank")
|
a.animated.fadeIn.btn.btn-lg.btn-block.btn-twitter(href="https://twitter.com/intent/tweet?text=I%20just%20#{verb}%20Free%20Code%20Camp%20Challenge%20%23#{number}:%20#{name}&url=http%3A%2F%2Ffreecodecamp.com/challenges/#{number}&hashtags=learntocode, javascript" target="_blank")
|
||||||
i.fa.fa-twitter
|
i.fa.fa-twitter
|
||||||
= phrase
|
= phrase
|
||||||
- else
|
- else
|
||||||
a.animated.fadeIn.delay-1.btn.btn-lg.signup-btn.btn-block(href='/login') Sign in so you can save your progress
|
a.animated.fadeIn.btn.btn-lg.signup-btn.btn-block(href='/login') Sign in so you can save your progress
|
||||||
#all-challenges-dialog.modal(tabindex='-1')
|
#all-challenges-dialog.modal(tabindex='-1')
|
||||||
.modal-dialog.animated.fadeInUp.fast-animation
|
.modal-dialog.animated.fadeInUp.fast-animation
|
||||||
.modal-content
|
.modal-content
|
||||||
|
Reference in New Issue
Block a user