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 a0ae018dc21..0540aad9d4e 100644
--- a/addons/website/static/src/snippets/s_dynamic_snippet/options.js
+++ b/addons/website/static/src/snippets/s_dynamic_snippet/options.js
@@ -47,18 +47,6 @@ 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;
- const numberOfElements = parseInt(dataSet.numberOfElements);
- const numberOfRecords = parseInt(dataSet.numberOfRecords);
- const numberOfElementsSmallDevices = parseInt(dataSet.numberOfElementsSmallDevices);
- if (numberOfElements > numberOfRecords) {
- dataSet.numberOfElements = numberOfRecords;
- }
- if (numberOfElementsSmallDevices > numberOfRecords) {
- dataSet.numberOfElementsSmallDevices = numberOfRecords;
- }
- }
},
//--------------------------------------------------------------------------
@@ -79,16 +67,6 @@ const dynamicSnippetOptions = options.Class.extend({
await this._super(...arguments);
},
- /**
- * @override
- */
- async updateUIVisibility() {
- await this._super(...arguments);
- const template = this._getCurrentTemplate();
- const groupingMessage = this.el.querySelector('.o_grouping_message');
- groupingMessage.classList.toggle('d-none', template && !!template.numOfEl && !!template.numOfElSm);
- },
-
//--------------------------------------------------------------------------
// Private
//--------------------------------------------------------------------------
@@ -112,16 +90,6 @@ const dynamicSnippetOptions = options.Class.extend({
return Object.keys(this.dynamicFilters).length !== 1;
}
- if (widgetName === 'number_of_elements_opt') {
- const template = this._getCurrentTemplate();
- return template && !template.numOfEl;
- }
-
- if (widgetName === 'number_of_elements_small_devices_opt') {
- const template = this._getCurrentTemplate();
- return template && !template.numOfElSm;
- }
-
if (widgetName === 'number_of_records_opt') {
const template = this._getCurrentTemplate();
return template && !template.numOfElFetch;
@@ -249,8 +217,6 @@ const dynamicSnippetOptions = options.Class.extend({
// numberOfElements or numberOfElementsSmallDevices) might throw an
// exception by not finding the attribute on the element.
this.options.wysiwyg.odooEditor.observerUnactive();
- this._setOptionValue('numberOfElements', 4);
- this._setOptionValue('numberOfElementsSmallDevices', 1);
const filterKeys = this.$el.find("we-select[data-attribute-name='filterId'] we-selection-items we-button");
if (filterKeys.length > 0) {
this._setOptionValue('numberOfRecords', this.dynamicFilters[Object.keys(this.dynamicFilters)[0]].limit);
@@ -285,13 +251,22 @@ const dynamicSnippetOptions = options.Class.extend({
const template = this.dynamicFilterTemplates[newTemplate];
if (template.numOfEl) {
this.$target[0].dataset.numberOfElements = template.numOfEl;
+ } else {
+ delete this.$target[0].dataset.numberOfElements;
}
if (template.numOfElSm) {
this.$target[0].dataset.numberOfElementsSmallDevices = template.numOfElSm;
+ } else {
+ delete this.$target[0].dataset.numberOfElementsSmallDevices;
}
if (template.numOfElFetch) {
this.$target[0].dataset.numberOfRecords = template.numOfElFetch;
}
+ if (template.extraClasses) {
+ this.$target[0].dataset.extraClasses = template.extraClasses;
+ } else {
+ delete this.$target[0].dataset.extraClasses;
+ }
},
/**
* Sets the option value.
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 adae0ab86bd..0948f4acbaf 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
@@ -3,6 +3,7 @@ odoo.define('website.s_dynamic_snippet_carousel', function (require) {
const publicWidget = require('web.public.widget');
const DynamicSnippet = require('website.s_dynamic_snippet');
+const config = require('web.config');
const DynamicSnippetCarousel = DynamicSnippet.extend({
selector: '.s_dynamic_snippet_carousel',
@@ -26,6 +27,8 @@ const DynamicSnippetCarousel = DynamicSnippet.extend({
this._super.apply(this, arguments),
{
interval: parseInt(this.$target[0].dataset.carouselInterval),
+ rowPerSlide: parseInt(config.device.isMobile ? 1 : this.$target[0].dataset.rowPerSlide || 1),
+ arrowPosition: this.$target[0].dataset.arrowPosition || '',
},
);
},
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 16b2c2ba523..2e2756de413 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
@@ -18,4 +18,9 @@
text-overflow: ellipsis;
overflow: hidden;
}
+ .s_dynamic_snippet_arrow_bottom {
+ > .carousel-control-prev, .carousel-control-next {
+ position: relative;
+ }
+ }
}
diff --git a/addons/website/static/src/snippets/s_dynamic_snippet_carousel/000.xml b/addons/website/static/src/snippets/s_dynamic_snippet_carousel/000.xml
index 9cafb768cf8..6968ced6539 100644
--- a/addons/website/static/src/snippets/s_dynamic_snippet_carousel/000.xml
+++ b/addons/website/static/src/snippets/s_dynamic_snippet_carousel/000.xml
@@ -1,36 +1,60 @@
+
+
+
+ Previous
+
+
+
+ Next
+
+
-
-
-
+
+
+
+
+
+
diff --git a/addons/website/static/src/snippets/s_dynamic_snippet_carousel/options.js b/addons/website/static/src/snippets/s_dynamic_snippet_carousel/options.js
index cb9a3cf566a..23cd8cf8c63 100644
--- a/addons/website/static/src/snippets/s_dynamic_snippet_carousel/options.js
+++ b/addons/website/static/src/snippets/s_dynamic_snippet_carousel/options.js
@@ -18,7 +18,28 @@ const dynamicSnippetCarouselOptions = s_dynamic_snippet_options.extend({
_setOptionsDefaultValues: function () {
this._super.apply(this, arguments);
this._setOptionValue('carouselInterval', '5000');
- }
+ },
+ /**
+ * Take the new template selection into account
+ *
+ * @param {number} newTemplate id of the newly selected template
+ * @param {number} oldTemplate id of the previously selected template
+ * @override
+ */
+ _templateUpdated(newTemplate, oldTemplate) {
+ this._super(...arguments);
+ const template = this.dynamicFilterTemplates[newTemplate];
+ if (template.rowPerSlide) {
+ this.$target[0].dataset.rowPerSlide = template.rowPerSlide;
+ } else {
+ delete this.$target[0].dataset.rowPerSlide;
+ }
+ if (template.arrowPosition) {
+ this.$target[0].dataset.arrowPosition = template.arrowPosition;
+ } else {
+ delete this.$target[0].dataset.arrowPosition;
+ }
+ },
});
diff --git a/addons/website/views/snippets/s_dynamic_snippet.xml b/addons/website/views/snippets/s_dynamic_snippet.xml
index 15f48dc9f06..7e0e8927bbc 100644
--- a/addons/website/views/snippets/s_dynamic_snippet.xml
+++ b/addons/website/views/snippets/s_dynamic_snippet.xml
@@ -26,19 +26,6 @@
-
-
- 1
- 2
- 3
- 4
- 6
-
-
- 1
- 2
- 3
-
@@ -47,7 +34,6 @@
- Items per row
diff --git a/addons/website/views/snippets/s_dynamic_snippet_carousel.xml b/addons/website/views/snippets/s_dynamic_snippet_carousel.xml
index b7042e3cebe..289d807a1f8 100644
--- a/addons/website/views/snippets/s_dynamic_snippet_carousel.xml
+++ b/addons/website/views/snippets/s_dynamic_snippet_carousel.xml
@@ -9,7 +9,6 @@
- Items per slide
diff --git a/addons/website_blog/static/src/snippets/s_blog_posts/options.js b/addons/website_blog/static/src/snippets/s_blog_posts/options.js
index 00c82c8fd79..41e5c5c9e95 100644
--- a/addons/website_blog/static/src/snippets/s_blog_posts/options.js
+++ b/addons/website_blog/static/src/snippets/s_blog_posts/options.js
@@ -78,7 +78,6 @@ const dynamicSnippetBlogPostsOptions = dynamicSnippetOptions.extend({
* @private
*/
_setOptionsDefaultValues: function () {
- this._setOptionValue('numberOfElements', 3);
this._setOptionValue('filterByBlogId', -1);
this._super.apply(this, arguments);
},
diff --git a/addons/website_blog/views/snippets/s_blog_posts.xml b/addons/website_blog/views/snippets/s_blog_posts.xml
index d3c58e7e742..d6364c9d926 100644
--- a/addons/website_blog/views/snippets/s_blog_posts.xml
+++ b/addons/website_blog/views/snippets/s_blog_posts.xml
@@ -11,7 +11,7 @@
-