From a13e33ddda30f3c17bb52e8aa2f59f066e39e68e Mon Sep 17 00:00:00 2001 From: David Beguin Date: Fri, 8 Mar 2019 10:12:28 +0000 Subject: [PATCH] [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 controller. - 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) --- .../website_profile/views/website_profile.xml | 2 +- addons/website_slides/controllers/main.py | 4 ++-- addons/website_slides/models/slide_channel.py | 4 ++-- .../views/website_slides_templates_course.xml | 8 +++---- ...ite_slides_templates_lesson_fullscreen.xml | 4 ++-- .../src/xml/website_slides_fullscreen.xml | 2 +- .../views/website_profile.xml | 21 ++++++++----------- 7 files changed, 21 insertions(+), 24 deletions(-) diff --git a/addons/website_profile/views/website_profile.xml b/addons/website_profile/views/website_profile.xml index c92f12e1e19..540c7c608b5 100644 --- a/addons/website_profile/views/website_profile.xml +++ b/addons/website_profile/views/website_profile.xml @@ -143,7 +143,7 @@

- (not verified) + (not verified)

EDIT PROFILE diff --git a/addons/website_slides/controllers/main.py b/addons/website_slides/controllers/main.py index 0737317f494..197dc7b3cae 100644 --- a/addons/website_slides/controllers/main.py +++ b/addons/website_slides/controllers/main.py @@ -401,8 +401,8 @@ class WebsiteSlides(WebsiteProfile): values['slide_promoted'] = request.env['slide.slide'].sudo().search(domain, limit=1, order=order) values['category_data'] = channel._get_categorized_slides( domain, order, - force_void=True, - 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, offset=pager['offset']) values['channel_progress'] = self._get_channel_progress(channel, include_quiz=True) diff --git a/addons/website_slides/models/slide_channel.py b/addons/website_slides/models/slide_channel.py index fa098b2f7f2..5e1492ded94 100644 --- a/addons/website_slides/models/slide_channel.py +++ b/addons/website_slides/models/slide_channel.py @@ -491,7 +491,7 @@ class Channel(models.Model): '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 @@ class Channel(models.Model): 'category': category, 'id': category.id, 'name': category.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 diff --git a/addons/website_slides/views/website_slides_templates_course.xml b/addons/website_slides/views/website_slides_templates_course.xml index ed3d768ab22..267b924e7e6 100644 --- a/addons/website_slides/views/website_slides_templates_course.xml +++ b/addons/website_slides/views/website_slides_templates_course.xml @@ -93,7 +93,7 @@

-
+
@@ -104,7 +104,7 @@ - +
@@ -402,7 +402,7 @@
-