Commit ec0f8dac by Vik Paruchuri

clean up display code

parent 99b0795e
...@@ -38,8 +38,6 @@ class HtmlModule(XModule): ...@@ -38,8 +38,6 @@ class HtmlModule(XModule):
instance_state, shared_state, **kwargs) instance_state, shared_state, **kwargs)
self.html = self.definition['data'] self.html = self.definition['data']
class HtmlDescriptor(XmlDescriptor, EditingDescriptor): class HtmlDescriptor(XmlDescriptor, EditingDescriptor):
""" """
Module for putting raw html in a course Module for putting raw html in a course
......
...@@ -6,7 +6,7 @@ $(document).on('click', 'section.sa-wrapper input#show', ( -> ...@@ -6,7 +6,7 @@ $(document).on('click', 'section.sa-wrapper input#show', ( ->
if response.success if response.success
$('section.sa-wrapper input#show').remove() $('section.sa-wrapper input#show').remove()
$('section.sa-wrapper textarea#answer').remove() $('section.sa-wrapper textarea#answer').remove()
$('section.sa-wrapper p#rubric').append(answer) $('section.sa-wrapper p#rubric').append("Your answer: #{answer}")
$('section.sa-wrapper p#rubric').append(response.rubric) $('section.sa-wrapper p#rubric').append(response.rubric)
else else
$('section.sa-wrapper p#rubric').append(response.message) $('section.sa-wrapper p#rubric').append(response.message)
......
...@@ -121,7 +121,7 @@ class SelfAssessmentModule(XModule): ...@@ -121,7 +121,7 @@ class SelfAssessmentModule(XModule):
dom2 = etree.fromstring("<selfassessment>" + self.definition['data'] + "</selfassessment>") dom2 = etree.fromstring("<selfassessment>" + self.definition['data'] + "</selfassessment>")
#Extract problem, submission message and rubric from definition file #Extract problem, submission message and rubric from definition file
self.rubric = "<br/><br/>" + ''.join([etree.tostring(child) for child in only_one(dom2.xpath('rubric'))]) self.rubric = "<br/>" + ''.join([etree.tostring(child) for child in only_one(dom2.xpath('rubric'))])
self.problem = ''.join([etree.tostring(child) for child in only_one(dom2.xpath('problem'))]) self.problem = ''.join([etree.tostring(child) for child in only_one(dom2.xpath('problem'))])
self.submit_message = etree.tostring(dom2.xpath('submitmessage')[0]) self.submit_message = etree.tostring(dom2.xpath('submitmessage')[0])
...@@ -133,8 +133,8 @@ class SelfAssessmentModule(XModule): ...@@ -133,8 +133,8 @@ class SelfAssessmentModule(XModule):
'<p id="rubric"></p><input type="hidden" ' '<p id="rubric"></p><input type="hidden" '
'id="ajax_url" name="ajax_url" url="{0}"></section><br/><br/>').format(system.ajax_url) 'id="ajax_url" name="ajax_url" url="{0}"></section><br/><br/>').format(system.ajax_url)
rubric_form = ('<br/><br/>Please assess your performance given the above rubric: <br/>' rubric_form = ('Please assess your performance given the above rubric: <br/>'
'<br/><section class="sa-wrapper"><select name="assessment" id="assessment">' '<section class="sa-wrapper"><select name="assessment" id="assessment">'
'<option value="incorrect">Incorrect</option><option value="correct">' '<option value="incorrect">Incorrect</option><option value="correct">'
'Correct</option></select><br/>' 'Correct</option></select><br/>'
'<input type="button" value="Save" id="save" name="save"/>' '<input type="button" value="Save" id="save" name="save"/>'
...@@ -142,14 +142,16 @@ class SelfAssessmentModule(XModule): ...@@ -142,14 +142,16 @@ class SelfAssessmentModule(XModule):
'id="ajax_url" name="ajax_url" url="{0}">' 'id="ajax_url" name="ajax_url" url="{0}">'
'</section><br/><br/>').format(system.ajax_url) '</section><br/><br/>').format(system.ajax_url)
rubric_header=('<br/><br/><b>Rubric</b>')
#Combine problem, rubric, and the forms #Combine problem, rubric, and the forms
if self.answer is not "" : if self.answer is not "" :
answer_html="<br/><br/>Previous Answer: <br/>{0}<br/><br/>".format(self.answer) answer_html="<br/>Previous answer: {0}<br/>".format(self.answer)
self.problem = ''.join([self.problem, answer_html, problem_form]) self.problem = ''.join([self.problem, answer_html, problem_form])
else: else:
self.problem = ''.join([self.problem, problem_form]) self.problem = ''.join([self.problem, problem_form])
self.rubric = ''.join([self.rubric, rubric_form]) self.rubric = ''.join([rubric_header,self.rubric, rubric_form])
#Display the problem to the student to begin with #Display the problem to the student to begin with
self.html = self.problem self.html = self.problem
...@@ -284,7 +286,7 @@ class SelfAssessmentDescriptor(XmlDescriptor, EditingDescriptor): ...@@ -284,7 +286,7 @@ class SelfAssessmentDescriptor(XmlDescriptor, EditingDescriptor):
stores_state = True stores_state = True
has_score = True has_score = True
template_dir_name = "html" template_dir_name = "selfassessment"
js = {'coffee': [resource_string(__name__, 'js/src/html/edit.coffee')]} js = {'coffee': [resource_string(__name__, 'js/src/html/edit.coffee')]}
js_module_name = "HTMLEditingDescriptor" js_module_name = "HTMLEditingDescriptor"
......
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