[FIX] website_slides[_survey]: fix various fullscreen issues

This commit provides a few fixes for the fullscreen view:
  * make external links associated with a slide clickable again in fullscreen
    mode;
  * hide completion icons if not member:
  * add margin to subquiz icon in header;
  * add dedicated button to exit the fullscreen mode;
  * change "Pass certification" button to "Test Certification" if not member
    of the channel (for website publishers);

Commit linked to task ID 1941250 and PR #31977
This commit is contained in:
qmo-odoo
2019-03-21 11:43:03 +00:00
committed by Thibault Delavallée
parent 64b4461229
commit adf80cf708
3 changed files with 17 additions and 8 deletions
@@ -236,7 +236,6 @@ odoo.define('website_slides.fullscreen', function (require) {
*/
_onClickTab: function (ev) {
ev.stopPropagation();
ev.preventDefault();
var $elem = $(ev.currentTarget);
var isQuiz = $elem.data('isQuiz');
var slideID = parseInt($elem.data('id'));
@@ -412,8 +411,10 @@ odoo.define('website_slides.fullscreen', function (require) {
_pushUrlState: function (){
var urlParts = window.location.pathname.split('/');
urlParts[urlParts.length-1] = this.get('slide').slug;
var url = _.str.sprintf('%s?fullscreen=1', urlParts.join('/'));
history.pushState(null, '', url);
var url = urlParts.join('/');
this.$('.o_wslides_fs_exit_fullscreen').attr('href', url);
var fullscreenUrl = _.str.sprintf('%s?fullscreen=1', url);
history.pushState(null, '', fullscreenUrl);
},
/**
* Render the current slide content using specific mecanism according to slide type:
@@ -16,6 +16,9 @@
</a>
</div>
<div class="d-flex ml-auto">
<a class="d-flex align-items-center px-3 o_wslides_fs_exit_fullscreen" t-attf-href="/slides/slide/#{slug(slide)}">
<i class="fa fa-sign-out d-md-none"/><span class="d-none d-md-inline-block ml-1">Exit Fullscreen</span>
</a>
<a class="d-flex align-items-center px-3" t-attf-href="/slides/#{slug(slide.channel_id)}">
<i class="fa fa-sign-out d-md-none"/><span class="d-none d-md-inline-block ml-1">Back to course</span>
</a>
@@ -71,6 +74,7 @@
<ul class="o_wslides_fs_sidebar_section_slides collapse show position-relative px-0 pb-1 my-0 mx-n3" t-att-id="('collapse-%s') % (category.id if category else 0)">
<t t-foreach="slides" t-as="slide">
<t t-set="slide_completed" t-value="channel_progress[slide.id].get('completed')"/>
<t t-set="is_member" t-value="slide.channel_id.is_member"/>
<li t-att-class="'o_wslides_fs_sidebar_list_item d-flex align-items-top py-1 %s' % ('active' if slide.id == current_slide.id else '')"
t-att-data-id="slide.id"
t-att-data-name="slide.name"
@@ -80,11 +84,11 @@
t-att-data-is-quiz="0"
t-att-data-completed="1 if slide_completed else 0"
t-att-data-embed-code="slide.embed_code if slide.slide_type in ['video', 'document', 'presentation', 'infographic'] else False"
t-att-data-readonly="not channel_progress[slide.id]"
t-att-data-readonly="not is_member"
>
<span class="ml-3">
<i t-if="slide_completed" class="o_wslides_slide_completed fa fa-check fa-fw text-success" t-att-data-slide-id="slide.id"/>
<i t-else="" class="fa fa-circle-thin fa-fw" t-att-data-slide-id="slide.id"/>
<i t-if="slide_completed and is_member" class="o_wslides_slide_completed fa fa-check fa-fw text-success" t-att-data-slide-id="slide.id"/>
<i t-if="not slide_completed and is_member" class="fa fa-circle-thin fa-fw" t-att-data-slide-id="slide.id"/>
</span>
<div class="ml-2">
<a class="d-block pt-1" href="#">
@@ -94,7 +98,7 @@
</a>
<ul class="list-unstyled w-100 pt-2 small" t-if="slide.link_ids or (slide.question_ids and not slide.slide_type =='quiz')" >
<li t-if="slide.link_ids" t-foreach="slide.link_ids" t-as="link" class="pl-0 mb-1">
<a class="o_wslides_fs_slide_link" t-att-href="link.link" target="new">
<a class="o_wslides_fs_slide_link" t-att-href="link.link" target="_blank">
<i class="fa fa-link mr-2"/><span t-esc="link.name"/>
</a>
</li>
@@ -4,7 +4,11 @@
<t t-name="website.slides.fullscreen.certification">
<div class="justify-content-center align-self-center">
<div t-if="widget.get('slide').type === 'certification' &amp;&amp; !widget.get('slide').completed" class="">
<a class="btn btn-primary" t-att-href="'/slides_survey/slide/get_certification_url?slide_id=' + widget.get('slide').id" target="_blank"><i class="fa fa-trophy"/> Pass Certification</a>
<a class="btn btn-primary" t-att-href="'/slides_survey/slide/get_certification_url?slide_id=' + widget.get('slide').id" target="_blank">
<i class="fa fa-trophy"/>
<span t-if="widget.get('slide').isMember"> Pass Certification</span>
<span t-else="">Test Certification</span>
</a>
</div>
<div class="" t-if="widget.get('slide').type === 'certification' &amp;&amp; widget.get('slide').completed">
<a role="button" class="btn btn-primary" t-att-href="'/survey/' + widget.get('slide').certificationId + '/get_certification'">