diff options
| author | Hoste Patrick <pko@odoo.com> | 2019-08-19 11:31:24 +0000 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2019-11-29 13:36:25 +0000 |
| commit | ec9e389f2feaf79c48d68f6f9d38d75487092361 (patch) | |
| tree | 4a3e230f1e1a901578c702ac6a7b7e528a5ddfb5 /addons/website_slides/static/src/xml/slide_quiz_create.xml | |
| parent | a4abdfa3164ab6cc5a77bc17a42619be49960f2c (diff) | |
[IMP] website_slides: allow to create and update quizzes directly in frontend
Purpose is to ease designing your courses by allowing to create and update
slide quiz directly in frontend, within the slide display.
With this commit you are able to
* add a quiz to a slide or add a question to an existing quiz;
* edit an existing question from a quiz:
* change the title of the Question;
* add, remove or update answers;
* change the right answer;
* delete an existing question;
* reorder the questions from a quiz;
* reset the quiz for the current user if he is a website designer, allowing
to test the quiz and its answers;
New frontend widgets are introduced allowing to manipulate quiz. Slide page
now supports a readonly / taking quiz mode and an edit mode for quizzes
used notably for website designers / course maintainers.
Task ID : 1999636
PR : #35326
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Diffstat (limited to 'addons/website_slides/static/src/xml/slide_quiz_create.xml')
| -rw-r--r-- | addons/website_slides/static/src/xml/slide_quiz_create.xml | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/addons/website_slides/static/src/xml/slide_quiz_create.xml b/addons/website_slides/static/src/xml/slide_quiz_create.xml new file mode 100644 index 00000000000..0d19371e0b3 --- /dev/null +++ b/addons/website_slides/static/src/xml/slide_quiz_create.xml @@ -0,0 +1,77 @@ +<?xml version="1.0" encoding="UTF-8"?> +<templates xml:space="preserve"> + + <t t-name="slide.quiz.question.input"> + <div t-attf-class="o_wsildes_quiz_question_input mt-3 #{!widget.update ? 'col' : ''}" t-att-data-id="widget.question.id || ''"> + <form class="mb-3"> + <div class="o_wslides_quiz_question row align-items-center mr-0 mb-2"> + <small class="text-muted col-1 text-center"> + <span class="h4 o_wslides_quiz_question_sequence"><t t-esc="widget.sequence"/></span>. + </small> + <input type="text" name="question-name" class="form-control col-11" placeholder="Enter your question" + t-att-value="widget.question.text" /> + </div> + <div class="text-muted mb-2"> + <span>Select the correct answer below :</span> + </div> + <div class="list-group"> + <t t-if="widget.question.answers" > + <t t-foreach="widget.question.answers" t-as="answer" > + <t t-call="slide.quiz.answer.line"/> + </t> + </t> + <t t-else="" > + <t t-foreach="[1, 2, 3]"> + <t t-call="slide.quiz.answer.line" /> + </t> + </t> + </div> + </form> + <t t-if="widget.update" t-call="slide.quiz.update.buttons"/> + <t t-else="" t-call="slide.quiz.create.buttons"/> + </div> + </t> + + <t t-name="slide.quiz.answer.line"> + <div class="o_wslides_js_quiz_answer row align-items-center mb-1" t-attf-data-answer-id="#{answer ? answer.id : ''}" > + <a class="o_wslides_js_quiz_is_correct col-1 text-center" title="Select one good answer"> + <label class="my-0"> + <input t-if="answer and answer.is_correct" class="d-none" type="radio" name="radio" checked="true" /> + <input t-else="" class="d-none" type="radio" name="radio" /> + <i class="fa fa-lg fa-check-circle-o" /> + </label> + </a> + <input type="text" class="form-control col-9" placeholder="Enter your answer" t-attf-value="#{answer ? answer.text_value : ''}"/> + <i class="o_wslides_js_quiz_add_answer fa fa-lg fa-plus-circle p-2" title="Add another answer" /> + <i class="o_wslides_js_quiz_remove_answer fa fa-lg fa-trash-o p-2" title="Remove this answer" /> + </div> + </t> + + <t t-name="slide.quiz.create.buttons"> + <div class="d-flex"> + <a class="o_wslides_js_quiz_validate_question btn btn-primary text-white border" role="button"> + <span class="d-none d-sm-inline-block">Save & Close</span> + </a> + <a class="o_wslides_js_quiz_validate_question o_wslides_js_quiz_create_next btn btn-primary text-white border ml-2" role="button"> + <span class="d-none d-sm-inline-block">Save & New</span> + </a> + <a class="o_wslides_js_quiz_cancel_question btn btn-light border ml-2" role="button"> + <span class="d-none d-sm-inline-block">Cancel</span> + </a> + </div> + </t> + + <t t-name="slide.quiz.update.buttons"> + <a class="o_wslides_js_quiz_validate_question o_wslides_js_quiz_update btn btn-primary text-white border" role="button"> + <span class="d-none d-sm-inline-block">Update</span> + </a> + <a class="o_wslides_js_quiz_cancel_question btn btn-light border ml-2" role="button"> + <span class="d-none d-sm-inline-block">Cancel</span> + </a> + </t> + + <t t-name="slide.quiz.confirm.deletion"> + <div>Are you sure you want to delete this question : <strong t-esc="widget.questionTitle"/> ?</div> + </t> + +</templates> |
