Merge branch 'staging' of github.com:FreeCodeCamp/freecodecamp into staging
This commit is contained in:
3
app.js
3
app.js
@ -226,6 +226,9 @@ app.get('/nonprofit-project-instructions', function(req, res) {
|
||||
res.redirect(301, '/field-guide/how-do-free-code-camp\'s-nonprofit-projects-work');
|
||||
});
|
||||
|
||||
app.post('/get-help', resourcesController.getHelp);
|
||||
|
||||
|
||||
app.get('/chat', resourcesController.chat);
|
||||
|
||||
app.get('/twitch', resourcesController.twitch);
|
||||
|
@ -58,5 +58,6 @@ module.exports = {
|
||||
callbackURL: '/auth/linkedin/callback',
|
||||
scope: ['r_basicprofile', 'r_emailaddress'],
|
||||
passReqToCallback: true
|
||||
}
|
||||
},
|
||||
slackHook: process.env.SLACK_WEBHOOK,
|
||||
};
|
||||
|
@ -9,6 +9,7 @@ var async = require('async'),
|
||||
_ = require('lodash'),
|
||||
fs = require('fs'),
|
||||
|
||||
|
||||
constantStrings = require('./constantStrings.json'),
|
||||
User = require('../models/User'),
|
||||
Challenge = require('./../models/Challenge'),
|
||||
@ -19,7 +20,9 @@ var async = require('async'),
|
||||
resources = require('./resources.json'),
|
||||
secrets = require('./../config/secrets'),
|
||||
nonprofits = require('../seed_data/nonprofits.json'),
|
||||
fieldGuides = require('../seed_data/field-guides.json');
|
||||
fieldGuides = require('../seed_data/field-guides.json'),
|
||||
Slack = require('node-slack'),
|
||||
slack = new Slack(secrets.slackHook);
|
||||
|
||||
/**
|
||||
* Cached values
|
||||
@ -581,5 +584,20 @@ module.exports = {
|
||||
slack: function() {
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
getHelp: function(req, res, next) {
|
||||
var userName = req.user.profile.username;
|
||||
var code = req.body.payload.code;
|
||||
var challenge = req.body.payload.challenge;
|
||||
|
||||
slack.send({
|
||||
text: "User " + userName + " needs help with challenge " +
|
||||
"" + challenge + "!\n```\n" + code + "\n```",
|
||||
channel: '#help',
|
||||
username: userName
|
||||
});
|
||||
return res.sendStatus(200);
|
||||
|
||||
}
|
||||
};
|
||||
|
@ -79,7 +79,8 @@ exports.signout = function(req, res) {
|
||||
* Signup page.
|
||||
*/
|
||||
|
||||
exports.getEmailSignin = function(req, res) {
|
||||
exports.getEmailSignin = function(req, res) //noinspection Eslint
|
||||
{
|
||||
if (req.user) {
|
||||
return res.redirect('/');
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@ -16,6 +16,28 @@ $(document).ready(function() {
|
||||
|
||||
setCSRFToken($('meta[name="csrf-token"]').attr('content'));
|
||||
|
||||
$('#i-need-help').on('click', function() {
|
||||
var editorValue = editor.getValue();
|
||||
var currentLocation = window.location.href
|
||||
console.log('clicked!');
|
||||
$.post(
|
||||
'/get-help',
|
||||
{
|
||||
payload: {
|
||||
code: editorValue,
|
||||
challenge: currentLocation
|
||||
}
|
||||
},
|
||||
function(res) {
|
||||
console.log(res);
|
||||
if (res) {
|
||||
window.location.href = 'https://freecode.slack.com/messages/help/'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
$('.checklist-element').each(function() {
|
||||
var checklistElementId = $(this).attr('id');
|
||||
if(!!localStorage[checklistElementId]) {
|
||||
@ -372,28 +394,28 @@ profileValidation.directive('uniqueUsername', ['$http', function($http) {
|
||||
|
||||
profileValidation.directive('existingUsername',
|
||||
['$http', function($http) {
|
||||
return {
|
||||
restrict: 'A',
|
||||
require: 'ngModel',
|
||||
link: function (scope, element, attrs, ngModel) {
|
||||
element.bind('keyup', function (event) {
|
||||
if (element.val().length > 0) {
|
||||
ngModel.$setValidity('exists', false);
|
||||
} else {
|
||||
element.removeClass('ng-dirty');
|
||||
ngModel.$setPristine();
|
||||
}
|
||||
if (element.val()) {
|
||||
$http
|
||||
.get('/api/checkExistingUsername/' + element.val())
|
||||
.success(function (data) {
|
||||
ngModel.$setValidity('exists', data);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}]);
|
||||
return {
|
||||
restrict: 'A',
|
||||
require: 'ngModel',
|
||||
link: function (scope, element, attrs, ngModel) {
|
||||
element.bind('keyup', function (event) {
|
||||
if (element.val().length > 0) {
|
||||
ngModel.$setValidity('exists', false);
|
||||
} else {
|
||||
element.removeClass('ng-dirty');
|
||||
ngModel.$setPristine();
|
||||
}
|
||||
if (element.val()) {
|
||||
$http
|
||||
.get('/api/checkExistingUsername/' + element.val())
|
||||
.success(function (data) {
|
||||
ngModel.$setValidity('exists', data);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}]);
|
||||
|
||||
profileValidation.directive('uniqueEmail', ['$http', function($http) {
|
||||
return {
|
||||
|
@ -10,8 +10,7 @@
|
||||
"Test"
|
||||
],
|
||||
"tests": [
|
||||
"assert($('#target').hasClass('disabled'), 'The button with the ID of \"target\" should continue to have the \"disabled\" class.')",
|
||||
"assert(!!$('#target[disabled]'), 'Enable the button with the ID of \"target\" by using jQuery.')",
|
||||
"assert(typeof $('#target').attr('disabled') === 'undefined', 'Change the disabled attribute of the \"target\" button to false');",
|
||||
"expect($('#target')).to.exist()"
|
||||
],
|
||||
"challengeSeed": [
|
||||
@ -21,7 +20,8 @@
|
||||
" });",
|
||||
"fcces",
|
||||
"<button id='target' class='btn btn-primary btn-block'>Enable this button with jQuery</button>"
|
||||
]
|
||||
],
|
||||
"challengeType": 0
|
||||
},
|
||||
|
||||
{
|
||||
@ -51,7 +51,8 @@
|
||||
],
|
||||
"challengeSeed": [
|
||||
|
||||
]
|
||||
],
|
||||
"challengeType": 0
|
||||
},
|
||||
|
||||
{
|
||||
@ -66,7 +67,8 @@
|
||||
],
|
||||
"challengeSeed": [
|
||||
|
||||
]
|
||||
],
|
||||
"challengeType": 0
|
||||
},
|
||||
|
||||
{
|
||||
@ -81,7 +83,8 @@
|
||||
],
|
||||
"challengeSeed": [
|
||||
|
||||
]
|
||||
],
|
||||
"challengeType": 0
|
||||
},
|
||||
|
||||
{
|
||||
@ -96,7 +99,8 @@
|
||||
],
|
||||
"challengeSeed": [
|
||||
|
||||
]
|
||||
],
|
||||
"challengeType": 0
|
||||
},
|
||||
|
||||
{
|
||||
@ -126,7 +130,8 @@
|
||||
],
|
||||
"challengeSeed": [
|
||||
|
||||
]
|
||||
],
|
||||
"challengeType": 0
|
||||
},
|
||||
|
||||
{
|
||||
@ -141,7 +146,8 @@
|
||||
],
|
||||
"challengeSeed": [
|
||||
|
||||
]
|
||||
],
|
||||
"challengeType": 0
|
||||
},
|
||||
|
||||
{
|
||||
@ -156,7 +162,8 @@
|
||||
],
|
||||
"challengeSeed": [
|
||||
|
||||
]
|
||||
],
|
||||
"challengeType": 0
|
||||
},
|
||||
|
||||
{
|
||||
@ -171,7 +178,8 @@
|
||||
],
|
||||
"challengeSeed": [
|
||||
|
||||
]
|
||||
],
|
||||
"challengeType": 0
|
||||
},
|
||||
|
||||
{
|
||||
@ -186,7 +194,8 @@
|
||||
],
|
||||
"challengeSeed": [
|
||||
|
||||
]
|
||||
],
|
||||
"challengeType": 0
|
||||
},
|
||||
|
||||
|
||||
@ -202,7 +211,8 @@
|
||||
],
|
||||
"challengeSeed": [
|
||||
|
||||
]
|
||||
],
|
||||
"challengeType": 0
|
||||
},
|
||||
|
||||
{
|
||||
@ -217,7 +227,8 @@
|
||||
],
|
||||
"challengeSeed": [
|
||||
|
||||
]
|
||||
],
|
||||
"challengeType": 0
|
||||
},
|
||||
|
||||
{
|
||||
@ -232,7 +243,8 @@
|
||||
],
|
||||
"challengeSeed": [
|
||||
|
||||
]
|
||||
],
|
||||
"challengeType": 0
|
||||
},
|
||||
|
||||
{
|
||||
@ -247,7 +259,8 @@
|
||||
],
|
||||
"challengeSeed": [
|
||||
|
||||
]
|
||||
],
|
||||
"challengeType": 0
|
||||
},
|
||||
|
||||
{
|
||||
@ -262,7 +275,8 @@
|
||||
],
|
||||
"challengeSeed": [
|
||||
|
||||
]
|
||||
],
|
||||
"challengeType": 0
|
||||
},
|
||||
|
||||
{
|
||||
@ -277,7 +291,8 @@
|
||||
],
|
||||
"challengeSeed": [
|
||||
|
||||
]
|
||||
],
|
||||
"challengeType": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ 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
|
||||
|
Reference in New Issue
Block a user