Commit 38620f47 by solashirai

fixed naming, added documentation

parent f425d8b9
<script type='x-tmpl/mustache' id='show_hint_rating_ux'>
<div class='csh_hint_value' value="{{hintText}}">
<div class='csh_hint_value' value="{{hintIdentifier}}">
<div class='csh_hint_data'>
<div class="csh_hint">You received the following hint: <b>{{visual_hintText}}</b></div>
<div class="csh_hint">You received the following hint: <b>{{hintText}}</b></div>
</div>
<div class='csh_rating_data'>
<div role="button" class="csh_rate_hint" data-rate="upvote">
......@@ -18,8 +18,8 @@
</script>
<script type="x-tmpl/mustache" id="show_reported_moderation">
<div class="csh_hint_value" value ="{{reportedHintText}}">
<div class="csh_hint">{{visual_reportedHintText}}</div>
<div class="csh_hint_value" value ="{{reportedHintIdentifier}}">
<div class="csh_hint">{{reportedHintText}}</div>
<div role="button" class="csh_staff_rate" data-rate="unreport" aria-label="unreport">
<u><b>Return hint for use in the hinter</b></u>
</div>
......@@ -46,11 +46,11 @@
<script type="x-tmpl/mustache" id="show_student_submission">
<div class="csh_student_answer">
<h class="csh_answer_text" answer={{answer}}>
<h class="csh_answer_text" answer={{answerIdentifier}}>
<div role="button" class="csh_reveal_info">Help us improve hints for this problem </div>
<div class="csh_user_info" style="display: none;"> <br> Submitting an incorrect answer for this problem provides you with a hint specific to the mistake that you made - these hints are made by other students who made the same mistake as you did. Help to make the hints for this problem better by rating the hint that you received, or if you might have better advice to give other students, submit a new hint! <br> If you choose to submit a new hint, keep in mind that the hints are specific to one incorrect answer; specific advice (perhaps on some aspect of the problem that you overlooked) is more helpful than generic advice.</div>
<br>
Your original answer was: <b>{{visual_answer}}</b></h>
Your original answer was: <b>{{answerText}}</b></h>
</div>
</script>
......
......@@ -119,7 +119,7 @@ function CrowdsourceHinter(runtime, element, data){
* @param student_answer is the first incorrect answer submitted by the student
*/
function showStudentHintRatingUX(hint, student_answer){
var hintRatingUXTemplate = $(Mustache.render($('#show_hint_rating_ux').html(), {hintText: encodeURI(hint), visual_hintText: hint}));
var hintRatingUXTemplate = $(Mustache.render($('#show_hint_rating_ux').html(), {hintIdentifer: encodeURI(hint), hintText: hint}));
$('.csh_answer_text', element).append(hintRatingUXTemplate);
var hintCreationTemplate = $(Mustache.render($('#add_hint_creation').html(), {}));
$('.csh_answer_text', element).append(hintCreationTemplate);
......@@ -134,7 +134,7 @@ function CrowdsourceHinter(runtime, element, data){
* @param reportedHint is the reported hint text
*/
function showReportedModeration(reportedHint){
var reportedModerationTemplate = $(Mustache.render($('#show_reported_moderation').html(), {reportedHintText: encodeURI(reportedHint), visual_reportedHintText: reportedHint}));
var reportedModerationTemplate = $(Mustache.render($('#show_reported_moderation').html(), {reportedHintIdentifer: encodeURI(reportedHint), reportedHintText: reportedHint}));
$('.csh_reported_hints', element).append(reportedModerationTemplate);
}
......@@ -145,7 +145,7 @@ function CrowdsourceHinter(runtime, element, data){
* @param student_answers is the text of the student's incorrect answer
*/
function showStudentSubmissionHistory(student_answer){
var showStudentSubmissionTemplate = $(Mustache.render($('#show_student_submission').html(), {answer: encodeURI(student_answer),visual_answer: student_answer}));
var showStudentSubmissionTemplate = $(Mustache.render($('#show_student_submission').html(), {answerIdentifier: encodeURI(student_answer), answerText: student_answer}));
$('.csh_student_submission', element).append(showStudentSubmissionTemplate);
}
......@@ -213,6 +213,9 @@ function CrowdsourceHinter(runtime, element, data){
function submitNewHint(){ return function(submitHintButtonHTML){
//add the newly created hint to the hinter's pool of hints
if($('.csh_student_text_input', element).val().length > 0){
//encodeURI is used on the answer string when it is passed to mustache due to errors that
//arise in answers that contain spaces. Since the original answer is not in the encoded form,
//we must use the decoded form here.
var studentAnswer = decodeURI(submitHintButtonHTML.currentTarget.attributes['answer'].value);
var newHint = unescape($('.csh_student_text_input').val());
$('.csh_submitbutton', element).show();
......@@ -242,6 +245,9 @@ function CrowdsourceHinter(runtime, element, data){
$('.csh_hint_text', element).attr('rating', rating);
$('.csh_hint', element).attr('rating', rating);
hint = $('.csh_hint_text', element).attr('hint_received');
//encodeURI is used on the answer string when it is passed to mustache due to errors that
//arise in answers that contain spaces. Since the original answer is not in the encoded form,
//we must use the decoded form here.
student_answer = decodeURI($('.csh_hint_text', element).attr('student_answer'));
$.ajax({
type: "POST",
......@@ -257,6 +263,9 @@ function CrowdsourceHinter(runtime, element, data){
function reportHint(){ return function(reportHintButtonHTML){
hint = $('.csh_hint_text', element).attr('hint_received');
//encodeURI is used on the answer string when it is passed to mustache due to errors that
//arise in answers that contain spaces. Since the original answer is not in the encoded form,
//we must use the decoded form here.
student_answer = decodeURI($('.csh_hint_text', element).attr('student_answer'));
$('.csh_hint_text', element).text('This hint has been reported for review.');
$('.csh_hint', element).text('This hint has been reported for review.');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment