Proper scoping, show status to staff, fix line break issues, multiple self assessments on one page work

This commit is contained in:
Vik Paruchuri
2013-08-16 13:22:34 -04:00
parent 7b9dde78fe
commit be3291eeb0
6 changed files with 27 additions and 12 deletions

View File

@@ -23,7 +23,7 @@ class @Rubric
keypress_callback: (event) =>
# 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
# for when we select via top row
if event.which >= 48 and event.which <= 57
@@ -49,9 +49,9 @@ class @Rubric
@category = @$(@categories[@category_index])
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
category = $(event.target).data("category")
category = @$(event.target).data("category")
location = @$(@rubric_sel).data('location')
# probably want the original problem location as well
@@ -187,9 +187,9 @@ class @CombinedOpenEnded
@skip_button = @$(@oe).find(@skip_button_sel)
@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
@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.'
@@ -257,7 +257,7 @@ class @CombinedOpenEnded
contentType: false
success: (response) =>
@gentle_alert response.msg
$('section.evaluation').slideToggle()
@$('section.evaluation').slideToggle()
@message_wrapper.html(response.message_html)
@@ -299,6 +299,7 @@ class @CombinedOpenEnded
@hide_file_upload()
@submit_button.prop('value', 'Submit assessment')
@submit_button.click @save_assessment
@submit_button.attr("disabled",false)
if @child_type == "openended"
@submit_button.hide()
@queueing()
@@ -339,6 +340,7 @@ class @CombinedOpenEnded
@hint_area = @$('textarea.post_assessment')
save_answer: (event) =>
@submit_button.attr("disabled",true)
event.preventDefault()
@submit_button.hide()
@answer_area.attr("disabled", true)
@@ -640,4 +642,5 @@ class @CombinedOpenEnded
graded_callback: () =>
if @rub.check_complete()
@submit_button.attr("disabled",false)
@submit_button.show()

View File

@@ -699,7 +699,7 @@ class OpenEndedModule(openendedchild.OpenEndedChild):
post_assessment = ""
correct = ""
previous_answer = ""
previous_answer = previous_answer.replace("\n","<br/>")
context = {
'prompt': self.child_prompt,
'previous_answer': previous_answer,

View File

@@ -61,6 +61,7 @@ class SelfAssessmentModule(openendedchild.OpenEndedChild):
else:
previous_answer = ''
previous_answer = previous_answer.replace("\n","<br/>")
context = {
'prompt': self.child_prompt,
'previous_answer': previous_answer,

View File

@@ -146,6 +146,8 @@ The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for t
class @StaffGrading
grading_message_sel: '.grading-message'
constructor: (backend) ->
AjaxPrefix.addAjaxPrefix(jQuery, -> "")
@backend = backend
@@ -278,6 +280,7 @@ class @StaffGrading
location: @location
skipped: true
submission_flagged: false
@gentle_alert "Skipped the submission."
@backend.post('save_grade', data, @ajax_callback)
get_problem_list: () ->
@@ -292,9 +295,15 @@ class @StaffGrading
submission_id: @submission_id
location: @location
submission_flagged: @flag_submission_checkbox.is(':checked')
@gentle_alert "Grades saved. Fetching the next submission to grade."
@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 = msg
@state = state_error

View File

@@ -1,4 +1,5 @@
<%! 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">
<div class="visibility-control visibility-control-rubric">
<div class="inner">
@@ -9,6 +10,7 @@
<div class="rubric">
% for i in range(len(categories)):
<% category = categories[i] %>
<% m = randint(0,1000) %>
<span class="rubric-category">${category['description']}</span>
<ul class="rubric-list">
% for j in range(len(category['options'])):
@@ -18,8 +20,8 @@
%else:
<li class="rubric-list-item">
% endif
<label class="rubric-label" for="score-${i}-${j}">
<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>
<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}-${m}" value="${option['points']}"/></span>
<span class="wrappable"> ${option['points']} points : ${option['text']}</span>
</label>
</li>

View File

@@ -80,8 +80,8 @@
<input type="button" value="${_("Submit")}" class="submit-button" name="show"/>
<input type="button" value="${_("Skip")}" class="skip-button" name="skip"/>
</div>
</div>
<div class="grading-message"></div>
</div>
</section>
</div>