fix only submit on user click

pull/2770/head
Berkeley Martinez 2015-08-26 13:09:38 -07:00
parent 306551848c
commit 2c9ed16b7a
4 changed files with 22 additions and 24 deletions

View File

@ -294,27 +294,26 @@ function showCompletion() {
', Attempts: ' + attempts);
var bonfireSolution = myCodeMirror.getValue();
var didCompleteWith = $('#completed-with').val() || null;
$.post(
$('#complete-courseware-dialog').modal('show');
$('#submit-challenge').click(function(e) {
e.preventDefault();
$.post(
'/completed-bonfire/', {
challengeInfo: {
challengeId: challenge_Id,
challengeName: challenge_Name,
completedWith: didCompleteWith,
challengeType: challengeType,
solution: bonfireSolution
}
challengeInfo: {
challengeId: challenge_Id,
challengeName: challenge_Name,
completedWith: didCompleteWith,
challengeType: challengeType,
solution: bonfireSolution
}
},
function(res) {
if (res) {
$('#complete-courseware-dialog').modal('show');
$('#complete-courseware-dialog').keydown(function(e) {
if (e.ctrlKey && e.keyCode == 13) {
$('#next-courseware-button').click();
}
});
}
if (res) {
window.location = '/challenges/next-challenge';
}
}
);
);
});
}
var resetEditor = function resetEditor() {

View File

@ -124,7 +124,7 @@ block content
form.code
.form-group.codeMirrorView
textarea#codeEditor(autofocus=true, style='display: none;')
script(src='/js/lib/coursewares/commonFrameWork_0.0.5.js')
script(src='/js/lib/coursewares/commonFrameWork_0.0.6.js')
script.
editor.setOption("mode", "javascript");
@ -138,8 +138,7 @@ block content
.animated.zoomInDown.delay-half
span.completion-icon.ion-checkmark-circled.text-primary
if (user)
a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block#next-courseware-button(name='_csrf', value=_csrf) Go to my next challenge (ctrl + enter)
#submit-challenge.animated.fadeIn.btn.btn-lg.btn-primary.btn-block Submit
if (user.progressTimestamps.length > 2)
a.animated.fadeIn.btn.btn-lg.btn-block.btn-twitter(target="_blank", href="https://twitter.com/intent/tweet?text=I%20just%20#{verb}%20%40FreeCodeCamp%20#{name}&url=http%3A%2F%2Ffreecodecamp.com/challenges/#{dashedName}&hashtags=LearnToCode, JavaScript")

View File

@ -72,7 +72,7 @@ block content
form.code
.codeMirrorView
textarea#codeEditor(autofocus=true, style='display: none;')
script(src = '/js/lib/coursewares/commonFrameWork_0.0.5.js')
script(src = '/js/lib/coursewares/commonFrameWork_0.0.6.js')
script.
editor.setOption("mode", "text/html");
.col-md-4.col-lg-3
@ -91,7 +91,7 @@ block content
.animated.zoomInDown.delay-half
span.completion-icon.ion-checkmark-circled.text-primary
if(user)
a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block(href='/challenges/next-challenge') Go to the next challenge
#submit-challenge.animated.fadeIn.btn.btn-lg.btn-primary.btn-block Submit
else
a.animated.fadeIn.btn.btn-lg.signup-btn.btn-block(href='/login') Sign in so you can save your progress
include ../partials/challenge-modals

View File

@ -72,7 +72,7 @@ block content
form.code
.codeMirrorView
textarea#codeEditor(autofocus=true, style='display: none;')
script(src = '/js/lib/coursewares/commonFrameWork_0.0.5.js')
script(src = '/js/lib/coursewares/commonFrameWork_0.0.6.js')
script.
editor.setOption("mode", "javascript");
#complete-courseware-dialog.modal(tabindex='-1')
@ -85,7 +85,7 @@ block content
.animated.zoomInDown.delay-half
span.completion-icon.ion-checkmark-circled.text-primary
if (user)
a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block#next-courseware-button(name='_csrf', value=_csrf) Go to my next challenge (ctrl + enter)
#submit-challenge.animated.fadeIn.btn.btn-lg.btn-primary.btn-block Submit
if (user.progressTimestamps.length > 2)
a.animated.fadeIn.btn.btn-lg.btn-block.btn-twitter(target="_blank", href="https://twitter.com/intent/tweet?text=I%20just%20#{verb}%20%40FreeCodeCamp%20#{name}&url=http%3A%2F%2Ffreecodecamp.com/challenges/#{dashedName}&hashtags=LearnToCode, JavaScript")
i.fa.fa-twitter