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 @@
- - + + + + + + + + + + + + + - - + + + + + + + + + + + + () + - - - - - () -
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; + } + } }, //-------------------------------------------------------------------------- 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; 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 @@ -