Commit 7cf1bb93 by Xavier Antoviaque

Adds tip formatting & display of instructor advice text

parent 93a7b061
......@@ -86,14 +86,23 @@ class QuizzBlock(XBlock):
return fragment
def submit(self, submission):
# TODO
log.info(u'Received quizz submission: %s', submission)
log.info(u'submission: %s', submission)
# TODO
completed = bool(submission)
show_tip = completed
if show_tip:
formatted_tip = render_template('static/html/tip.html', {
'self': self,
})
else:
formatted_tip = ''
return {
'submission': submission,
'completed': completed,
'tip': 'submission: {}, completed: {}'.format(submission, completed)
'tip': formatted_tip,
}
#self.student_input = submission[0]['value']
......
<div class="quizz-tip">
<h3>{{ self.question }}</h2>
<p>{{ self.tip }}</p>
</div>
......@@ -11,10 +11,10 @@ function QuizzBlock(runtime, element) {
},
handleSubmit: function(result) {
var tips_dom = $(element).parent().find('.quizz-tips'),
tip_text = (result || {}).tip || '';
tip_html = (result || {}).tip || '';
if(tip_text) {
tips_dom.append('<div class="quizz_tip">' + tip_text + '</div>');
if(tip_html) {
tips_dom.append(tip_html);
}
}
}
......
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