Merge branch 'feature/ctrl-enter-submit' of github.com:FreeCodeCamp/freecodecamp into feature/ctrl-enter-submit
Conflicts: client/commonFramework.js server/views/coursewares/showBonfire.jade server/views/coursewares/showJS.jade
This commit is contained in:
@ -420,6 +420,13 @@ var testSuccess = function() {
|
|||||||
isInitRun = false;
|
isInitRun = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function ctrlEnterClickHandler(e) {
|
||||||
|
// ctrl + enter
|
||||||
|
if (e.ctrlKey && e.keyCode === 13) {
|
||||||
|
$('#submit-challenge').click();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function showCompletion() {
|
function showCompletion() {
|
||||||
if (isInitRun) {
|
if (isInitRun) {
|
||||||
isInitRun = false;
|
isInitRun = false;
|
||||||
@ -435,6 +442,8 @@ function showCompletion() {
|
|||||||
);
|
);
|
||||||
var bonfireSolution = myCodeMirror.getValue();
|
var bonfireSolution = myCodeMirror.getValue();
|
||||||
var didCompleteWith = $('#completed-with').val() || null;
|
var didCompleteWith = $('#completed-with').val() || null;
|
||||||
|
|
||||||
|
|
||||||
$('#complete-courseware-dialog').modal('show');
|
$('#complete-courseware-dialog').modal('show');
|
||||||
$('#complete-courseware-dialog .modal-header').click();
|
$('#complete-courseware-dialog .modal-header').click();
|
||||||
|
|
||||||
@ -774,6 +783,17 @@ $('#submitButton').on('click', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
// init modal keybindings on open
|
||||||
|
$('#complete-courseware-dialog').on('shown.bs.modal', function() {
|
||||||
|
$('#complete-courseware-dialog').keyup(ctrlEnterClickHandler);
|
||||||
|
});
|
||||||
|
|
||||||
|
// remove modal keybinds on close
|
||||||
|
$('#complete-courseware-dialog').on('hidden.bs.modal', function() {
|
||||||
|
$('#complete-courseware-dialog').unbind('keyup', ctrlEnterClickHandler);
|
||||||
|
});
|
||||||
|
|
||||||
var $preview = $('#preview');
|
var $preview = $('#preview');
|
||||||
isInitRun = true;
|
isInitRun = true;
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ block content
|
|||||||
editor.setOption("mode", "javascript");
|
editor.setOption("mode", "javascript");
|
||||||
|
|
||||||
#complete-courseware-dialog.modal(tabindex='-1')
|
#complete-courseware-dialog.modal(tabindex='-1')
|
||||||
.modal-dialog.animated.zoomIn.fast-animation
|
.modal-dialog.animated.fadeIn.fast-animation
|
||||||
.modal-content
|
.modal-content
|
||||||
.modal-header.challenge-list-header= compliment
|
.modal-header.challenge-list-header= compliment
|
||||||
a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') ×
|
a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') ×
|
||||||
@ -142,13 +142,12 @@ block content
|
|||||||
.row
|
.row
|
||||||
if (user)
|
if (user)
|
||||||
#submit-challenge.animated.fadeIn.btn.btn-lg.btn-primary.btn-block Submit and go to my next challenge (ctrl + enter)
|
#submit-challenge.animated.fadeIn.btn.btn-lg.btn-primary.btn-block Submit and go to my next challenge (ctrl + enter)
|
||||||
|
|
||||||
if (user.progressTimestamps.length > 2)
|
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")
|
a.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  
|
i.fa.fa-twitter  
|
||||||
= phrase
|
= phrase
|
||||||
else
|
else
|
||||||
a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block(href='/challenges/next-challenge?id=' + challengeId) Go to my next challenge
|
a.btn.btn-lg.btn-primary.btn-block(href='/challenges/next-challenge?id=' + challengeId) Go to my next challenge
|
||||||
#reset-modal.modal(tabindex='-1')
|
#reset-modal.modal(tabindex='-1')
|
||||||
.modal-dialog.animated.fadeInUp.fast-animation
|
.modal-dialog.animated.fadeInUp.fast-animation
|
||||||
.modal-content
|
.modal-content
|
||||||
|
@ -80,7 +80,7 @@ block content
|
|||||||
iframe.iphone.iframe-scroll#preview
|
iframe.iphone.iframe-scroll#preview
|
||||||
.spacer
|
.spacer
|
||||||
#complete-courseware-dialog.modal(tabindex='-1')
|
#complete-courseware-dialog.modal(tabindex='-1')
|
||||||
.modal-dialog.animated.zoomIn.fast-animation
|
.modal-dialog.animated.fadeIn.fast-animation
|
||||||
.modal-content
|
.modal-content
|
||||||
.modal-header.challenge-list-header
|
.modal-header.challenge-list-header
|
||||||
= compliment
|
= compliment
|
||||||
@ -94,5 +94,5 @@ block content
|
|||||||
if(user)
|
if(user)
|
||||||
#submit-challenge.animated.fadeIn.btn.btn-lg.btn-primary.btn-block Submit and go to my next challenge (ctrl + enter)
|
#submit-challenge.animated.fadeIn.btn.btn-lg.btn-primary.btn-block Submit and go to my next challenge (ctrl + enter)
|
||||||
else
|
else
|
||||||
a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block(href='/challenges/next-challenge?id=' + challengeId) Go to my next challenge
|
a.btn.btn-lg.btn-primary.btn-block(href='/challenges/next-challenge?id=' + challengeId) Go to my next challenge
|
||||||
include ../partials/challenge-modals
|
include ../partials/challenge-modals
|
||||||
|
@ -76,7 +76,7 @@ block content
|
|||||||
script.
|
script.
|
||||||
editor.setOption("mode", "javascript");
|
editor.setOption("mode", "javascript");
|
||||||
#complete-courseware-dialog.modal(tabindex='-1')
|
#complete-courseware-dialog.modal(tabindex='-1')
|
||||||
.modal-dialog.animated.zoomIn.fast-animation
|
.modal-dialog.animated.fadeIn.fast-animation
|
||||||
.modal-content
|
.modal-content
|
||||||
.modal-header.challenge-list-header= compliment
|
.modal-header.challenge-list-header= compliment
|
||||||
a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') ×
|
a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') ×
|
||||||
@ -88,9 +88,9 @@ block content
|
|||||||
.spacer
|
.spacer
|
||||||
.row
|
.row
|
||||||
if (user)
|
if (user)
|
||||||
#submit-challenge.animated.fadeIn.btn.btn-lg.btn-primary.btn-block Submit and go to next challenge (Ctrl + enter)
|
#submit-challenge.animated.fadeIn.btn.btn-lg.btn-primary.btn-block Submit and go to my next challenge (ctrl + enter)
|
||||||
if (user.progressTimestamps.length > 2)
|
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")
|
a.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  
|
i.fa.fa-twitter  
|
||||||
= phrase
|
= phrase
|
||||||
else
|
else
|
||||||
|
@ -57,7 +57,7 @@ block content
|
|||||||
};
|
};
|
||||||
|
|
||||||
#complete-courseware-editorless-dialog.modal(tabindex='-1')
|
#complete-courseware-editorless-dialog.modal(tabindex='-1')
|
||||||
.modal-dialog.animated.zoomIn.fast-animation
|
.modal-dialog.animated.fadeIn.fast-animation
|
||||||
.modal-content
|
.modal-content
|
||||||
.modal-header.challenge-list-header= compliment
|
.modal-header.challenge-list-header= compliment
|
||||||
a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') ×
|
a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') ×
|
||||||
@ -66,13 +66,13 @@ block content
|
|||||||
.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 (user)
|
if (user)
|
||||||
a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block#next-courseware-button(name='_csrf', value=_csrf) Go to my next challenge
|
a.btn.btn-lg.btn-primary.btn-block#next-courseware-button(name='_csrf', value=_csrf) Go to my next challenge
|
||||||
script.
|
script.
|
||||||
$('#complete-courseware-editorless-dialog').bind('keypress', modalControlEnterHandler);
|
$('#complete-courseware-editorless-dialog').bind('keypress', modalControlEnterHandler);
|
||||||
|
|
||||||
if (user.progressTimestamps.length > 2)
|
if (user.progressTimestamps.length > 2)
|
||||||
.button-spacer
|
.button-spacer
|
||||||
a.animated.fadeIn.btn.btn-lg.btn-block.btn-twitter(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" target="_blank")
|
a.btn.btn-lg.btn-block.btn-twitter(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" target="_blank")
|
||||||
i.fa.fa-twitter  
|
i.fa.fa-twitter  
|
||||||
= phrase
|
= phrase
|
||||||
else
|
else
|
||||||
|
@ -33,7 +33,7 @@ block content
|
|||||||
script.
|
script.
|
||||||
var userLoggedIn = true;
|
var userLoggedIn = true;
|
||||||
else
|
else
|
||||||
a.animated.fadeIn.btn.btn-big.btn-primary.btn-block(href='/challenges/next-challenge?id=' + challengeId) Go to my next challenge (ctrl + enter)
|
a.btn.btn-big.btn-primary.btn-block(href='/challenges/next-challenge?id=' + challengeId) Go to my next challenge (ctrl + enter)
|
||||||
a.btn.btn-big.signup-btn.btn-block(href='/login') Sign in so you can save your progress
|
a.btn.btn-big.signup-btn.btn-block(href='/login') Sign in so you can save your progress
|
||||||
script.
|
script.
|
||||||
var userLoggedIn = false;
|
var userLoggedIn = false;
|
||||||
@ -62,7 +62,7 @@ block content
|
|||||||
};
|
};
|
||||||
|
|
||||||
#complete-zipline-or-basejump-dialog.modal(tabindex='-1')
|
#complete-zipline-or-basejump-dialog.modal(tabindex='-1')
|
||||||
.modal-dialog.animated.zoomIn.fast-animation
|
.modal-dialog.animated.fadeIn.fast-animation
|
||||||
.modal-content
|
.modal-content
|
||||||
.modal-header.challenge-list-header= compliment
|
.modal-header.challenge-list-header= compliment
|
||||||
a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') ×
|
a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') ×
|
||||||
@ -73,7 +73,7 @@ block content
|
|||||||
if (user)
|
if (user)
|
||||||
form.form-horizontal(novalidate='novalidate', name='completedWithForm')
|
form.form-horizontal(novalidate='novalidate', name='completedWithForm')
|
||||||
.form-group.text-center
|
.form-group.text-center
|
||||||
.col-xs-10.col-xs-offset-1.col-sm-8.col-sm-offset-2.col-md-8.col-md-offset-2.animated.fadeIn
|
.col-xs-10.col-xs-offset-1.col-sm-8.col-sm-offset-2.col-md-8.col-md-offset-2
|
||||||
// extra field to distract password tools like lastpass from injecting css into our username field
|
// extra field to distract password tools like lastpass from injecting css into our username field
|
||||||
input.form-control(ng-show="false")
|
input.form-control(ng-show="false")
|
||||||
if (challengeType === "3")
|
if (challengeType === "3")
|
||||||
@ -89,12 +89,12 @@ block content
|
|||||||
| Username not found
|
| Username not found
|
||||||
|
|
||||||
if (user)
|
if (user)
|
||||||
a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block#next-courseware-button(name='_csrf', value=_csrf, ng-disabled='completedWithForm.$invalid') Go to my next challenge
|
a.btn.btn-lg.btn-primary.btn-block#next-courseware-button(name='_csrf', value=_csrf, ng-disabled='completedWithForm.$invalid') Go to my next challenge
|
||||||
.button-spacer
|
.button-spacer
|
||||||
script.
|
script.
|
||||||
$('#complete-zipline-or-basejump-dialog').on('keypress', modalControlEnterHandler);
|
$('#complete-zipline-or-basejump-dialog').on('keypress', modalControlEnterHandler);
|
||||||
else
|
else
|
||||||
a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block(href='/challenges/next-challenge?id=' + challengeId) Go to my next challenge
|
a.btn.btn-lg.btn-primary.btn-block(href='/challenges/next-challenge?id=' + challengeId) Go to my next challenge
|
||||||
script.
|
script.
|
||||||
$('body').on('keypress', controlEnterHandler);
|
$('body').on('keypress', controlEnterHandler);
|
||||||
include ../partials/challenge-modals
|
include ../partials/challenge-modals
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#pair-modal.modal(tabindex='-1')
|
#pair-modal.modal(tabindex='-1')
|
||||||
.modal-dialog.animated.zoomIn.fast-animation
|
.modal-dialog.animated.fadeIn.fast-animation
|
||||||
.modal-content
|
.modal-content
|
||||||
.modal-header.challenge-list-header Ready to pair program?
|
.modal-header.challenge-list-header Ready to pair program?
|
||||||
a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') ×
|
a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') ×
|
||||||
@ -13,7 +13,7 @@
|
|||||||
a.btn.btn-lg.btn-info.btn-block(href='#', data-dismiss='modal', aria-hidden='true') Cancel
|
a.btn.btn-lg.btn-info.btn-block(href='#', data-dismiss='modal', aria-hidden='true') Cancel
|
||||||
|
|
||||||
#issue-modal.modal(tabindex='-1')
|
#issue-modal.modal(tabindex='-1')
|
||||||
.modal-dialog.animated.zoomIn.fast-animation
|
.modal-dialog.animated.fadeIn.fast-animation
|
||||||
.modal-content
|
.modal-content
|
||||||
.modal-header.challenge-list-header Did you find a bug?
|
.modal-header.challenge-list-header Did you find a bug?
|
||||||
a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') ×
|
a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') ×
|
||||||
@ -25,7 +25,7 @@
|
|||||||
a.btn.btn-lg.btn-info.btn-block(href='#', data-dismiss='modal', aria-hidden='true') Cancel
|
a.btn.btn-lg.btn-info.btn-block(href='#', data-dismiss='modal', aria-hidden='true') Cancel
|
||||||
|
|
||||||
#help-modal.modal(tabindex='-1')
|
#help-modal.modal(tabindex='-1')
|
||||||
.modal-dialog.animated.zoomIn.fast-animation
|
.modal-dialog.animated.fadeIn.fast-animation
|
||||||
.modal-content
|
.modal-content
|
||||||
.modal-header.challenge-list-header Need some help?
|
.modal-header.challenge-list-header Need some help?
|
||||||
a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') ×
|
a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') ×
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
(typeof username !== 'undefined' ?
|
(typeof username !== 'undefined' ?
|
||||||
"<button id='" + data[i].id + "' class='btn btn-no-shadow btn-primary btn-block btn-primary-ghost btn-upvote'>upvote</button>" :
|
"<button id='" + data[i].id + "' class='btn btn-no-shadow btn-primary btn-block btn-primary-ghost btn-upvote'>upvote</button>" :
|
||||||
"<a href='/signup' class='btn btn-no-shadow btn-primary btn-block btn-primary-ghost btn-upvote'>upvote</a>") +
|
"<a href='/signup' class='btn btn-no-shadow btn-primary btn-block btn-primary-ghost btn-upvote'>upvote</a>") +
|
||||||
"<a class='btn btn-no-shadow btn-primary btn-block btn-primary-ghost' href='/news/" + linkedName + "'>more info...</a>" +
|
"<a class='btn btn-no-shadow btn-primary btn-block btn-primary-ghost' href='/news/" + linkedName + "'>more info</a>" +
|
||||||
"</div>" +
|
"</div>" +
|
||||||
"</div>" +
|
"</div>" +
|
||||||
"<div class='hidden-xs row media-stories'>" +
|
"<div class='hidden-xs row media-stories'>" +
|
||||||
@ -69,7 +69,7 @@
|
|||||||
(typeof username !== 'undefined' ?
|
(typeof username !== 'undefined' ?
|
||||||
"<button id='" + data[i].id + "' class='btn btn-no-shadow btn-primary btn-xs btn-primary-ghost btn-upvote'>upvote</button>" :
|
"<button id='" + data[i].id + "' class='btn btn-no-shadow btn-primary btn-xs btn-primary-ghost btn-upvote'>upvote</button>" :
|
||||||
"<a href='/signin' class='btn btn-no-shadow btn-primary btn-xs btn-primary-ghost'>upvote</a>") +
|
"<a href='/signin' class='btn btn-no-shadow btn-primary btn-xs btn-primary-ghost'>upvote</a>") +
|
||||||
" · <a class='btn btn-no-shadow btn-primary btn-xs btn-primary-ghost' href='/news/" + linkedName + "'>more info...</a> · " +
|
" · <a class='btn btn-no-shadow btn-primary btn-xs btn-primary-ghost' href='/news/" + linkedName + "'>more info</a> · " +
|
||||||
rank + (rank > 1 ? " points" : " point") + " · posted " +
|
rank + (rank > 1 ? " points" : " point") + " · posted " +
|
||||||
moment(data[i].timePosted).fromNow() +
|
moment(data[i].timePosted).fromNow() +
|
||||||
" by <a href='/" + data[i].author.username + "'>@" + data[i].author.username + "</a> " +
|
" by <a href='/" + data[i].author.username + "'>@" + data[i].author.username + "</a> " +
|
||||||
|
@ -84,7 +84,7 @@ script.
|
|||||||
"</div>" +
|
"</div>" +
|
||||||
"<div class='col-xs-12'>" +
|
"<div class='col-xs-12'>" +
|
||||||
"<br>" +
|
"<br>" +
|
||||||
"<a class='btn btn-no-shadow btn-primary btn-block btn-primary-ghost' href='/news/" + linkedName + "'>more info...</a>" +
|
"<a class='btn btn-no-shadow btn-primary btn-block btn-primary-ghost' href='/news/" + linkedName + "'>more info</a>" +
|
||||||
"</div>" +
|
"</div>" +
|
||||||
"</div>" +
|
"</div>" +
|
||||||
"</div>" +
|
"</div>" +
|
||||||
@ -103,7 +103,7 @@ script.
|
|||||||
"</a>" +
|
"</a>" +
|
||||||
"</div>" +
|
"</div>" +
|
||||||
"<div class='story-byline col-xs-12 wrappable'>" +
|
"<div class='story-byline col-xs-12 wrappable'>" +
|
||||||
"<a class='btn btn-no-shadow btn-primary btn-xs btn-primary-ghost' href='/news/" + linkedName + "'>more info...</a> · " +
|
"<a class='btn btn-no-shadow btn-primary btn-xs btn-primary-ghost' href='/news/" + linkedName + "'>more info</a> · " +
|
||||||
rank + (rank > 1 ? " points" : " point") + " · posted " +
|
rank + (rank > 1 ? " points" : " point") + " · posted " +
|
||||||
moment(data[i].timePosted).fromNow() +
|
moment(data[i].timePosted).fromNow() +
|
||||||
" by <a href='/" + data[i].author.username + "'>@" + data[i].author.username +
|
" by <a href='/" + data[i].author.username + "'>@" + data[i].author.username +
|
||||||
|
Reference in New Issue
Block a user