From dfbfc7905ff8ae50b9100d2d53addb9ec168e40c Mon Sep 17 00:00:00 2001 From: Vik Paruchuri Date: Mon, 5 Nov 2012 18:48:41 -0500 Subject: [PATCH] Work on templating, bugfix --- .../xmodule/xmodule/self_assessment_module.py | 19 ++++++++++--------- lms/envs/dev.py | 4 ++-- lms/templates/self_assessment_prompt.html | 2 +- lms/templates/self_assessment_rubric.html | 3 ++- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/common/lib/xmodule/xmodule/self_assessment_module.py b/common/lib/xmodule/xmodule/self_assessment_module.py index d1bc9d098d..9ee33d6146 100644 --- a/common/lib/xmodule/xmodule/self_assessment_module.py +++ b/common/lib/xmodule/xmodule/self_assessment_module.py @@ -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): ''' diff --git a/lms/envs/dev.py b/lms/envs/dev.py index 9114f099d4..357e25842b 100644 --- a/lms/envs/dev.py +++ b/lms/envs/dev.py @@ -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'), } diff --git a/lms/templates/self_assessment_prompt.html b/lms/templates/self_assessment_prompt.html index e41be5d063..2f2bfa4987 100644 --- a/lms/templates/self_assessment_prompt.html +++ b/lms/templates/self_assessment_prompt.html @@ -1,6 +1,6 @@
${ prompt } - % if previous_answer_given + % if previous_answer_given: :
Previous answer: ${ previous_answer }
% endif diff --git a/lms/templates/self_assessment_rubric.html b/lms/templates/self_assessment_rubric.html index ddd490bdf4..342a8331ff 100644 --- a/lms/templates/self_assessment_rubric.html +++ b/lms/templates/self_assessment_rubric.html @@ -1,5 +1,6 @@


Rubric + ${ rubric } Please assess your performance given the above rubric:

- +


\ No newline at end of file