Skip to content
Browse files

[FIX] website_slide{_survey} : apply various fixes on elearning views

- Fix certification card in user's profile page

Since design review, certification card were not displaying well.
This commit applies the course card template on certification card
and modifies the way the certification get downloaded by calling directly the
controller instead of using class catched in javascript that calls afterward the

- Allow review button only if allow_comment in FS mode + redirect url

'write a review' button in fullscreen mode must not be displayed if the course
is not in allow_comment mode. Also, the url if this button was redirecting
to slide view in non fullscreen mode. As no review can be done from this point,
the url redirect now to the course view.

- Fix fullscreen slide height.

- Fix all slides view per category pager and page rendering

Since the introduction of categorized data dictionnary that is given to the template,
if a category is empty, it's rendered anyway, which is good for publisher,
to quickly see all existing categories.
But other users should not see those empty categories.

Also, if the slides from a course are filtered (with View all button) by category,
all the slides should be reachable, using the pager. This was not the case as
categorized slides dictionnary returned no slides if page <= 2.
(as bound of array was from offset to limit and offset and limit were equals)
The number of slides per category must be overwritten if search category is activated,
to see more than the 4 first slides of the category.

Finally, if search category is activated, only the target category should be displayed,
and not the others, for performance reason.

- Show 'not verified' next to user's name if user karma = 0

Instead of using the email_validation_done flag. As email validation is only used
to offer the user some karma in order to be able to interact in the forum or eLearning.
If the user already has karma, he is already considered as active and 'verified'

- Correct URL of certification in FS mode

Task ID : 1941250
Closes PR #31567

Signed-off-by: Thibault Delavallee (tde) <>
  • Loading branch information...
