Commit dfbfc790 by Vik Paruchuri

Work on templating, bugfix

parent e94a78c6
......@@ -104,12 +104,7 @@ class SelfAssessmentModule(XModule):
self.prompt = definition['prompt']
self.submit_message = definition['submitmessage']
#Forms to append to prompt and rubric that capture student responses.
#Do not change ids and names, as javascript (selfassessment/display.coffee) depends on them
# TODO: use templates -- system.render_template will pull them from the right place (lms/templates dir)
# TODO:
#set context variables and render template
previous_answer=''
if len(self.student_answers)>0:
previous_answer=self.student_answers[len(self.student_answers)-1]
......@@ -122,7 +117,7 @@ class SelfAssessmentModule(XModule):
'ajax_url' : system.ajax_url,
'section_name' : 'sa-wrapper',
}
self.html = self.system.render_template('self_assessment_prompt.html', context)
self.html = self.system.render_template('self_assessment_prompt.html', self.context)
def get_score(self):
return {'score': self.score}
......@@ -183,9 +178,15 @@ class SelfAssessmentModule(XModule):
# TODO: expecting something like get['answer']
self.temp_answer = get.keys()[0]
log.debug(self.temp_answer)
return {'success': True, 'rubric': self.rubric}
return {
'success': True,
'rubric': self.system.render_template('self_assessment_rubric.html', self.context)
}
else:
return{'success': False, 'message': 'Too many attempts.'}
return{
'success': False,
'message': 'Too many attempts.'
}
def save_problem(self, get):
'''
......
......@@ -63,10 +63,10 @@ CACHES = {
XQUEUE_INTERFACE = {
"url": "https://sandbox-xqueue.edx.org",
"url": 'http://127.0.0.1:3031',
"django_auth": {
"username": "lms",
"password": "***REMOVED***"
"password": "abcd"
},
"basic_auth": ('anant', 'agarwal'),
}
......
<section class="${ section_name }">
${ prompt }
% if previous_answer_given
% if previous_answer_given:
: <br/>Previous answer: ${ previous_answer }<br/>
% endif
......
<section class="${section_name}">
<br/><br/><b>Rubric</b>
${ rubric }
Please assess your performance given the above rubric: <br/>
<select name="assessment" id="assessment">
<option value="incorrect">Incorrect</option>
......@@ -11,6 +12,6 @@
<br/>
<input type="button" value="Save" id="save" name="save"/>
<p id="save_message"></p>
<input type="hidden" id="ajax_url" name="ajax_url" url="${ self_assessment['ajax_url']}">
<input type="hidden" id="ajax_url" name="ajax_url" url="${ ajax_url}">
</section>
<br/><br/>
\ 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