closer to getting ajax to work
This commit is contained in:
8
app.js
8
app.js
@ -165,6 +165,10 @@ app.post('/api/venmo', passportConf.isAuthenticated, passportConf.isAuthorized,
|
|||||||
app.get('/api/linkedin', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getLinkedin);
|
app.get('/api/linkedin', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getLinkedin);
|
||||||
app.get('/api/instagram', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getInstagram);
|
app.get('/api/instagram', passportConf.isAuthenticated, passportConf.isAuthorized, apiController.getInstagram);
|
||||||
app.get('/api/yahoo', apiController.getYahoo);
|
app.get('/api/yahoo', apiController.getYahoo);
|
||||||
|
app.post('/completed_challenge', function(req, res){
|
||||||
|
req.user.challengesCompleted.push(req)
|
||||||
|
console.log("pushed #{req} to user");
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OAuth sign-in routes.
|
* OAuth sign-in routes.
|
||||||
@ -212,9 +216,6 @@ app.get('/auth/venmo/callback', passport.authorize('venmo', { failureRedirect: '
|
|||||||
res.redirect('/api/venmo');
|
res.redirect('/api/venmo');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 500 Error Handler.
|
* 500 Error Handler.
|
||||||
*/
|
*/
|
||||||
@ -230,3 +231,4 @@ app.listen(app.get('port'), function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
module.exports = app;
|
module.exports = app;
|
||||||
|
|
||||||
|
@ -142,8 +142,6 @@ exports.updateProgress = function(req, res) {
|
|||||||
res.redirect('/account');
|
res.redirect('/account');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
// challenge = req.params.challengeNumber;
|
|
||||||
// user.challengesCompleted
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,10 +4,27 @@ $(document).ready(function() {
|
|||||||
$('.challenge-content').removeClass('hidden-element').addClass('animated fadeInDown');
|
$('.challenge-content').removeClass('hidden-element').addClass('animated fadeInDown');
|
||||||
});
|
});
|
||||||
$('.completed-challenge').on("click", function() {
|
$('.completed-challenge').on("click", function() {
|
||||||
// user.completedChallenges.push()
|
|
||||||
$('#complete-dialog').modal('show');
|
$('#complete-dialog').modal('show');
|
||||||
});
|
});
|
||||||
$('.skip-challenge').on("click", function() {
|
$('.skip-challenge').on("click", function() {
|
||||||
$('#skip-dialog').modal('show');
|
$('#skip-dialog').modal('show');
|
||||||
});
|
});
|
||||||
|
$('.complete-button').on("click", function() {
|
||||||
|
l = location.pathname.split('/');
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
data: l,
|
||||||
|
url: '/completed_challenge',
|
||||||
|
success: function(data) {
|
||||||
|
console.log('success');
|
||||||
|
console.log(JSON.stringify(data));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
window.location = "/challenge?=" + (parseInt(l[l.length-1]) + 1)
|
||||||
|
});
|
||||||
|
$('.skip-button').on("click", function() {
|
||||||
|
l = location.pathname.split;
|
||||||
|
window.location = "/challenges/" + (parseInt(l[l.length-1]) + 1)
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
@ -1,47 +0,0 @@
|
|||||||
.panel.panel-primary
|
|
||||||
.panel-heading Challenge: #{name}
|
|
||||||
.panel.panel-body
|
|
||||||
.challenge-brief
|
|
||||||
h3.text-center
|
|
||||||
span.ion-android-clock
|
|
||||||
span Takes about #{time}
|
|
||||||
.btn.btn-success.btn-large.btn-block.start-challenge Start the challenge
|
|
||||||
.challenge-content.hidden-element
|
|
||||||
.responsive-container
|
|
||||||
iframe(src='//player.vimeo.com/video/#{video}', frameborder='0', webkitallowfullscreen='', mozallowfullscreen='', allowfullscreen='')
|
|
||||||
h3 Steps:
|
|
||||||
h4
|
|
||||||
ol
|
|
||||||
for step in steps
|
|
||||||
li!= step
|
|
||||||
.btn.btn-success.btn-large.btn-block.completed-challenge I've completed this challenge
|
|
||||||
.ten-pixel-break
|
|
||||||
.btn.btn-primary.btn-large.btn-block.completed-challenge.skip-challenge I want to skip this challenge for now
|
|
||||||
.panel-footer.text-center
|
|
||||||
span Need a break?
|
|
||||||
a(href="http://blog.freecodecamp.com", target="_blank") Check out our blog
|
|
||||||
|   and  
|
|
||||||
a(href="https://twitter.com/freecodecamp", target="_blank") our recent tweets
|
|
||||||
| .
|
|
||||||
|
|
||||||
#complete-dialog.modal
|
|
||||||
.modal-dialog.animated.zoomIn.fast-animation
|
|
||||||
.modal-content
|
|
||||||
.modal-header
|
|
||||||
a.close(href='#', data-dismiss='modal', aria-hidden='true') ×
|
|
||||||
.text-center
|
|
||||||
h1.animated.zoomInDown Nicely done!
|
|
||||||
.animated.zoomInUp.delay-1
|
|
||||||
span.landing-icon.ion-checkmark-circled.text-success
|
|
||||||
a.animated.fadeIn.delay-2.btn.btn-primary.btn-block(href=next, aria-hidden='true') Take me to my next challenge
|
|
||||||
#skip-dialog.modal
|
|
||||||
.modal-dialog.animated.zoomIn.fast-animation
|
|
||||||
.modal-content
|
|
||||||
.modal-header
|
|
||||||
a.close(href='#', data-dismiss='modal', aria-hidden='true') ×
|
|
||||||
.text-center
|
|
||||||
h1.animated.zoomInDown No problem.
|
|
||||||
h2.animated.zoomInDown You can retry this challenge any time.
|
|
||||||
.animated.zoomInUp.delay-1
|
|
||||||
span.landing-icon.ion-skip-forward.text-primary
|
|
||||||
a.animated.fadeIn.delay-2.btn.btn-primary.btn-block(href=next, aria-hidden='true') Take me to my next challenge
|
|
@ -2,6 +2,51 @@ extends ../layout
|
|||||||
block content
|
block content
|
||||||
.row
|
.row
|
||||||
.col-sm-12.col-md-8.col-xs-12
|
.col-sm-12.col-md-8.col-xs-12
|
||||||
include partials/challenge
|
.panel.panel-primary
|
||||||
|
.panel-heading Challenge: #{name}
|
||||||
|
.panel.panel-body
|
||||||
|
.challenge-brief
|
||||||
|
h3.text-center
|
||||||
|
span.ion-android-clock
|
||||||
|
span Takes about #{time}
|
||||||
|
.btn.btn-success.btn-large.btn-block.start-challenge Start the challenge
|
||||||
|
.challenge-content.hidden-element
|
||||||
|
.responsive-container
|
||||||
|
iframe(src='//player.vimeo.com/video/#{video}', frameborder='0', webkitallowfullscreen='', mozallowfullscreen='', allowfullscreen='')
|
||||||
|
h3 Steps:
|
||||||
|
h4
|
||||||
|
ol
|
||||||
|
for step in steps
|
||||||
|
li!= step
|
||||||
|
.btn.btn-success.btn-large.btn-block.completed-challenge I've completed this challenge
|
||||||
|
.ten-pixel-break
|
||||||
|
.btn.btn-primary.btn-large.btn-block.completed-challenge.skip-challenge I want to skip this challenge for now
|
||||||
|
.panel-footer.text-center
|
||||||
|
span Need a break?
|
||||||
|
a(href="http://blog.freecodecamp.com", target="_blank") Check out our blog
|
||||||
|
|   and  
|
||||||
|
a(href="https://twitter.com/freecodecamp", target="_blank") our recent tweets
|
||||||
|
| .
|
||||||
|
#complete-dialog.modal
|
||||||
|
.modal-dialog.animated.zoomIn.fast-animation
|
||||||
|
.modal-content
|
||||||
|
.modal-header
|
||||||
|
a.close(href='#', data-dismiss='modal', aria-hidden='true') ×
|
||||||
|
.text-center
|
||||||
|
h1.animated.zoomInDown Nicely done!
|
||||||
|
.animated.zoomInUp.delay-1
|
||||||
|
span.landing-icon.ion-checkmark-circled.text-success
|
||||||
|
a.animated.fadeIn.delay-2.btn.btn-primary.btn-block.complete-button(aria-hidden='true') Take me to my next challenge
|
||||||
|
#skip-dialog.modal
|
||||||
|
.modal-dialog.animated.zoomIn.fast-animation
|
||||||
|
.modal-content
|
||||||
|
.modal-header
|
||||||
|
a.close(href='#', data-dismiss='modal', aria-hidden='true') ×
|
||||||
|
.text-center
|
||||||
|
h1.animated.zoomInDown No problem.
|
||||||
|
h2.animated.zoomInDown You can retry this challenge any time.
|
||||||
|
.animated.zoomInUp.delay-1
|
||||||
|
span.landing-icon.ion-skip-forward.text-primary
|
||||||
|
a.animated.fadeIn.delay-2.btn.btn-primary.btn-block.skip-button(aria-hidden='true') Take me to my next challenge
|
||||||
.col-sm-12.col-md-4.col-xs-12
|
.col-sm-12.col-md-4.col-xs-12
|
||||||
include ../partials/challenges
|
include ../partials/challenges
|
Reference in New Issue
Block a user