Various open ended accessibility fixes

This commit is contained in:
Vik Paruchuri
2013-10-10 11:59:43 -04:00
parent f37e12182e
commit 0accbaee07
8 changed files with 31 additions and 10 deletions

View File

@@ -533,7 +533,7 @@ class @CombinedOpenEnded
gentle_alert: (msg) =>
if @$el.find(@oe_alert_sel).length
@$el.find(@oe_alert_sel).remove()
alert_elem = "<div class='open-ended-alert'>" + msg + "</div>"
alert_elem = "<div class='open-ended-alert' role='alert'>" + msg + "</div>"
@$el.find('.open-ended-action').after(alert_elem)
@$el.find(@oe_alert_sel).css(opacity: 0).animate(opacity: 1, 700)

View File

@@ -819,10 +819,14 @@ class CombinedOpenEndedV1Module():
Output: The status html to be rendered
"""
status = []
current_task_human_name = ""
for i in xrange(0, len(self.task_xml)):
human_task_name = self.extract_human_name_from_task(self.task_xml[i])
task_data = {'task_number': i + 1, 'human_task' : human_task_name, 'current' : self.current_task_number==i}
# Extract the name of the current task for screen readers.
if self.current_task_number == i:
current_task_human_name = human_task_name
task_data = {'task_number': i + 1, 'human_task': human_task_name, 'current': self.current_task_number==i}
status.append(task_data)
context = {
@@ -830,6 +834,7 @@ class CombinedOpenEndedV1Module():
'grader_type_image_dict': GRADER_TYPE_IMAGE_DICT,
'legend_list': LEGEND_LIST,
'render_via_ajax': render_via_ajax,
'current_task_human_name': current_task_human_name,
}
status_html = self.system.render_template("{0}/combined_open_ended_status.html".format(self.TEMPLATE_DIR),
context)

View File

@@ -696,6 +696,13 @@ class OpenEndedModule(openendedchild.OpenEndedChild):
correct = ""
previous_answer = self.get_display_answer()
# Use the module name as a unique id to pass to the template.
try:
module_id = self.system.location.name
except AttributeError:
# In cases where we don't have a system or a location, use a fallback.
module_id = "open_ended"
context = {
'prompt': self.child_prompt,
'previous_answer': previous_answer,
@@ -703,7 +710,7 @@ class OpenEndedModule(openendedchild.OpenEndedChild):
'allow_reset': self._allow_reset(),
'rows': 30,
'cols': 80,
'id': 'open_ended',
'module_id': module_id,
'msg': post_assessment,
'child_type': 'openended',
'correct': correct,

View File

@@ -57,6 +57,13 @@ class SelfAssessmentModule(openendedchild.OpenEndedChild):
# set context variables and render template
previous_answer = self.get_display_answer()
# Use the module name as a unique id to pass to the template.
try:
module_id = self.system.location.name
except AttributeError:
# In cases where we don't have a system or a location, use a fallback.
module_id = "self_assessment"
context = {
'prompt': self.child_prompt,
'previous_answer': previous_answer,
@@ -66,6 +73,7 @@ class SelfAssessmentModule(openendedchild.OpenEndedChild):
'allow_reset': self._allow_reset(),
'child_type': 'selfassessment',
'accept_file_upload': self.accept_file_upload,
'module_id': module_id,
}
html = system.render_template('{0}/self_assessment_prompt.html'.format(self.TEMPLATE_DIR), context)