add the bug, pair and help buttons to challenge views

This commit is contained in:
Quincy Larson
2015-05-24 00:53:01 -07:00
parent 1949005632
commit bf0cf4cc7d
7 changed files with 82 additions and 16 deletions

View File

@ -594,13 +594,13 @@ module.exports = {
var challenge = req.body.payload.challenge; var challenge = req.body.payload.challenge;
slack.send({ slack.send({
text: "*" + userName + "* wants help with " + challenge + " " + text: "*" + userName + "* wants help with " + challenge + ". " +
code + "Hey, *" + userName + "*, if no one helps you right " + code + "Hey, *" + userName + "*, if no one helps you right " +
"away, try typing out your problem in detail to me. Like this: " + "away, try typing out your problem in detail to me. Like this: " +
"http://en.wikipedia.org/wiki/Rubber_duck_debugging", "http://en.wikipedia.org/wiki/Rubber_duck_debugging",
channel: '#help', channel: '#help',
username: "Debuggy the Rubber Duck", username: "Debuggy the Rubber Duck",
icon_emoji: ":hatched_chick:" icon_url: "https://pbs.twimg.com/profile_images/3609875545/569237541c920fa78d78902069615caf.jpeg"
}); });
return res.sendStatus(200); return res.sendStatus(200);
}, },
@ -608,15 +608,18 @@ module.exports = {
getPair: function(req, res, next) { getPair: function(req, res, next) {
var userName = req.user.profile.username; var userName = req.user.profile.username;
var challenge = req.body.payload.challenge; var challenge = req.body.payload.challenge;
console.log('test');
slack.send({ slack.send({
text: "Anyone want to pair with *" + userName + "* on " + challenge + "? (In the meantime, keep coding, *" + userName + "*)", 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 +
"*, be sure to launch Screen Hero, then keep coding." +
"Another camper may pair with you soon.",
channel: '#letspair', channel: '#letspair',
username: "Perry the Matchmaker", username: "Companion Cube",
icon_emoji: ":dancers:" icon_url: "https://lh3.googleusercontent.com/-f6xDPDV2rPE/AAAAAAAAAAI/AAAAAAAAAAA/mdlESXQu11Q/photo.jpg"
}); });
return res.sendStatus(200); return res.sendStatus(200);
} }
}; };

View File

@ -24,7 +24,7 @@ $(document).ready(function() {
{ {
payload: { payload: {
code: editorValue, code: editorValue,
challenge: currentLocation, challenge: currentLocation
} }
}, },
function(res) { function(res) {
@ -35,6 +35,27 @@ $(document).ready(function() {
); );
}); });
$('#i-want-help-editorless').on('click', function() {
var currentLocation = window.location.href;
$.post(
'/get-help',
{
payload: {
challenge: currentLocation
}
},
function(res) {
if (res) {
window.open('https://freecode.slack.com/messages/help/', '_blank')
}
}
);
});
$('#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')
});
$('#i-want-to-pair').on('click', function() { $('#i-want-to-pair').on('click', function() {
var currentLocation = window.location.href; var currentLocation = window.location.href;
$.post( $.post(

View File

@ -84,11 +84,17 @@ block content
#submitButton.btn.btn-primary.btn-big.btn-block Run code (ctrl + enter) #submitButton.btn.btn-primary.btn-big.btn-block Run code (ctrl + enter)
.button-spacer .button-spacer
a.btn.btn-warning.btn-big.btn-block#i-want-help Help .btn-group.input-group.btn-group-justified
label.btn.btn-success#i-want-help
i.fa.fa-medkit
|   Help
label.btn.btn-success#i-want-to-pair
i.fa.fa-user-plus
|   Pair
label.btn.btn-success#report-issue
i.fa.fa-bug
|   Bug
.button-spacer .button-spacer
a.btn.btn-success.btn-big.btn-block#i-want-to-pair Pair
.button-spacer
a.btn.btn-success.btn-big.btn-block#i-found-a-bug Report Bug
br br
form.code form.code
.form-group.codeMirrorView .form-group.codeMirrorView

View File

@ -44,9 +44,14 @@ block content
br br
| (ctrl + enter) | (ctrl + enter)
.button-spacer .button-spacer
a.btn.btn-warning.btn-big.btn-block#i-want-help Get help .btn-group.input-group.btn-group-justified
label.btn.btn-success#i-want-help
i.fa.fa-medkit
|   Help
label.btn.btn-success#report-issue
i.fa.fa-bug
|   Bug
.button-spacer .button-spacer
a.btn.btn-success.btn-big.btn-block#i-want-to-pair Find a Pair
script. script.
var userLoggedIn = true; var userLoggedIn = true;
- else - else

View File

@ -35,6 +35,17 @@ block content
span.ion-arrow-up-b span.ion-arrow-up-b
| Less information | Less information
#submitButton.btn.btn-primary.btn-big.btn-block Run code (ctrl + enter) #submitButton.btn.btn-primary.btn-big.btn-block Run code (ctrl + enter)
.button-spacer
.btn-group.input-group.btn-group-justified
label.btn.btn-success#i-want-help
i.fa.fa-medkit
|   Help
label.btn.btn-success#i-want-to-pair
i.fa.fa-user-plus
|   Pair
label.btn.btn-success#report-issue
i.fa.fa-bug
|   Bug
br br
form.code form.code
.form-group.codeMirrorView .form-group.codeMirrorView

View File

@ -27,6 +27,14 @@ block content
var userLoggedIn = false; var userLoggedIn = false;
br br
.button-spacer .button-spacer
.btn-group.input-group.btn-group-justified
.btn.btn-success#i-want-help-editorless
i.fa.fa-medkit
|   Get help from our community
.btn.btn-success#report-issue
i.fa.fa-bug
|   Report a bug or typo in this challenge
.button-spacer
script(type="text/javascript"). script(type="text/javascript").
var controlEnterHandler = function(e) { var controlEnterHandler = function(e) {

View File

@ -24,6 +24,18 @@ block content
br br
- if (user) - if (user)
a.btn.btn-primary.btn-lg.btn-block#completed-zipline-or-basejump I've completed this challenge (ctrl + enter) a.btn.btn-primary.btn-lg.btn-block#completed-zipline-or-basejump I've completed this challenge (ctrl + enter)
.button-spacer
.btn-group.input-group.btn-group-justified
label.btn.btn-success#i-want-help-editorless
i.fa.fa-medkit
|   Help
label.btn.btn-success#i-want-to-pair
i.fa.fa-user-plus
|   Pair
label.btn.btn-success#report-issue
i.fa.fa-bug
|   Bug
.button-spacer
script. script.
var userLoggedIn = true; var userLoggedIn = true;
- else - else