summaryrefslogtreecommitdiff
path: root/addons/website_slides/controllers
diff options
context:
space:
mode:
authorPatrick Hoste <pko@odoo.com>2020-08-11 07:21:56 +0000
committerThibault Delavallée <tde@odoo.com>2020-08-11 10:21:30 +0000
commit255bb3abf38b03145b7d025fb8546530db4a7549 (patch)
treef3df1de9f81ab147c5915f8076858dddb30d465a /addons/website_slides/controllers
parent2e7c398fb3dc8f423f55f23fd688459f09023d4d (diff)
[REF] website_slides: improve course frontend page
PURPOSE Improve onboarding and user experience and course frontend SPECIFICATIONS Overall improvements and onboarding : * new and improved default images for both course types; * preview / free preview badge update; * copy writing and spacing update; * allow to specifically choose a slide to promote. Display promoted slide is not optional anymore as configured in backend; * display a sample of lessons if no lesson in a course; LINKS Task ID-2241513 PR #55698
Diffstat (limited to 'addons/website_slides/controllers')
-rw-r--r--addons/website_slides/controllers/main.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/addons/website_slides/controllers/main.py b/addons/website_slides/controllers/main.py
index 68648b7ff9d..edad9c10419 100644
--- a/addons/website_slides/controllers/main.py
+++ b/addons/website_slides/controllers/main.py
@@ -406,7 +406,8 @@ class WebsiteSlides(WebsiteProfile):
# sorting criterion
if channel.channel_type == 'documentation':
- actual_sorting = sorting if sorting and sorting in request.env['slide.slide']._order_by_strategy else channel.promote_strategy
+ default_sorting = 'latest' if channel.promote_strategy in ['specific', 'none', False] else channel.promote_strategy
+ actual_sorting = sorting if sorting and sorting in request.env['slide.slide']._order_by_strategy else default_sorting
else:
actual_sorting = 'sequence'
order = request.env['slide.slide']._order_by_strategy[actual_sorting]
@@ -489,7 +490,10 @@ class WebsiteSlides(WebsiteProfile):
# of them but unreachable ones won't be clickable (+ slide controller will crash anyway)
# documentation mode may display less slides than content by category but overhead of
# computation is reasonable
- values['slide_promoted'] = request.env['slide.slide'].sudo().search(domain, limit=1, order=order)
+ if channel.promote_strategy == 'specific':
+ values['slide_promoted'] = channel.sudo().promoted_slide_id
+ else:
+ values['slide_promoted'] = request.env['slide.slide'].sudo().search(domain, limit=1, order=order)
limit_category_data = False
if channel.channel_type == 'documentation':