Commit 432f6cdf by Christina Roberts Committed by GitHub

Merge pull request #13680 from edx/christina/revert-capa-form

Revert "single form element per capa problem"
parents b27f8a29 53a6edd0
<%! from openedx.core.djangolib.markup import HTML %>
<div class="annotation-input">
<form class="annotation-input">
<div class="script_placeholder" data-src="${STATIC_URL}js/capa/annotationinput.js"/>
<div class="annotation-header">
......@@ -57,7 +57,7 @@
<p id="answer_${id}" class="answer answer-annotation"></p>
</div>
</div>
</form>
% if msg:
<span class="message">${HTML(msg)}</span>
......
......@@ -6,8 +6,7 @@
not isinstance(value, basestring) and choice_id in value
))
%>
<div class="choicegroup capa_inputtype" id="inputtype_${id}">
<form class="choicegroup capa_inputtype" id="inputtype_${id}">
<fieldset ${HTML(describedby_html)}>
% if response_data['label']:
<legend id="${id}-legend" class="response-fieldset-legend field-group-hd">${response_data['label']}</legend>
......@@ -72,4 +71,4 @@
% if msg:
<span class="message">${HTML(msg)}</span>
% endif
</div>
</form>
......@@ -8,7 +8,7 @@
%endif
% endfor
<section id="choicetextinput_${id}" class="choicetextinput">
<div class="choicetextgroup capa_inputtype" id="inputtype_${id}">
<form class="choicetextgroup capa_inputtype" id="inputtype_${id}">
<div class="script_placeholder" data-src="${STATIC_URL}js/capa/choicetextinput.js"/>
<fieldset aria-label="${remove_markup(response_data['label'])}">
......@@ -73,5 +73,5 @@
% if msg:
<span class="message">${msg|n}</span>
% endif
</div>
</form>
</section>
<div class="javascriptinput capa_inputtype" id="inputtype_${id}">
<form class="javascriptinput capa_inputtype" id="inputtype_${id}">
<input type="hidden" name="input_${id}" id="input_${id}" class="javascriptinput_input"/>
<div class="javascriptinput_data" data-display_class="${display_class}"
data-problem_state="${problem_state}" data-params="${params}"
<div class="javascriptinput_data" data-display_class="${display_class}"
data-problem_state="${problem_state}" data-params="${params}"
data-submission="${value|h}" data-evaluation="${msg|h}">
</div>
<div class="script_placeholder" data-src="/static/js/${display_file}"></div>
<div class="javascriptinput_container"></div>
</div>
</form>
......@@ -2,7 +2,7 @@
<%! from openedx.core.djangolib.markup import HTML %>
<% doinline = "inline" if inline else "" %>
<div class="inputtype option-input ${doinline}">
<form class="inputtype option-input ${doinline}">
% if response_data['label']:
<label class="problem-group-label" for="input_${id}">${response_data['label']}</label>
% endif
......@@ -31,4 +31,4 @@
% if msg:
<span class="message">${HTML(msg)}</span>
% endif
</div>
</form>
......@@ -1288,16 +1288,17 @@ class CapaMixin(CapaFields):
if is_correct is None:
is_correct = ''
response_data = getattr(answer_input, 'response_data', {})
input_metadata[input_id] = {
'question': response_data.get('label', ''),
'question': answer_input.response_data.get('label', ''),
'answer': user_visible_answer,
'response_type': getattr(getattr(answer_response, 'xml', None), 'tag', ''),
'input_type': getattr(answer_input, 'tag', ''),
'correct': is_correct,
'variant': variant,
'group_label': response_data.get('group_label', ''),
}
# Add group_label in event data only if the responsetype contains multiple inputtypes
if answer_input.response_data.get('group_label'):
input_metadata[input_id]['group_label'] = answer_input.response_data.get('group_label')
return input_metadata
......
......@@ -2600,7 +2600,6 @@ class TestProblemCheckTracking(unittest.TestCase):
'response_type': 'optionresponse',
'input_type': 'optioninput',
'correct': True,
'group_label': '',
'variant': '',
},
factory.answer_key(3): {
......@@ -2609,7 +2608,6 @@ class TestProblemCheckTracking(unittest.TestCase):
'response_type': 'multiplechoiceresponse',
'input_type': 'choicegroup',
'correct': False,
'group_label': '',
'variant': '',
},
factory.answer_key(4): {
......@@ -2618,7 +2616,6 @@ class TestProblemCheckTracking(unittest.TestCase):
'response_type': 'choiceresponse',
'input_type': 'checkboxgroup',
'correct': False,
'group_label': '',
'variant': '',
},
})
......@@ -2659,7 +2656,6 @@ class TestProblemCheckTracking(unittest.TestCase):
'response_type': 'numericalresponse',
'input_type': 'textline',
'correct': True,
'group_label': '',
'variant': '',
}
})
......@@ -2791,7 +2787,6 @@ class TestProblemCheckTracking(unittest.TestCase):
'response_type': 'numericalresponse',
'input_type': 'textline',
'correct': True,
'group_label': '',
'variant': module.seed,
}
})
......@@ -2824,13 +2819,11 @@ class TestProblemCheckTracking(unittest.TestCase):
'response_type': 'coderesponse',
'input_type': 'filesubmission',
'correct': False,
'group_label': '',
'variant': '',
},
factory.answer_key(3): {
'answer': 'None',
'correct': True,
'group_label': '',
'question': '',
'response_type': 'customresponse',
'input_type': 'textline',
......
......@@ -216,7 +216,7 @@ def answer_problem(course, problem_type, correctness):
world.css_fill(inputfield(course, 'string'), textvalue)
elif problem_type == 'numerical':
textvalue = "pi+1" if correctness == 'correct' else str(random.randint(-2, 2))
textvalue = "pi + 1" if correctness == 'correct' else str(random.randint(-2, 2))
world.css_fill(inputfield(course, 'numerical'), textvalue)
elif problem_type == 'formula':
......
......@@ -12,8 +12,6 @@ from openedx.core.djangolib.markup import HTML
<div class="problem-progress"></div>
<div class="problem">
## onsubmit is required because click on any button inside form will submit it and reload page which we don't want
<form class='capa-problem-form' onsubmit='return false;'>
${ HTML(problem['html']) }
<div class="action">
<input type="hidden" name="problem_id" value="${ problem['name'] }" />
......@@ -41,5 +39,4 @@ from openedx.core.djangolib.markup import HTML
</div>
% endif
</div>
</form>
</div>
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