diff --git a/client/main.js b/client/main.js
index 20bf9c250d..afa50443c1 100644
--- a/client/main.js
+++ b/client/main.js
@@ -80,12 +80,48 @@ $(document).ready(function() {
$('#report-issue').unbind('click');
$('#report-issue').on('click', function() {
- var textMessage = 'https://github.com/freecodecamp/freecodecamp/issues/new?&body=Challenge ' + window.location.href + ' has an issue.';
- textMessage += ' User Agent is: ' + navigator.userAgent + '
.';
- textMessage += ' Please describe how to reproduce this issue, and include links to screenshots if possible.%0A%0A';
- textMessage = textMessage.replace(/;/g, ',');
+ var textMessage = [
+ 'Challenge [',
+ (challenge_Name || challengeName || window.location.href),
+ '](',
+ window.location.href,
+ ') has an issue.\n',
+ 'User Agent is: ',
+ navigator.userAgent,
+ '
.\n',
+ 'Please describe how to reproduce this issue, and include ',
+ 'links to screenshots if possible.\n\n'
+ ].join('');
+
+ if ($('#include-code').prop('checked')) {
+ var type;
+ switch (challengeType) {
+ case challengeTypes.HTML_CSS_JQ:
+ type = 'html';
+ break;
+ case challengeTypes.JAVASCRIPT:
+ type = 'javascript';
+ break;
+ default:
+ type = '';
+ }
+
+ textMessage += [
+ 'Camper\'s code:\n```',
+ type,
+ '\n',
+ editor.getValue(),
+ '\n```'
+ ].join('');
+ }
+
+ textMessage = encodeURIComponent(textMessage);
+
$('#issue-modal').modal('hide');
- window.open(textMessage, '_blank');
+ window.open(
+ 'https://github.com/freecodecamp/freecodecamp/issues/new?&body=' +
+ textMessage, '_blank'
+ );
});
$('#completed-courseware').unbind('click');
diff --git a/server/views/partials/challenge-modals.jade b/server/views/partials/challenge-modals.jade
index 4503e2ac17..2b31d2e6f4 100644
--- a/server/views/partials/challenge-modals.jade
+++ b/server/views/partials/challenge-modals.jade
@@ -21,7 +21,10 @@
h3 Before you submit a new issue, read "Help I've Found a Bug" and browse other issues with this challenge.
a.btn.btn-lg.btn-success.btn-block#help-ive-found-a-bug-wiki-article(name='_csrf', value=_csrf) Read "Help I've Found a Bug"
a.btn.btn-lg.btn-success.btn-block#search-issue(name='_csrf', value=_csrf) Browse other issues with this challenge
- a.btn.btn-lg.btn-primary.btn-block#report-issue(name='_csrf', value=_csrf) Create my GitHub issue
+ .btn-group.btn-block
+ a.btn.btn-lg.btn-primary.col-sm-11.col-xs-10.p-l-lg#report-issue(name='_csrf', value=_csrf) Create my GitHub issue
+ .btn.btn-lg.btn-primary.col-sm-1.col-xs-2
+ input(type="checkbox" title="Include code" checked)#include-code
a.btn.btn-lg.btn-info.btn-block(href='#', data-dismiss='modal', aria-hidden='true') Cancel
#help-modal.modal(tabindex='-1')