improve get help and add find a pair

This commit is contained in:
Quincy Larson
2015-05-23 00:53:41 -07:00
parent f90b96e28c
commit a3ab32f339
5 changed files with 47 additions and 10 deletions

1
app.js
View File

@ -228,6 +228,7 @@ app.get('/nonprofit-project-instructions', function(req, res) {
app.post('/get-help', resourcesController.getHelp);
app.post('/get-pair', resourcesController.getPair);
app.get('/chat', resourcesController.chat);

View File

@ -592,10 +592,28 @@ module.exports = {
var challenge = req.body.payload.challenge;
slack.send({
text: "User " + userName + " needs help with challenge " +
"" + challenge + "!\n```\n" + code + "\n```",
text: "*" + userName + "* wants help with " + challenge + "\n```\n"
+ code + "\n```\n 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',
username: userName
username: "Debuggy the Rubber Duck",
icon_emoji: ":hatched_chick:"
});
return res.sendStatus(200);
},
getPair: function(req, res, next) {
var userName = req.user.profile.username;
var challenge = req.body.payload.challenge;
console.log('test');
slack.send({
text: "Anyone want to pair with *" + userName + "* on " + challenge + "? (In the meantime, keep coding, *" + userName + "*)",
channel: '#letspair',
username: "Perry the Matchmaker",
icon_emoji: ":dancers:"
});
return res.sendStatus(200);

View File

@ -64,6 +64,7 @@
"mongoose": "~4.0.1",
"mongoose-long": "0.0.2",
"morgan": "~1.5.0",
"node-slack": "0.0.7",
"nodemailer": "~1.3.0",
"passport": "~0.2.1",
"passport-facebook": "~1.0.3",

View File

@ -16,26 +16,40 @@ $(document).ready(function() {
setCSRFToken($('meta[name="csrf-token"]').attr('content'));
$('#i-need-help').on('click', function() {
$('#i-want-help').on('click', function() {
var editorValue = editor.getValue();
var currentLocation = window.location.href
console.log('clicked!');
var currentLocation = window.location.href;
$.post(
'/get-help',
{
payload: {
code: editorValue,
challenge: currentLocation,
}
},
function(res) {
if (res) {
window.open('https://freecode.slack.com/messages/help/', '_blank')
}
}
);
});
$('#i-want-to-pair').on('click', function() {
var currentLocation = window.location.href;
$.post(
'/get-pair',
{
payload: {
challenge: currentLocation
}
},
function(res) {
console.log(res);
if (res) {
window.location.href = 'https://freecode.slack.com/messages/help/'
window.open('https://freecode.slack.com/messages/letspair/', '_blank')
}
}
);
});
$('.checklist-element').each(function() {

View File

@ -19,7 +19,6 @@ block content
script(src='/js/lib/codemirror/mode/css/css.js')
script(src='/js/lib/codemirror/mode/htmlmixed/htmlmixed.js')
.row.courseware-height
.btn.btn-warning#i-need-help I need help!
.col-xs-12.col-sm-12.col-md-3.col-lg-3
.well
.row
@ -44,6 +43,10 @@ block content
| Go to my next challenge
br
| (ctrl + enter)
.button-spacer
a.btn.btn-warning.btn-big.btn-block#i-want-help Get help
.button-spacer
a.btn.btn-success.btn-big.btn-block#i-want-to-pair Find a Pair
script.
var userLoggedIn = true;
- else