diff options
| author | qmo-odoo <qmo@odoo.com> | 2019-03-13 13:35:05 +0000 |
|---|---|---|
| committer | jem-odoo <jem@openerp.com> | 2019-03-15 20:38:58 +0000 |
| commit | e8e8d7a956a9cc858c06673db62cb2eb9784c9df (patch) | |
| tree | 9b174a445196d85abc8fb63eaafe33207292ce5f /addons/website_slides_survey/static/src | |
| parent | 44ae98d3ddbc4cf436e20539d7274e6bcba12e29 (diff) | |
[FIX] website_slides_survey: certification slide url
Before this commit, in fullscreen mode, clicking on the "pass certification"
button would redirect the user to the "non-fullscreen" view.
After this commit, the button directly redirects the user to the survey page.
To avoid generating user_input of survey (test entry or not) for
certification slides in fullscreen mode (table of content), we decided
to create those user_input lazily: we redirect the user to a route that
create (or reuse) the correct user_input.
Task-1946511
Diffstat (limited to 'addons/website_slides_survey/static/src')
3 files changed, 44 insertions, 28 deletions
diff --git a/addons/website_slides_survey/static/src/js/slides_course_fullscreen_player.js b/addons/website_slides_survey/static/src/js/slides_course_fullscreen_player.js index 9fc8ffe3407..cf64b088d74 100644 --- a/addons/website_slides_survey/static/src/js/slides_course_fullscreen_player.js +++ b/addons/website_slides_survey/static/src/js/slides_course_fullscreen_player.js @@ -1,15 +1,39 @@ odoo.define('website_slides_survey.fullscreen', function (require) { - "use strict"; - - var core = require('web.core'); - var _t = core._t; - var Fullscreen = require('website_slides.fullscreen'); - - Fullscreen.include({ - xmlDependencies: (Fullscreen.prototype.xmlDependencies || []).concat( - ["/website_slides_survey/static/src/xml/website_slides_fullscreen.xml"] - ), - }); - - }); -
\ No newline at end of file +"use strict"; + +var core = require('web.core'); +var QWeb = core.qweb; +var Fullscreen = require('website_slides.fullscreen'); + +Fullscreen.include({ + xmlDependencies: (Fullscreen.prototype.xmlDependencies || []).concat( + ["/website_slides_survey/static/src/xml/website_slides_fullscreen.xml"] + ), + _preprocessSlideData: function (slidesDataList){ + slidesDataList = this._super.apply(this, arguments); + slidesDataList.forEach(function (slideData, index){ + if (slideData.type === "certification"){ + slideData.certificationUrl = '/slides_survey/slide/get_certification_url?slide_id=' + slideData.id; + } + }); + return slidesDataList; + }, + /** + * Extend the _renderSlide method so that slides of type "certification" + * are also taken into account and rendered correctly + * + * @private + * @override + */ + _renderSlide: function (){ + var def = this._super.apply(this, arguments); + var $content = this.$('.o_wslides_fs_content'); + if (this.get('slide').type === "certification"){ + $content.html(QWeb.render('website.slides.fullscreen.certification',{widget: this})); + } + return $.when(def); + }, +}); +}); + + diff --git a/addons/website_slides_survey/static/src/scss/website_slides.scss b/addons/website_slides_survey/static/src/scss/website_slides.scss deleted file mode 100644 index 84a24ede56f..00000000000 --- a/addons/website_slides_survey/static/src/scss/website_slides.scss +++ /dev/null @@ -1,9 +0,0 @@ -.o_wslides_fs_certification { - display: flex; - justify-content: center; - align-items: center; - position: absolute; - top: 50%; - left: 50%; - transform: translateX(-50%) translateY(-50%); -}
\ No newline at end of file diff --git a/addons/website_slides_survey/static/src/xml/website_slides_fullscreen.xml b/addons/website_slides_survey/static/src/xml/website_slides_fullscreen.xml index e76839db82a..dab906f24eb 100644 --- a/addons/website_slides_survey/static/src/xml/website_slides_fullscreen.xml +++ b/addons/website_slides_survey/static/src/xml/website_slides_fullscreen.xml @@ -1,16 +1,17 @@ <?xml version="1.0" encoding="UTF-8"?> <templates> - <t t-extend="website.slides.fullscreen"> - <t t-jquery="t:last" t-operation="after"> - <div t-if="widget.get('slide').type === 'certification' && !widget.get('slide').certificationDone" class="o_wslides_fs_certification"> + + <t t-name="website.slides.fullscreen.certification"> + <div class="justify-content-center align-self-center"> + <div t-if="widget.get('slide').type === 'certification' && !widget.get('slide').completed" class=""> <a class="btn btn-primary" t-att-href="'/slides/slide/' + widget.get('slide').id" target="new"><i class="fa fa-trophy"/> Pass Certification</a> </div> - <div class="o_wslides_fs_certification" t-if="widget.get('slide').type == 'certification' && widget.get('slide').completed"> + <div class="" t-if="widget.get('slide').type === 'certification' && widget.get('slide').completed"> <a role="button" class="btn btn-primary" t-att-href="'/survey/' + widget.get('slide').certificationId + '/get_certification'"> <i class="fa fa-fw fa-trophy" role="img" aria-label="Download certification" title="Download certification"/> Download certification </a> </div> - </t> + </div> </t> <t t-extend="website.slides.fullscreen.title"> |
