Skip to content

Commit

Permalink
Hotfix fix basejump-zipline completion
Browse files Browse the repository at this point in the history
  • Loading branch information
Berkeley Martinez authored and Berkeley Martinez committed Nov 9, 2015
1 parent 390caf4 commit 8fe3a07
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 29 deletions.
6 changes: 5 additions & 1 deletion client/commonFramework.js
Original file line number Diff line number Diff line change
Expand Up @@ -1500,7 +1500,11 @@ $(document).ready(function() {
bonfireExecute(true);
}
});
} else if (common.challengeType !== '7' && common.challengeType !== '2') {
} else if (
common.challengeType !== '7' &&
common.challengeType !== '2' &&
common.challengeType !== '3'
) {
bonfireExecute(true);
}

Expand Down
67 changes: 39 additions & 28 deletions server/views/coursewares/showZiplineOrBasejump.jade
Original file line number Diff line number Diff line change
Expand Up @@ -37,29 +37,6 @@ block content
var userLoggedIn = false;
br
script(type="text/javascript").
var challenge_Id = !{JSON.stringify(challengeId)};
var challenge_Name = !{JSON.stringify(name)};
var started = Math.floor(Date.now());
var dashedName = !{JSON.stringify(dashedName)};
var challengeType = !{JSON.stringify(challengeType)};
var controlEnterHandler = function (e) {
$('body').unbind('keydown');
if (e.metaKey && e.keyCode === 13 ||
e.ctrlKey && e.keyCode === 13) {
$('#complete-zipline-or-basejump-dialog').modal('show');
} else {
$('body').bind('keydown', controlEnterHandler);
}
};
var modalControlEnterHandler = function (e) {
$('#complete-zipline-or-basejump-dialog').unbind('keydown');
if (e.metaKey && e.keyCode === 13 ||
e.ctrlKey && e.keyCode === 13) {
$('#next-courseware-button').click();
} else {
$('#complete-zipline-or-basejump-dialog').on('keydown', modalControlEnterHandler);
}
};

#complete-zipline-or-basejump-dialog.modal(tabindex='-1')
.modal-dialog.animated.fadeIn.fast-animation
Expand Down Expand Up @@ -92,24 +69,57 @@ block content
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
script.
$('#complete-zipline-or-basejump-dialog').on('keydown', modalControlEnterHandler);
else
a.btn.btn-lg.btn-primary.btn-block(href='/challenges/next-challenge?id=' + challengeId) Go to my next challenge
script.
$('body').on('keydown', controlEnterHandler);
include ../partials/challenge-modals
script.
var common = window.common || { init: [] };
common.challengeId = !{JSON.stringify(challengeId)};
common.challengeName = !{JSON.stringify(name)};
common.started = Math.floor(Date.now());
common.dashedName = !{JSON.stringify(dashedName)};
common.challengeType = !{JSON.stringify(challengeType)};

common.controlEnterHandler = function (e) {
$('body').unbind('keydown');
if (e.metaKey && e.keyCode === 13 ||
e.ctrlKey && e.keyCode === 13) {
$('#complete-zipline-or-basejump-dialog').modal('show');
} else {
$('body').bind('keydown', common.controlEnterHandler);
}
};

common.modalControlEnterHandler = function (e) {
$('#complete-zipline-or-basejump-dialog').unbind('keydown');
if (e.metaKey && e.keyCode === 13 ||
e.ctrlKey && e.keyCode === 13) {
$('#next-courseware-button').click();
} else {
$('#complete-zipline-or-basejump-dialog').on('keydown', common.modalControlEnterHandler);
}
};

common.init.push(function() {
$('body').on('keydown', common.controlEnterHandler);

if (!!{ JSON.stringify(user ? true : false)}) {
$('#complete-zipline-or-basejump-dialog').on('keydown', common.modalControlEnterHandler);
}
});


document.addEventListener('gitter-sidecar-ready', function(e) {
var challengeType = !{JSON.stringify(challengeType)};
var room = 'freecodecamp/help';
var title;

if (challengeType === '4') {
if (common.challengeType === '4') {
room = 'freecodecamp/helpBasejumps';
title = 'Basejump Help';
}

if (challengeType === '3') {
if (common.challengeType === '3') {
room = 'freecodecamp/helpZiplines';
title = 'Zipline Help';
}
Expand All @@ -118,3 +128,4 @@ block content
window.main.chat.createHelpChat(room, '#challenge-help-btn', title);
}
});
include ../partials/challenge-footer

0 comments on commit 8fe3a07

Please sign in to comment.