From 5e403688c1b42aff9ab60afd773a7466741f1f27 Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Thu, 23 Sep 2021 14:03:27 +0000 Subject: [PATCH 1/4] [IMP] website: recompute height of dynamic carousel On rendering, we check the higher slide to set this size as min-height of the carousel and avoid flickering. X-original-commit: c2e3fdccd84a9077b50d2fcf0dd147026cbc613a Part-of: odoo/odoo#77153 --- .../s_dynamic_snippet_carousel/000.js | 35 +++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/addons/website/static/src/snippets/s_dynamic_snippet_carousel/000.js b/addons/website/static/src/snippets/s_dynamic_snippet_carousel/000.js index cf43100a8c9..5d1a5c38e93 100644 --- a/addons/website/static/src/snippets/s_dynamic_snippet_carousel/000.js +++ b/addons/website/static/src/snippets/s_dynamic_snippet_carousel/000.js @@ -30,15 +30,46 @@ const DynamicSnippetCarousel = DynamicSnippet.extend({ * options * @private */ - _getQWebRenderParams: function () { + _getQWebRenderOptions: function () { return Object.assign( this._super.apply(this, arguments), { - interval : parseInt(this.$target[0].dataset.carouselInterval), + interval: parseInt(this.$target[0].dataset.carouselInterval), }, ); }, + /** + * + * @override + */ + _renderContent: function () { + this._super.apply(this, arguments); + this._computeHeights(); + }, + + /** + * + * Force height of carousel to the higher slide, to avoid flickering. + * @private + */ + _computeHeights: function () { + var maxHeight = 0; + var $items = this.$('.carousel-item'); + $items.css('min-height', ''); + _.each($items, function (el) { + var $item = $(el); + var isActive = $item.hasClass('active'); + $item.addClass('active'); + var height = $item.outerHeight(); + if (height > maxHeight) { + maxHeight = height; + } + $item.toggleClass('active', isActive); + }); + $items.css('min-height', maxHeight); + }, + }); publicWidget.registry.dynamic_snippet_carousel = DynamicSnippetCarousel; From 2033ba58f5c4cda9b146bb6f8bb21871379c709e Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Wed, 22 Sep 2021 16:24:26 +0000 Subject: [PATCH 2/4] [IMP] website: reset numberOfElements if incoherent with numberOfRecords Now if you fetch 4 elements, we preset to 4 the number of record displayed X-original-commit: 5c1d0c4249a16e41eac361728df6e95674e26d3d Part-of: odoo/odoo#77153 --- .../static/src/snippets/s_dynamic_snippet/options.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/addons/website/static/src/snippets/s_dynamic_snippet/options.js b/addons/website/static/src/snippets/s_dynamic_snippet/options.js index 6898106c071..82f2ccb51eb 100644 --- a/addons/website/static/src/snippets/s_dynamic_snippet/options.js +++ b/addons/website/static/src/snippets/s_dynamic_snippet/options.js @@ -45,6 +45,15 @@ const dynamicSnippetOptions = options.Class.extend({ if (params.attributeName === 'templateKey' && previewMode === false) { this._templateUpdated(widgetValue, params.activeValue); } + if (params.attributeName === 'numberOfRecords' && previewMode === false) { + const dataSet = this.$target.get(0).dataset; + if (dataSet.numberOfElements > dataSet.numberOfRecords) { + dataSet.numberOfElements = dataSet.numberOfRecords; + } + if (dataSet.numberOfElementsSmallDevices > dataSet.numberOfRecords) { + dataSet.numberOfElementsSmallDevices = dataSet.numberOfRecords; + } + } }, //-------------------------------------------------------------------------- From 51d50a1379e2b904bee5b4a429d242863d66a4f6 Mon Sep 17 00:00:00 2001 From: Brieuc-brd Date: Wed, 25 Aug 2021 08:33:06 +0000 Subject: [PATCH 3/4] [IMP] portal_rating: add static star compressed style This commit adds a new template called "Rating: static star compressed widget". Instead, having 5 stars, it returns an empty/half/full star with the average rating. This smaller layout is used in the dynamic snippets product. Adapts the style of empty stars (it uses the outline star icon instead grey background) to work well on light and dark backgrounds. Part of https://github.com/odoo/odoo/pull/75623 task-2602978 X-original-commit: 0690e187ebb7e67694c8236f420213beed29993d Part-of: odoo/odoo#77153 --- .../portal_rating/views/rating_templates.xml | 36 +++++++++++++------ 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/addons/portal_rating/views/rating_templates.xml b/addons/portal_rating/views/rating_templates.xml index d565525f5e0..2fcc31e5894 100644 --- a/addons/portal_rating/views/rating_templates.xml +++ b/addons/portal_rating/views/rating_templates.xml @@ -9,18 +9,34 @@
- - + + + + + + + + + + + + + - - + + + + + + + + + + + + () + - - - - - () -
From 8d731cd20b00947e8d825bf543fe6227d629d67d Mon Sep 17 00:00:00 2001 From: Brieuc-brd Date: Tue, 14 Sep 2021 14:57:30 +0000 Subject: [PATCH 4/4] [IMP] website_sale: new templates for s_dynamic_snippet_products MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit adds new templates for the s_dynamic_snippet_products and improves the current templates for a better reading of the product’s title and a better management of space when the content have different width. Part of https://github.com/odoo/odoo/pull/75623 task-2602978 X-original-commit: 49bd79b0bdca76415780bdfa199195371c2692e5 Part-of: odoo/odoo#77153 --- .../s_dynamic_snippet_carousel/000.scss | 4 +- .../data/product_snippet_template_data.xml | 233 ++++++++++++++++-- .../s_dynamic_snippet_products/000.scss | 42 ++++ 3 files changed, 254 insertions(+), 25 deletions(-) create mode 100644 addons/website_sale/static/src/snippets/s_dynamic_snippet_products/000.scss diff --git a/addons/website/static/src/snippets/s_dynamic_snippet_carousel/000.scss b/addons/website/static/src/snippets/s_dynamic_snippet_carousel/000.scss index 72e5c4cbb48..0230074e9ef 100644 --- a/addons/website/static/src/snippets/s_dynamic_snippet_carousel/000.scss +++ b/addons/website/static/src/snippets/s_dynamic_snippet_carousel/000.scss @@ -8,13 +8,13 @@ background: radial-gradient($white 50%, transparent 50%); } } - .dynamic_snippet_template .card-footer a, .dynamic_snippet_template .card-footer button { + .dynamic_snippet_template .card-footer a, .dynamic_snippet_template .card-footer button, .o_dynamic_snippet_btn_wrapper { z-index: 2; } .dynamic_snippet_template .card-body .card-text { display: -webkit-box; -webkit-line-clamp: 4; - -webkit-box-orient: vertical; + -webkit-box-orient: vertical; text-overflow: ellipsis; overflow: hidden; } diff --git a/addons/website_sale/data/product_snippet_template_data.xml b/addons/website_sale/data/product_snippet_template_data.xml index 2e7b090a130..cbc3af4848c 100644 --- a/addons/website_sale/data/product_snippet_template_data.xml +++ b/addons/website_sale/data/product_snippet_template_data.xml @@ -2,25 +2,27 @@ -