[FIX] website: dynamic product snippet error on prev/next
The issue occurred after the merge of this PR [1]. In that, we removed the dependency on underscore.js and introduced new functions to the qweb engine: `range` and `uniqueId`. The variable named `uniqueId` was clashing with the qweb function `uniqueId()` that's why variable were getting compiled as a function instead of the actual value, which led to unexpected behaviour. This commit renames the uniqueId variable to avoid conflicts with the qweb function `uniqueId()`. [1]: https://github.com/odoo/odoo/pull/123018 task-3357115 closes odoo/odoo#124659 Signed-off-by: Romain Derie (rde) <rde@odoo.com>
This commit is contained in:
@@ -31,7 +31,7 @@ const DynamicSnippet = publicWidget.Widget.extend({
|
||||
this.data = [];
|
||||
this.renderedContent = '';
|
||||
this.isDesplayedAsMobile = config.device.isMobile;
|
||||
this.uniqueId = uniqueId("s_dynamic_snippet_");
|
||||
this.unique_id = uniqueId("s_dynamic_snippet_");
|
||||
this.template_key = 'website.s_dynamic_snippet.grid';
|
||||
},
|
||||
/**
|
||||
@@ -159,7 +159,7 @@ const DynamicSnippet = publicWidget.Widget.extend({
|
||||
return {
|
||||
chunkSize: chunkSize,
|
||||
data: this.data,
|
||||
uniqueId: this.uniqueId,
|
||||
unique_id: this.unique_id,
|
||||
extraClasses: dataset.extraClasses || '',
|
||||
};
|
||||
},
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates xml:space="preserve">
|
||||
<t t-name="website.s_dynamic_snippet.carousel.arrows">
|
||||
<a t-attf-href="##{uniqueId}" class="carousel-control-prev" data-bs-slide="prev" role="button" aria-label="Previous" title="Previous">
|
||||
<a t-attf-href="##{unique_id}" class="carousel-control-prev" data-bs-slide="prev" role="button" aria-label="Previous" title="Previous">
|
||||
<span class="fa fa-chevron-circle-left fa-2x"/>
|
||||
<span class="visually-hidden">Previous</span>
|
||||
</a>
|
||||
<a t-attf-href="##{uniqueId}" class="carousel-control-next" data-bs-slide="next" role="button" aria-label="Next" title="Next">
|
||||
<a t-attf-href="##{unique_id}" class="carousel-control-next" data-bs-slide="next" role="button" aria-label="Next" title="Next">
|
||||
<span class="fa fa-chevron-circle-right fa-2x"/>
|
||||
<span class="visually-hidden">Next</span>
|
||||
</a>
|
||||
</t>
|
||||
<t t-name="website.s_dynamic_snippet.carousel">
|
||||
<div t-att-id="uniqueId" class="carousel slide" t-att-data-bs-interval="interval" data-bs-ride="carousel">
|
||||
<div t-att-id="unique_id" class="carousel slide" t-att-data-bs-interval="interval" data-bs-ride="carousel">
|
||||
<!-- Content -->
|
||||
<t t-set="rowSize" t-value="chunkSize" />
|
||||
<t t-set="slideSize" t-value="rowSize * rowPerSlide" />
|
||||
@@ -46,13 +46,13 @@
|
||||
<t t-if="arrowPosition === 'bottom'">
|
||||
<div class="s_dynamic_snippet_arrow_bottom pt-2 d-flex justify-content-center">
|
||||
<t t-call="website.s_dynamic_snippet.carousel.arrows">
|
||||
<t t-set="uniqueId" t-value="uniqueId" />
|
||||
<t t-set="unique_id" t-value="unique_id" />
|
||||
</t>
|
||||
</div>
|
||||
</t>
|
||||
<t t-else="">
|
||||
<t t-call="website.s_dynamic_snippet.carousel.arrows">
|
||||
<t t-set="uniqueId" t-value="uniqueId" />
|
||||
<t t-set="unique_id" t-value="unique_id" />
|
||||
</t>
|
||||
</t>
|
||||
</t>
|
||||
|
||||
Reference in New Issue
Block a user