| 1 |
<?xml version="1.0" encoding="UTF-8"?> |
| 2 |
<odoo> |
| 3 |
<template id="quiz_content" name="Track: Quiz specific content"> |
| 4 |
<t t-set="quiz_completed" t-value="quiz_completed or False"/> |
| 5 |
|
| 6 |
<div class="o_quiz_js_quiz col" |
| 7 |
t-att-data-id="track.id" |
| 8 |
t-att-data-event-id="track.event_id.id" |
| 9 |
t-att-data-completed="1 if quiz_completed else 0" |
| 10 |
t-att-data-quiz-attempts-count="quiz_attempts_count or 0" |
| 11 |
t-att-data-quiz-points-gained="quiz_points" |
| 12 |
t-att-data-is-event-user="is_event_user or 0" |
| 13 |
t-att-data-repeatable="track.quiz_id.repeatable"> |
| 14 |
<t t-foreach="track.quiz_id.question_ids" t-as="question"> |
| 15 |
<t t-call="website_event_track_quiz.quiz_question"/> |
| 16 |
</t> |
| 17 |
<div class="o_quiz_js_quiz_validation pt-3"/> |
| 18 |
</div> |
| 19 |
</template> |
| 20 |
|
| 21 |
<template id="quiz_question" name="Quiz question template"> |
| 22 |
<div t-att-class="'o_quiz_js_quiz_question mt-3 %s' % ('completed-disabled' if quiz_completed else '')" |
| 23 |
t-att-data-question-id="question['id']" t-att-data-title="question['name']" > |
| 24 |
<div class="row d-flex mb-2 mx-0"> |
| 25 |
<div class="h4"> |
| 26 |
<span t-out="question['name']"/> |
| 27 |
</div> |
| 28 |
</div> |
| 29 |
<div class="list-group"> |
| 30 |
<t t-foreach="question['answer_ids']" t-as="answer"> |
| 31 |
<a t-att-data-answer-id="answer['id']" href="#" |
| 32 |
t-att-data-text="answer['text_value']" |
| 33 |
class="o_quiz_quiz_answer list-group-item list-group-item-action d-flex align-items-center"> |
| 34 |
<label class="my-0 d-flex align-items-center justify-content-center me-2"> |
| 35 |
<input type="radio" |
| 36 |
t-att-name="question['id']" |
| 37 |
t-att-value="answer['id']" |
| 38 |
class="d-none" |
| 39 |
t-att-disabled="quiz_completed"/> |
| 40 |
<i t-att-class="'fa fa-circle text-400 %s' % ('d-none' if quiz_completed and answer['is_correct'] else '')"/> |
| 41 |
<i class="fa fa-times-circle text-danger d-none"></i> |
| 42 |
<i t-att-class="'fa fa-check-circle text-success %s' % ('d-none' if not (quiz_completed and answer['is_correct']) else '')"></i> |
| 43 |
</label> |
| 44 |
<span t-out="answer['text_value']"/> |
| 45 |
</a> |
| 46 |
</t> |
| 47 |
</div> |
| 48 |
</div> |
| 49 |
</template> |
| 50 |
</odoo> |