Commit be3291ee by Vik Paruchuri

Proper scoping, show status to staff, fix line break issues, multiple self…

Proper scoping, show status to staff, fix line break issues, multiple self assessments on one page work
parent 7b9dde78
...@@ -23,7 +23,7 @@ class @Rubric ...@@ -23,7 +23,7 @@ class @Rubric
keypress_callback: (event) => keypress_callback: (event) =>
# don't try to do this when user is typing in a text input # don't try to do this when user is typing in a text input
if $(event.target).is('input, textarea') if @$(event.target).is('input, textarea')
return return
# for when we select via top row # for when we select via top row
if event.which >= 48 and event.which <= 57 if event.which >= 48 and event.which <= 57
...@@ -49,9 +49,9 @@ class @Rubric ...@@ -49,9 +49,9 @@ class @Rubric
@category = @$(@categories[@category_index]) @category = @$(@categories[@category_index])
tracking_callback: (event) => tracking_callback: (event) =>
target_selection = $(event.target).val() target_selection = @$(event.target).val()
# chop off the beginning of the name so that we can get the number of the category # chop off the beginning of the name so that we can get the number of the category
category = $(event.target).data("category") category = @$(event.target).data("category")
location = @$(@rubric_sel).data('location') location = @$(@rubric_sel).data('location')
# probably want the original problem location as well # probably want the original problem location as well
...@@ -187,9 +187,9 @@ class @CombinedOpenEnded ...@@ -187,9 +187,9 @@ class @CombinedOpenEnded
@skip_button = @$(@oe).find(@skip_button_sel) @skip_button = @$(@oe).find(@skip_button_sel)
@skip_button.click @skip_post_assessment @skip_button.click @skip_post_assessment
@file_upload_area = $(@oe).find(@file_upload_sel) @file_upload_area = @$(@oe).find(@file_upload_sel)
@can_upload_files = false @can_upload_files = false
@open_ended_child= $(@oe).find(@open_ended_child_sel) @open_ended_child= @$(@oe).find(@open_ended_child_sel)
@out_of_sync_message = 'The problem state got out of sync. Try reloading the page.' @out_of_sync_message = 'The problem state got out of sync. Try reloading the page.'
...@@ -257,7 +257,7 @@ class @CombinedOpenEnded ...@@ -257,7 +257,7 @@ class @CombinedOpenEnded
contentType: false contentType: false
success: (response) => success: (response) =>
@gentle_alert response.msg @gentle_alert response.msg
$('section.evaluation').slideToggle() @$('section.evaluation').slideToggle()
@message_wrapper.html(response.message_html) @message_wrapper.html(response.message_html)
...@@ -299,6 +299,7 @@ class @CombinedOpenEnded ...@@ -299,6 +299,7 @@ class @CombinedOpenEnded
@hide_file_upload() @hide_file_upload()
@submit_button.prop('value', 'Submit assessment') @submit_button.prop('value', 'Submit assessment')
@submit_button.click @save_assessment @submit_button.click @save_assessment
@submit_button.attr("disabled",false)
if @child_type == "openended" if @child_type == "openended"
@submit_button.hide() @submit_button.hide()
@queueing() @queueing()
...@@ -339,6 +340,7 @@ class @CombinedOpenEnded ...@@ -339,6 +340,7 @@ class @CombinedOpenEnded
@hint_area = @$('textarea.post_assessment') @hint_area = @$('textarea.post_assessment')
save_answer: (event) => save_answer: (event) =>
@submit_button.attr("disabled",true)
event.preventDefault() event.preventDefault()
@submit_button.hide() @submit_button.hide()
@answer_area.attr("disabled", true) @answer_area.attr("disabled", true)
...@@ -640,4 +642,5 @@ class @CombinedOpenEnded ...@@ -640,4 +642,5 @@ class @CombinedOpenEnded
graded_callback: () => graded_callback: () =>
if @rub.check_complete() if @rub.check_complete()
@submit_button.attr("disabled",false)
@submit_button.show() @submit_button.show()
...@@ -699,7 +699,7 @@ class OpenEndedModule(openendedchild.OpenEndedChild): ...@@ -699,7 +699,7 @@ class OpenEndedModule(openendedchild.OpenEndedChild):
post_assessment = "" post_assessment = ""
correct = "" correct = ""
previous_answer = "" previous_answer = ""
previous_answer = previous_answer.replace("\n","<br/>")
context = { context = {
'prompt': self.child_prompt, 'prompt': self.child_prompt,
'previous_answer': previous_answer, 'previous_answer': previous_answer,
......
...@@ -61,6 +61,7 @@ class SelfAssessmentModule(openendedchild.OpenEndedChild): ...@@ -61,6 +61,7 @@ class SelfAssessmentModule(openendedchild.OpenEndedChild):
else: else:
previous_answer = '' previous_answer = ''
previous_answer = previous_answer.replace("\n","<br/>")
context = { context = {
'prompt': self.child_prompt, 'prompt': self.child_prompt,
'previous_answer': previous_answer, 'previous_answer': previous_answer,
......
...@@ -146,6 +146,8 @@ The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for t ...@@ -146,6 +146,8 @@ The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for t
class @StaffGrading class @StaffGrading
grading_message_sel: '.grading-message'
constructor: (backend) -> constructor: (backend) ->
AjaxPrefix.addAjaxPrefix(jQuery, -> "") AjaxPrefix.addAjaxPrefix(jQuery, -> "")
@backend = backend @backend = backend
...@@ -278,6 +280,7 @@ class @StaffGrading ...@@ -278,6 +280,7 @@ class @StaffGrading
location: @location location: @location
skipped: true skipped: true
submission_flagged: false submission_flagged: false
@gentle_alert "Skipped the submission."
@backend.post('save_grade', data, @ajax_callback) @backend.post('save_grade', data, @ajax_callback)
get_problem_list: () -> get_problem_list: () ->
...@@ -292,9 +295,15 @@ class @StaffGrading ...@@ -292,9 +295,15 @@ class @StaffGrading
submission_id: @submission_id submission_id: @submission_id
location: @location location: @location
submission_flagged: @flag_submission_checkbox.is(':checked') submission_flagged: @flag_submission_checkbox.is(':checked')
@gentle_alert "Grades saved. Fetching the next submission to grade."
@backend.post('save_grade', data, @ajax_callback) @backend.post('save_grade', data, @ajax_callback)
gentle_alert: (msg) =>
@grading_message = $(@grading_message_sel)
@grading_message.html("")
@grading_message.fadeIn()
@grading_message.html("<p>" + msg + "</p>")
error: (msg) -> error: (msg) ->
@error_msg = msg @error_msg = msg
@state = state_error @state = state_error
......
<%! from django.utils.translation import ugettext as _ %> <%! from django.utils.translation import ugettext as _ %>
<% from random import randint %>
<form class="rubric-template" id="inputtype_${id}" xmlns="http://www.w3.org/1999/html"> <form class="rubric-template" id="inputtype_${id}" xmlns="http://www.w3.org/1999/html">
<div class="visibility-control visibility-control-rubric"> <div class="visibility-control visibility-control-rubric">
<div class="inner"> <div class="inner">
...@@ -9,6 +10,7 @@ ...@@ -9,6 +10,7 @@
<div class="rubric"> <div class="rubric">
% for i in range(len(categories)): % for i in range(len(categories)):
<% category = categories[i] %> <% category = categories[i] %>
<% m = randint(0,1000) %>
<span class="rubric-category">${category['description']}</span> <span class="rubric-category">${category['description']}</span>
<ul class="rubric-list"> <ul class="rubric-list">
% for j in range(len(category['options'])): % for j in range(len(category['options'])):
...@@ -18,8 +20,8 @@ ...@@ -18,8 +20,8 @@
%else: %else:
<li class="rubric-list-item"> <li class="rubric-list-item">
% endif % endif
<label class="rubric-label" for="score-${i}-${j}"> <label class="rubric-label" for="score-${i}-${j}-${m}">
<span class="wrapper-score-selection"><input type="radio" class="score-selection" data-category="${i}" name="score-selection-${i}" id="score-${i}-${j}" value="${option['points']}"/></span> <span class="wrapper-score-selection"><input type="radio" class="score-selection" data-category="${i}" name="score-selection-${i}" id="score-${i}-${j}-${m}" value="${option['points']}"/></span>
<span class="wrappable"> ${option['points']} points : ${option['text']}</span> <span class="wrappable"> ${option['points']} points : ${option['text']}</span>
</label> </label>
</li> </li>
......
...@@ -80,8 +80,8 @@ ...@@ -80,8 +80,8 @@
<input type="button" value="${_("Submit")}" class="submit-button" name="show"/> <input type="button" value="${_("Submit")}" class="submit-button" name="show"/>
<input type="button" value="${_("Skip")}" class="skip-button" name="skip"/> <input type="button" value="${_("Skip")}" class="skip-button" name="skip"/>
</div> </div>
<div class="grading-message"></div>
</div>
</div> </div>
</section> </section>
</div>
\ No newline at end of file
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