From 673a61715106c712a8a594075919e88c78d02510 Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Thu, 28 May 2015 14:29:45 -0700 Subject: [PATCH] create pair, help, bug modals --- controllers/resources.js | 10 ++-- public/js/main_0.0.2.js | 26 +++++++--- views/coursewares/showBonfire.jade | 13 ++--- views/coursewares/showHTML.jade | 6 ++- views/coursewares/showJS.jade | 7 +-- views/coursewares/showVideo.jade | 7 +-- views/coursewares/showZiplineOrBasejump.jade | 9 ++-- views/partials/challenge-modals.jade | 52 ++++++++++++++++++++ 8 files changed, 100 insertions(+), 30 deletions(-) create mode 100644 views/partials/challenge-modals.jade diff --git a/controllers/resources.js b/controllers/resources.js index 7ccc73e9a8..a901ce5811 100644 --- a/controllers/resources.js +++ b/controllers/resources.js @@ -607,8 +607,8 @@ module.exports = { var challenge = req.body.payload.challenge; slack.send({ - text: "*" + userName + "* wants help with " + challenge + ". " + - code + "Hey, *" + userName + "*, if no one helps you right " + + text: "*@" + userName + "* wants help with " + challenge + ". " + + code + "Hey, *@" + userName + "*, if no one helps you right " + "away, try typing out your problem in detail to me. Like this: " + "http://en.wikipedia.org/wiki/Rubber_duck_debugging", channel: '#help', @@ -622,11 +622,11 @@ module.exports = { var userName = req.user.profile.username; var challenge = req.body.payload.challenge; slack.send({ - text: "Anyone want to pair with @" + userName + " on " + challenge + - "?\nMake sure you install Screen Hero here:" + + text: "Anyone want to pair with *@" + userName + "* on " + challenge + + "?\nMake sure you install Screen Hero here: " + "http://freecodecamp.com/field-guide/how-do-i-install-screenhero\n" + "Then start your pair program session with *" + userName + - "* by typing \"/hero @" + userName + "\" into Slack.\n And *"+ userName + + "* by typing \"/hero @" + userName + "\" into Slack.\n And *@"+ userName + "*, be sure to launch Screen Hero, then keep coding. " + "Another camper may pair with you soon.", channel: '#letspair', diff --git a/public/js/main_0.0.2.js b/public/js/main_0.0.2.js index b2791bdaeb..8aaf409219 100644 --- a/public/js/main_0.0.2.js +++ b/public/js/main_0.0.2.js @@ -17,7 +17,7 @@ $(document).ready(function() { setCSRFToken($('meta[name="csrf-token"]').attr('content')); $('#i-want-help').on('click', function() { - /* + $('#help-modal').modal('hide'); var editorValue = editor.getValue(); var currentLocation = window.location.href; $.post( @@ -34,11 +34,10 @@ $(document).ready(function() { } } ); - */ }); $('#i-want-help-editorless').on('click', function() { - /* + $('#help-modal-editorless').modal('hide'); var currentLocation = window.location.href; $.post( '/get-help', @@ -53,14 +52,15 @@ $(document).ready(function() { } } ); - */ }); $('#report-issue').on('click', function() { - window.open('https://github.com/freecodecamp/freecodecamp/issues/new?title=Challenge '+ window.location.href +' has an issue &body=Please%20tell%20us%20in%20detail%20here%20how%20we%20can%20make%20this%20challenge%20better.', '_blank') + $('#issue-modal').modal('hide'); + window.open('https://github.com/freecodecamp/freecodecamp/issues/new?&body=Challenge '+ window.location.href +' has an issue. Please describe how to reproduce it, and include links to screen shots if possible.', '_blank') }); $('#i-want-to-pair').on('click', function() { + $('#pair-modal').modal('hide'); var currentLocation = window.location.href; $.post( '/get-pair', @@ -134,8 +134,20 @@ $(document).ready(function() { $(this).unbind("error").attr("src", "https://s3.amazonaws.com/freecodecamp/camper-image-placeholder.png"); }); - $('#completed-courseware').on('click', function() { - $('#complete-courseware-dialog').modal('show'); + $('#trigger-pair-modal').on('click', function() { + $('#pair-modal').modal('show'); + }); + + $('#trigger-help-modal').on('click', function() { + $('#help-modal').modal('show'); + }); + + $('#trigger-help-editorless-modal').on('click', function() { + $('#help-editorless-modal').modal('show'); + }); + + $('#trigger-issue-modal').on('click', function() { + $('#issue-modal').modal('show'); }); $('#completed-zipline-or-basejump').on('click', function() { diff --git a/views/coursewares/showBonfire.jade b/views/coursewares/showBonfire.jade index 8535dc1d54..471be7dc68 100644 --- a/views/coursewares/showBonfire.jade +++ b/views/coursewares/showBonfire.jade @@ -94,13 +94,13 @@ block content if (user && user.sentSlackInvite) .button-spacer .btn-group.input-group.btn-group-justified - label.btn.btn-success#i-want-help(disabled) + label.btn.btn-success#trigger-help-modal i.fa.fa-medkit - |   Help(disabled) - label.btn.btn-success#i-want-to-pair + |   Help + label.btn.btn-success#trigger-pair-modal i.fa.fa-user-plus |   Pair - label.btn.btn-success#report-issue + label.btn.btn-success#trigger-issue-modal i.fa.fa-bug |   Bug .button-spacer @@ -142,14 +142,15 @@ block content - 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%20Bonfire:%20#{name}&url=http%3A%2F%2Ffreecodecamp.com/challenges/#{dashedName}&hashtags=LearnToCode, JavaScript") + 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   = phrase - 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 script. var MDNlinks = !{JSON.stringify(MDNlinks)}; if (!MDNlinks.length) { $('#MDN-links').addClass('collapse'); } + diff --git a/views/coursewares/showHTML.jade b/views/coursewares/showHTML.jade index 34d0d268ed..3d9677811a 100644 --- a/views/coursewares/showHTML.jade +++ b/views/coursewares/showHTML.jade @@ -46,10 +46,10 @@ block content if (user.sentSlackInvite) .button-spacer .btn-group.input-group.btn-group-justified - label.btn.btn-success#i-want-help(disabled) + label.btn.btn-success#trigger-help-modal i.fa.fa-medkit |   Help(disabled) - label.btn.btn-success#report-issue + label.btn.btn-success#trigger-issue-modal i.fa.fa-bug |   Bug .button-spacer @@ -92,3 +92,5 @@ block content span.completion-icon.ion-checkmark-circled.text-primary a.animated.fadeIn.btn.btn-lg.signup-btn.btn-block(href='/login') Sign in so you can save your progress script(src="/js/lib/coursewares/coursewaresHCJQFramework_0.1.3.js") + include ../partials/challenge-modals + diff --git a/views/coursewares/showJS.jade b/views/coursewares/showJS.jade index f6d6f62979..5c24f9ea90 100644 --- a/views/coursewares/showJS.jade +++ b/views/coursewares/showJS.jade @@ -38,13 +38,13 @@ block content if (user && user.sentSlackInvite) .button-spacer .btn-group.input-group.btn-group-justified - label.btn.btn-success#i-want-help + label.btn.btn-success#trigger-help-modal i.fa.fa-medkit |   Help - label.btn.btn-success#i-want-to-pair + label.btn.btn-success#trigger-pair-modal i.fa.fa-user-plus |   Pair - label.btn.btn-success#report-issue + label.btn.btn-success#trigger-issue-modal i.fa.fa-bug |   Bug .spacer @@ -85,3 +85,4 @@ block content = phrase - 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 diff --git a/views/coursewares/showVideo.jade b/views/coursewares/showVideo.jade index 9cd162988d..c180258626 100644 --- a/views/coursewares/showVideo.jade +++ b/views/coursewares/showVideo.jade @@ -23,10 +23,10 @@ block content .button-spacer if (user.sentSlackInvite) .btn-group.input-group.btn-group-justified - .btn.btn-success.btn-big#i-want-help-editorless(disabled) + .btn.btn-success.btn-big#trigger-help-editorless-modal i.fa.fa-medkit - |   Get help(disabled) - .btn.btn-success.btn-big#report-issue + |   Get help + .btn.btn-success.btn-big#trigger-issue-modal i.fa.fa-bug |   Report a bug .button-spacer @@ -84,3 +84,4 @@ block content var challenge_Id = !{JSON.stringify(challengeId)}; var challenge_Name = !{JSON.stringify(name)}; var challengeType = !{JSON.stringify(challengeType)}; + include ../partials/challenge-modals diff --git a/views/coursewares/showZiplineOrBasejump.jade b/views/coursewares/showZiplineOrBasejump.jade index a114e96d0e..7ce4b850a1 100644 --- a/views/coursewares/showZiplineOrBasejump.jade +++ b/views/coursewares/showZiplineOrBasejump.jade @@ -21,13 +21,13 @@ block content if (user.sentSlackInvite) .button-spacer .btn-group.input-group.btn-group-justified - .btn.btn-success.btn-big#i-want-help-editorless(disabled) + .btn.btn-success.btn-big#trigger-help-editorless-modal i.fa.fa-medkit - |   Help(disabled) - .btn.btn-success.btn-big#i-want-to-pair + |   Help + .btn.btn-success.btn-big#trigger-pair-modal i.fa.fa-user-plus |   Pair - .btn.btn-success.btn-big#report-issue + .btn.btn-success.btn-big#trigger-issue-modal i.fa.fa-bug |   Bug .button-spacer @@ -101,3 +101,4 @@ 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', controlEnterHandler); + include ../partials/challenge-modals diff --git a/views/partials/challenge-modals.jade b/views/partials/challenge-modals.jade new file mode 100644 index 0000000000..2715ed0b98 --- /dev/null +++ b/views/partials/challenge-modals.jade @@ -0,0 +1,52 @@ +#pair-modal.modal(tabindex='-1') + .modal-dialog.animated.zoomIn.fast-animation + .modal-content + .modal-header.challenge-list-header Ready to pair program? + a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') × + .modal-body.text-center + h3 This will create a pair programming request. + h3 You'll need   + a(href='/field-guide/how-do-i-install-screenhero' target='_blank') Screen Hero + | . + h3 Other campers may then message you about pair programming. + a.btn.btn-lg.btn-primary.btn-block#i-want-to-pair(name='_csrf', value=_csrf) Create my pair request + a.btn.btn-lg.btn-info.btn-block(href='#', data-dismiss='modal', aria-hidden='true') Cancel + +#issue-modal.modal(tabindex='-1') + .modal-dialog.animated.zoomIn.fast-animation + .modal-content + .modal-header.challenge-list-header Did you find a bug? + a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') × + .modal-body.text-center + h3 This will open our GitHub Issues page. + h3 Please tell us how to reproduce the bug and link us to screen shots if possible. + a.btn.btn-lg.btn-primary.btn-block#report-issue(name='_csrf', value=_csrf) Create my GitHub issue + a.btn.btn-lg.btn-info.btn-block(href='#', data-dismiss='modal', aria-hidden='true') Cancel + +#help-modal.modal(tabindex='-1') + .modal-dialog.animated.zoomIn.fast-animation + .modal-content + .modal-header.challenge-list-header Need some help? + a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') × + .modal-body.text-center + h3 Remember to use   + a('/field-guide/how-do-i-get-help-when-i-get-stuck') RSAP + | . + h3 If you've already read the errors and searched Google, you should ask for help. + h3 This will open a help request in our Help chat room. + a.btn.btn-lg.btn-primary.btn-block#i-want-help(name='_csrf', value=_csrf) Ask for help + a.btn.btn-lg.btn-info.btn-block(href='#', data-dismiss='modal', aria-hidden='true') Cancel + +#help-editorless-modal.modal(tabindex='-1') + .modal-dialog.animated.zoomIn.fast-animation + .modal-content + .modal-header.challenge-list-header Need some help? + a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') × + .modal-body.text-center + h3 Remember to use   + a('/field-guide/how-do-i-get-help-when-i-get-stuck') RSAP + | . + h3 If you've already read the errors and searched Google, you should ask for help. + h3 This will open a help request in our Help chat room. + a.btn.btn-lg.btn-primary.btn-block#i-want-help-editorless(name='_csrf', value=_csrf) Ask for help + a.btn.btn-lg.btn-info.btn-block(href='#', data-dismiss='modal', aria-hidden='true') Cancel