improve get help and add find a pair
This commit is contained in:
1
app.js
1
app.js
@ -228,6 +228,7 @@ app.get('/nonprofit-project-instructions', function(req, res) {
|
|||||||
|
|
||||||
app.post('/get-help', resourcesController.getHelp);
|
app.post('/get-help', resourcesController.getHelp);
|
||||||
|
|
||||||
|
app.post('/get-pair', resourcesController.getPair);
|
||||||
|
|
||||||
app.get('/chat', resourcesController.chat);
|
app.get('/chat', resourcesController.chat);
|
||||||
|
|
||||||
|
@ -592,10 +592,28 @@ module.exports = {
|
|||||||
var challenge = req.body.payload.challenge;
|
var challenge = req.body.payload.challenge;
|
||||||
|
|
||||||
slack.send({
|
slack.send({
|
||||||
text: "User " + userName + " needs help with challenge " +
|
text: "*" + userName + "* wants help with " + challenge + "\n```\n"
|
||||||
"" + challenge + "!\n```\n" + code + "\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',
|
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);
|
return res.sendStatus(200);
|
||||||
|
|
||||||
|
@ -64,6 +64,7 @@
|
|||||||
"mongoose": "~4.0.1",
|
"mongoose": "~4.0.1",
|
||||||
"mongoose-long": "0.0.2",
|
"mongoose-long": "0.0.2",
|
||||||
"morgan": "~1.5.0",
|
"morgan": "~1.5.0",
|
||||||
|
"node-slack": "0.0.7",
|
||||||
"nodemailer": "~1.3.0",
|
"nodemailer": "~1.3.0",
|
||||||
"passport": "~0.2.1",
|
"passport": "~0.2.1",
|
||||||
"passport-facebook": "~1.0.3",
|
"passport-facebook": "~1.0.3",
|
||||||
|
@ -16,26 +16,40 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
setCSRFToken($('meta[name="csrf-token"]').attr('content'));
|
setCSRFToken($('meta[name="csrf-token"]').attr('content'));
|
||||||
|
|
||||||
$('#i-need-help').on('click', function() {
|
$('#i-want-help').on('click', function() {
|
||||||
var editorValue = editor.getValue();
|
var editorValue = editor.getValue();
|
||||||
var currentLocation = window.location.href
|
var currentLocation = window.location.href;
|
||||||
console.log('clicked!');
|
|
||||||
$.post(
|
$.post(
|
||||||
'/get-help',
|
'/get-help',
|
||||||
{
|
{
|
||||||
payload: {
|
payload: {
|
||||||
code: editorValue,
|
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
|
challenge: currentLocation
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
function(res) {
|
function(res) {
|
||||||
console.log(res);
|
|
||||||
if (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() {
|
$('.checklist-element').each(function() {
|
||||||
|
@ -19,7 +19,6 @@ block content
|
|||||||
script(src='/js/lib/codemirror/mode/css/css.js')
|
script(src='/js/lib/codemirror/mode/css/css.js')
|
||||||
script(src='/js/lib/codemirror/mode/htmlmixed/htmlmixed.js')
|
script(src='/js/lib/codemirror/mode/htmlmixed/htmlmixed.js')
|
||||||
.row.courseware-height
|
.row.courseware-height
|
||||||
.btn.btn-warning#i-need-help I need help!
|
|
||||||
.col-xs-12.col-sm-12.col-md-3.col-lg-3
|
.col-xs-12.col-sm-12.col-md-3.col-lg-3
|
||||||
.well
|
.well
|
||||||
.row
|
.row
|
||||||
@ -44,6 +43,10 @@ block content
|
|||||||
| Go to my next challenge
|
| Go to my next challenge
|
||||||
br
|
br
|
||||||
| (ctrl + enter)
|
| (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.
|
script.
|
||||||
var userLoggedIn = true;
|
var userLoggedIn = true;
|
||||||
- else
|
- else
|
||||||
|
Reference in New Issue
Block a user