Commit dfbfc790 by Vik Paruchuri

Work on templating, bugfix

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