Merge pull request #15737 from prateekgoel/feature/ask-for-help-button
Ask for help button feature
This commit is contained in:
34
client/commonFramework/ask-for-help.js
Normal file
34
client/commonFramework/ask-for-help.js
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
window.common = (function({ common = { init: [] } }) {
|
||||||
|
common.init.push(function($) {
|
||||||
|
$('#ask-for-help-button').on('click', function() {
|
||||||
|
var helpTitle = common.challengeName;
|
||||||
|
var helpMessage = [
|
||||||
|
'**Tell us what\'s happening:**\n\n\n\n',
|
||||||
|
'**Your code so far**\n',
|
||||||
|
'```' + common.editor.getValue() + '```\n',
|
||||||
|
'**Your browser information:**\n\n',
|
||||||
|
'Your Browser User Agent is: ```',
|
||||||
|
navigator.userAgent,
|
||||||
|
'```.\n\n',
|
||||||
|
'**Link to the challenge:**\n',
|
||||||
|
window.location.href + '\n'
|
||||||
|
|
||||||
|
].join('');
|
||||||
|
|
||||||
|
helpTitle = encodeURIComponent(helpTitle);
|
||||||
|
helpMessage = encodeURIComponent(helpMessage);
|
||||||
|
|
||||||
|
$('#ask-for-help-modal').modal('hide');
|
||||||
|
window.open(
|
||||||
|
'https://forum.freecodecamp.org/new-topic?title='
|
||||||
|
+ helpTitle
|
||||||
|
+ '&body='
|
||||||
|
+ helpMessage
|
||||||
|
+ '&category=help',
|
||||||
|
'_blank'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return common;
|
||||||
|
}(window));
|
@ -169,6 +169,10 @@ window.common = (function(global) {
|
|||||||
$('#help-modal').modal('show');
|
$('#help-modal').modal('show');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#trigger-ask-for-help-modal').on('click', function() {
|
||||||
|
$('#ask-for-help-modal').modal('show');
|
||||||
|
});
|
||||||
|
|
||||||
$('#trigger-reset-modal').on('click', function() {
|
$('#trigger-reset-modal').on('click', function() {
|
||||||
$('#reset-modal').modal('show');
|
$('#reset-modal').modal('show');
|
||||||
});
|
});
|
||||||
|
@ -130,6 +130,7 @@ var paths = {
|
|||||||
'output-display',
|
'output-display',
|
||||||
'phone-scroll-lock',
|
'phone-scroll-lock',
|
||||||
'report-issue',
|
'report-issue',
|
||||||
|
'ask-for-help',
|
||||||
'run-tests-stream',
|
'run-tests-stream',
|
||||||
'show-completion',
|
'show-completion',
|
||||||
'step-challenge',
|
'step-challenge',
|
||||||
|
@ -36,6 +36,8 @@ block content
|
|||||||
button.btn-big.btn.btn-primary.btn-block#trigger-reset-modal Reset your code
|
button.btn-big.btn.btn-primary.btn-block#trigger-reset-modal Reset your code
|
||||||
.button-spacer
|
.button-spacer
|
||||||
a.btn-big.btn.btn-primary.btn-block(href="https://forum.freecodecamp.org/t/freecodecamp-algorithm-challenge-guide-" + dashedName target="_blank") Get a hint
|
a.btn-big.btn.btn-primary.btn-block(href="https://forum.freecodecamp.org/t/freecodecamp-algorithm-challenge-guide-" + dashedName target="_blank") Get a hint
|
||||||
|
.button-spacer
|
||||||
|
button.btn-big.btn.btn-primary.btn-block#trigger-ask-for-help-modal Ask for help on the forum
|
||||||
if (!user)
|
if (!user)
|
||||||
.button-spacer
|
.button-spacer
|
||||||
a.btn.signup-btn.btn-block.btn-block(href='/login') Sign in so you can save your progress
|
a.btn.signup-btn.btn-block.btn-block(href='/login') Sign in so you can save your progress
|
||||||
|
@ -30,6 +30,8 @@ block content
|
|||||||
button.btn-big.btn.btn-primary.btn-block#trigger-reset-modal Reset your code
|
button.btn-big.btn.btn-primary.btn-block#trigger-reset-modal Reset your code
|
||||||
.button-spacer
|
.button-spacer
|
||||||
a.btn-big.btn.btn-primary.btn-block(href="https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-" + dashedName target="_blank") Get a hint
|
a.btn-big.btn.btn-primary.btn-block(href="https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-" + dashedName target="_blank") Get a hint
|
||||||
|
.button-spacer
|
||||||
|
button.btn-big.btn.btn-primary.btn-block#trigger-ask-for-help-modal Ask for help on the forum
|
||||||
script.
|
script.
|
||||||
var userLoggedIn = true;
|
var userLoggedIn = true;
|
||||||
if (!user)
|
if (!user)
|
||||||
|
@ -41,6 +41,8 @@ block content
|
|||||||
button.btn-big.btn.btn-primary.btn-block#trigger-reset-modal Reset your code
|
button.btn-big.btn.btn-primary.btn-block#trigger-reset-modal Reset your code
|
||||||
.button-spacer
|
.button-spacer
|
||||||
a.btn-big.btn.btn-primary.btn-block(href="https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-" + dashedName target="_blank") Get a hint
|
a.btn-big.btn.btn-primary.btn-block(href="https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-" + dashedName target="_blank") Get a hint
|
||||||
|
.button-spacer
|
||||||
|
button.btn-big.btn.btn-primary.btn-block#trigger-ask-for-help-modal Ask for help on the forum
|
||||||
if (!user)
|
if (!user)
|
||||||
.button-spacer
|
.button-spacer
|
||||||
a.btn.signup-btn.btn-block.btn-block(href='/signin') Sign in so you can save your progress
|
a.btn.signup-btn.btn-block.btn-block(href='/signin') Sign in so you can save your progress
|
||||||
|
@ -19,3 +19,16 @@
|
|||||||
h3 This will restore your code editor to its original state.
|
h3 This will restore your code editor to its original state.
|
||||||
a.btn.btn-lg.btn-warning.btn-block#reset-button(href='#', data-dismiss='modal', aria-hidden='true') Clear my code
|
a.btn.btn-lg.btn-warning.btn-block#reset-button(href='#', data-dismiss='modal', aria-hidden='true') Clear my code
|
||||||
a.btn.btn-lg.btn-primary.btn-block(href='#', data-dismiss='modal', aria-hidden='true') Cancel
|
a.btn.btn-lg.btn-primary.btn-block(href='#', data-dismiss='modal', aria-hidden='true') Cancel
|
||||||
|
|
||||||
|
#ask-for-help-modal.modal(tabindex='-1')
|
||||||
|
.modal-dialog.animated.fadeInUp.fast-animation
|
||||||
|
.modal-content
|
||||||
|
.modal-header.challenge-list-header Ask for help?
|
||||||
|
a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') ×
|
||||||
|
.modal-body
|
||||||
|
h3
|
||||||
|
| If you've already tried the
|
||||||
|
a(href='https://forum.freecodecamp.org/t/the-read-search-ask-methodology-for-getting-unstuck/137307', target='_blank') Read-Search-Ask
|
||||||
|
| method, then you can ask for help on the freeCodeCamp forum.
|
||||||
|
a.btn.btn-lg.btn-primary.btn-block#ask-for-help-button(name='_csrf', value=_csrf) Create a help post on the forum
|
||||||
|
a.btn.btn-lg.btn-primary.btn-block(href='#', data-dismiss='modal', aria-hidden='true') Cancel
|
||||||
|
Reference in New Issue
Block a user