diff options
| author | Aurélien Warnon <awa@odoo.com> | 2019-02-11 14:03:02 +0000 |
|---|---|---|
| committer | Aurélien Warnon <awa@odoo.com> | 2019-02-15 15:32:46 +0000 |
| commit | f322816ae826f14eafd6f1d4855b0e2a741530d5 (patch) | |
| tree | 77176562e6128b65275b9096a0e278789b122f75 /addons/website_slides_survey/views | |
| parent | dcce7716b3202eabd77666bcaaee9040e6a5e5b8 (diff) | |
[ADD] website_slides_survey: add a new bridge between slide and survey
Task #1940360
Subtask of #1902304
Purpose
=======
Adds certification capabilities to the website_slides module.
Channel/courses can now include certifications as a new type of slide.
This new type of slide is available as a "Certification" button on the slide creation
frontend view (next to "Video", "Presentation", ...).
Users have to link the slide to an actual survey that has the 'certificate' field
set to true (that will populate the slide's survey_id field).
Slides of type certification are handled in frontend in a very simple way for now:
- A button "Begin certification" that redirects the user to the related survey frontend.
- A button "Download certification" when the user has succeeded the certification.
- When the survey is done, if it's linked to a slide, a button "Go back to course" allows
the user to go back to the slide frontend.
(There is a special use case for when the website_publisher designing the survey lands on a
certification slide: he is allowed to test the survey with a survey_input created as test_entry)
Survey creation as well as limited time, limited number of attempts, ... are still completely
handled in the survey module. That means that the user will have to first create a suitable survey
that is a certification and only then create a slide of type "certification" and link
the created survey to it.
Ideally, the taking of the survey should be transparently included in the slide frontend but
it requires a full refactoring of the way surveys are submitted. This will most likely come in
a later commit.
This commit is an advanced merge of full eLearning module (see task #1902304).
Diffstat (limited to 'addons/website_slides_survey/views')
6 files changed, 96 insertions, 0 deletions
diff --git a/addons/website_slides_survey/views/assets.xml b/addons/website_slides_survey/views/assets.xml new file mode 100644 index 00000000000..8dc06209ad2 --- /dev/null +++ b/addons/website_slides_survey/views/assets.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" ?> +<odoo> + <data> + <template id="assets_frontend" inherit_id="website.assets_frontend" name="Slides Certification"> + <xpath expr="//script[last()]" position="after"> + <script type="text/javascript" src="/website_slides_survey/static/src/js/slides_upload.js"/> + <script type="text/javascript" src="/website_slides_survey/static/src/js/slides_certification_download.js"/> + </xpath> + </template> + + </data> +</odoo> diff --git a/addons/website_slides_survey/views/slide_channel_views.xml b/addons/website_slides_survey/views/slide_channel_views.xml new file mode 100644 index 00000000000..566bef457fa --- /dev/null +++ b/addons/website_slides_survey/views/slide_channel_views.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + <record id="slide_channel_view_form" model="ir.ui.view"> + <field name="name">slide.channel.view.form.inherit.survey</field> + <field name="model">slide.channel</field> + <field name="inherit_id" ref="website_slides.view_slide_channel_form"/> + <field name="arch" type="xml"> + <xpath expr="//field[@name='total_slides']" position="before"> + <field name="nbr_certifications"/> + </xpath> + </field> + </record> +</odoo> diff --git a/addons/website_slides_survey/views/slide_slide_views.xml b/addons/website_slides_survey/views/slide_slide_views.xml new file mode 100644 index 00000000000..66083f7bd7f --- /dev/null +++ b/addons/website_slides_survey/views/slide_slide_views.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + <record id="slide_slide_view_form" model="ir.ui.view"> + <field name="name">slide.slide.view.form.inherit.survey</field> + <field name="model">slide.slide</field> + <field name="inherit_id" ref="website_slides.view_slide_slide_form"/> + <field name="arch" type="xml"> + <xpath expr="//field[@name='slide_type']" position="after"> + <field name="survey_id" + attrs="{'invisible': [('slide_type', '!=', 'certification')], 'required': [('slide_type', '=', 'certification')]}" + domain="[('certificate', '=', True)]"/> + </xpath> + </field> + </record> +</odoo> diff --git a/addons/website_slides_survey/views/survey_templates.xml b/addons/website_slides_survey/views/survey_templates.xml new file mode 100644 index 00000000000..c6816dde39b --- /dev/null +++ b/addons/website_slides_survey/views/survey_templates.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + <data> + <template id="survey_templates_inherit_website_slides" inherit_id="survey.sfinished"> + <xpath expr="//div[hasclass('jumbotron')]/div[last()]" position="after"> + <div t-if="slide_url" class="mt16"> + <a role="button" + class="btn btn-primary btn-lg" + t-att-href="slide_url"> + Go back to course + </a> + </div> + </xpath> + </template> + </data> +</odoo> diff --git a/addons/website_slides_survey/views/website_slides_templates.xml b/addons/website_slides_survey/views/website_slides_templates.xml new file mode 100644 index 00000000000..84d9b348fec --- /dev/null +++ b/addons/website_slides_survey/views/website_slides_templates.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + <data> + <template id="slide_detail_view_inherit_survey" inherit_id="website_slides.slide_detail_view"> + <xpath expr="//div[hasclass('o_w_slides_slide_detail_container')]/div[hasclass('row')]" position="before"> + <t t-if="not test_entry" t-set="begin_certification_label" t-value="'Begin certification'" /> + <t t-if="test_entry" t-set="begin_certification_label" t-value="'Test certification'" /> + <div t-if="slide.slide_type == 'certification' and not quizz_passed" class="mb8"> + <a role="button" + class="btn btn-primary btn-lg" + t-att-href="certification_url"> + <i class="fa fa-fw fa-graduation-cap" role="img" t-att-aria-label="begin_certification_label" t-att-title="begin_certification_label"/> + <t t-esc="begin_certification_label" /> + </a> + </div> + <div t-if="slide.slide_type == 'certification' and quizz_passed" class="mb8"> + <a role="button" + t-att-data-survey_id="survey_id" + class="btn btn-primary btn-lg o_wslides_survey_download_certification" + href="#"> + <i class="fa fa-fw fa-trophy" role="img" aria-label="Download certification" title="Download certification"/> + Download certification + </a> + </div> + </xpath> + </template> + </data> +</odoo> diff --git a/addons/website_slides_survey/views/website_slides_templates_homepage.xml b/addons/website_slides_survey/views/website_slides_templates_homepage.xml new file mode 100644 index 00000000000..24132371f7f --- /dev/null +++ b/addons/website_slides_survey/views/website_slides_templates_homepage.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + <data> + <template id="courses_home_inherit_survey" inherit_id="website_slides.courses_home"> + <xpath expr="//li[hasclass('o_wslides_home_all_slides')]" position="after"> + <li class="nav-item ml16"> + <h4><a class="nav-link" href="/slides/all?slide_type=certification"><i class="fa fa-trophy"/> Certifications</a></h4> + </li> + </xpath> + </template> + </data> +</odoo> |
