Fixes issue #353, add control-enter functionality to display modal as well as submit completion. Added bonus is to remove event listener.

This commit is contained in:
terakilobyte
2015-04-23 19:30:24 -04:00
parent 84fd61721a
commit 2a00a79ffc
2 changed files with 16 additions and 0 deletions

View File

@ -45,6 +45,13 @@ block content
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) On to my next challenge (ctrl + enter)
script.
$('#complete-courseware-dialog').on('keypress', function(e) {
$('body').unbind('keypress');
if (e.ctrlKey && e.keyCode == 13) {
$('#next-courseware-button').click();
}
});
- if (user.progressTimestamps.length > 2)
a.animated.fadeIn.btn.btn-lg.btn-block.btn-twitter(href="https://twitter.com/intent/tweet?text=I%20just%20#{verb}%20%40FreeCodeCamp%20Bonfire:%20#{name}&url=http%3A%2F%2Ffreecodecamp.com/bonfires/#{dashedName}&hashtags=LearnToCode, JavaScript" target="_blank")
i.fa.fa-twitter  
@ -54,6 +61,7 @@ block content
h1 #{name}
script.
$('body').on('keypress', function(e) {
$('body').unbind('keypress');
if (e.ctrlKey && e.keyCode == 13) {
$('#complete-courseware-dialog').modal('show');
}

View File

@ -62,6 +62,13 @@ block content
if (user)
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)
script.
$('#complete-zipline-or-basejump-dialog').on('keypress', function (e) {
$('body').unbind('keypress');
if (e.ctrlKey && e.keyCode == 13) {
$('#next-courseware-button').click();
}
});
- if (user.progressTimestamps.length > 2)
a.animated.fadeIn.btn.btn-lg.btn-block.btn-twitter(target="_blank")
@ -71,6 +78,7 @@ block content
a.animated.fadeIn.btn.btn-lg.signup-btn.btn-block(href='/login') Sign in so you can save your progress
script.
$('body').on('keypress', function(e) {
$('body').unbind('keypress');
if (e.ctrlKey && e.keyCode == 13) {
$('#complete-zipline-or-basejump-dialog').modal('show');
}