dbeguin committed Mar 8, 2019
1 parent 12fd6a0 commit a13e33ddda30f3c17bb52e8aa2f59f066e39e68e
@@ -143,7 +143,7 @@
<div class="col-12 col-md-8 col-lg-9 d-flex flex-column">
<div class="d-flex justify-content-between align-items-start">
<h1 class="o_card_people_name">
<span t-field=""/><small t-if="not validation_email_done"> (not verified)</small>
<span t-field=""/><small t-if="user.karma == 0"> (not verified)</small>
<a class="btn btn-primary d-none d-md-inline-block" t-if="request.env.user == user and validation_email_done" t-attf-href="/profile/edit?url_param=#{edit_button_url_param}">
<i class="fa fa-pencil mr-2"/>EDIT PROFILE
@@ -401,8 +401,8 @@ def channel(self, channel, category=None, tag=None, page=1, slide_type=None, unc
values['slide_promoted'] = request.env['slide.slide'].sudo().search(domain, limit=1, order=order)
values['category_data'] = channel._get_categorized_slides(
domain, order,
limit=self._slides_per_category if channel.channel_type == 'documentation' else False,
force_void=not category,
limit=False if channel.channel_type != 'documentation' else self._slides_per_page if category else self._slides_per_category,
values['channel_progress'] = self._get_channel_progress(channel, include_quiz=True)

@@ -491,7 +491,7 @@ def _get_categorized_slides(self, base_domain, order, force_void=True, limit=Fal
'category': False, 'id': False,
'name': _('Uncategorized'), 'slug_name': _('Uncategorized'),
'total_slides': len(uncategorized_slides),
'slides': uncategorized_slides[(offset or 0):(limit or len(uncategorized_slides))],
'slides': uncategorized_slides[(offset or 0):(offset + limit or len(uncategorized_slides))],
# Then all categories by natural order
for category in all_categories:
@@ -502,7 +502,7 @@ def _get_categorized_slides(self, base_domain, order, force_void=True, limit=Fal
'category': category, 'id':,
'name':, 'slug_name': slug(category),
'total_slides': len(category_slides),
'slides': category_slides[(offset or 0):(limit or len(category_slides))],
'slides': category_slides[(offset or 0):(limit + offset or len(category_slides))],
return category_data

@@ -93,7 +93,7 @@
<div class="row">
<h3 class="col-12"><span class="font-weight-bold" t-field=""/></h3>
<div class="col-12" t-field="channel.description"/>
<div class="col-xs-12 col-md-6 mt8">
<div class="col-xs-12 col-md-6 mt8" t-if="channel.allow_comment">
<t t-call="website_rating.rating_stars_static_popup_composer">
<t t-set="rating_avg" t-value="rating_avg"/>
<t t-set="rating_total" t-value="rating_count"/>
@@ -104,7 +104,7 @@
<t t-set="default_message" t-value="last_message"/>
<t t-set="default_rating_value" t-value="last_rating_value"/>
<t t-set="force_submit_url" t-value="'/slides/mail/update_comment' if last_message_id else False"/>
<t t-set="disable_composer" t-value="not channel.allow_comment or not channel.can_review"/>
<t t-set="disable_composer" t-value="not channel.can_review"/>
@@ -402,7 +402,7 @@
<t t-foreach="category_data" t-as="category">
<div class="mb-5">
<div class="mb-5" t-if="(category['slides'] or channel.can_publish) and (search_category and == category['id'] or not search_category)">
<div class="row align-items-center">
<div class="col">
<t t-if="category['id']">
@@ -426,7 +426,7 @@
<div class="col" t-field="channel.description_html"/>
<t t-if="search_category">
<div class="form-inline justify-content-center">
<div class="form-inline justify-content-center pb-5">
<t t-call="website_profile.pager_nobox"></t>
@@ -11,7 +11,7 @@
<a class="o_wslides_fs_toggle_sidebar d-flex align-items-center px-3" href="#" title="Lessons">
<i class="fa fa-bars"/><span class="d-none d-md-inline-block ml-1">Lessons</span>
<a class="o_wslides_fs_review d-flex align-items-center px-3" t-attf-href="/slides/slide/#{slug(slide)}" target="new" title="Reviews">
<a class="o_wslides_fs_review d-flex align-items-center px-3" t-att-href="slide.channel_id.website_url" title="Reviews" t-if="slide.channel_id.allow_comment">
<i class="fa fa-pencil"/><span class="d-none d-md-inline-block ml-1">Write a review</span>
@@ -29,7 +29,7 @@

<div class="o_wslides_fs_container d-flex position-relative overflow-hidden flex-grow-1">
<div class="o_wslides_fs_content align-items-stretch justify-content-center d-flex h-100 flex-grow-1 order-2"></div>
<div class="o_wslides_fs_content align-items-stretch justify-content-center d-flex flex-grow-1 order-2"></div>

<div class="o_wslides_fs_sidebar text-white flex-shrink-0 order-1">
<div class="o_wslides_fs_sidebar_content d-flex flex-column px-3 pt-3 h-100">
@@ -4,7 +4,7 @@
<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/slide/' + widget.get('slide').id" target="new"><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"/> Pass Certification</a>
<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'">
@@ -14,18 +14,15 @@
<template id="display_certificate">
<t t-if="certificates">
<div class="row">
<div class="col-lg-6 o_wprofile_slides_card" t-foreach="certificates" t-as="certificate">
<div class="card-body o_wprofile_slides_certif_card_body o_wprofile_bb_grey">
<div class="row">
<div><img class="o_wprofile_img_small" t-attf-src="/web/image/slide.slide/#{}/image_small"/></div>
<div class="col-10 o_wprofile_slides_title">
<span class="font-weight-bold" t-field="certificate.survey_id.title"/>
<div class="float-right" t-if=" == uid">
<span class="row">Score : <b t-field="certificate.quizz_score"/>%</span>
<div class="row">
<a role="button"
t-att-href="'/survey/%s/get_certification' %">
<div class="col-12 col-lg-6" t-foreach="certificates" t-as="certificate">
<div class="card mb-2">
<div class="card-body o_wprofile_slides_course_card_body p-0 d-flex">
<div class="pl-5 pr-4 rounded-left" t-attf-style="background-image:url(/web/image/slide.slide/#{}/image_medium); background-position: center"/>
<div class="p-2 w-100">
<h5 class="mt-0 mb-1" t-field="certificate.survey_id.title"/>
<div t-if=" == uid">
<small class="font-weight-bold">Score : <span t-field="certificate.quizz_score"/> %</small>
<a role="button" class="float-right" t-att-href="'/survey/%s/get_certification' %">
<i class="fa fa-download"/>

0 comments on commit a13e33d

Please sign in to comment.
You can’t perform that action at this time.