[FIX] website: disable preview on dynamic snippet filter selection
Before this commit filter selection on the dynamic snippet did trigger the rendering of a preview. This sometimes caused a blocking loader to appear when the filter selection triggered the replacement of the list of available templates. After this commit selecting a filter does not trigger a preview rendering anymore. Also the condition for making the warning message appear is now about the selected template being in the list of available templates. https://github.com/odoo/odoo/pull/68529
This commit is contained in:
@@ -74,10 +74,10 @@ const dynamicSnippetOptions = options.Class.extend({
|
||||
*/
|
||||
_refreshPublicWidgets: function () {
|
||||
return this._super.apply(this, arguments).then(() => {
|
||||
const templateKeys = this.$el ? this.$el.find("we-select[data-attribute-name='templateKey'] we-selection-items we-button") : [];
|
||||
const selectedTemplateId = this.$target.get(0).dataset['templateKey'];
|
||||
this.$target.find('.missing_option_warning').toggleClass(
|
||||
'd-none',
|
||||
templateKeys.length > 0
|
||||
!!this.dynamicFilterTemplates[selectedTemplateId]
|
||||
);
|
||||
});
|
||||
},
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
</template>
|
||||
<template id="website.s_dynamic_snippet_options_template">
|
||||
<div t-attf-data-js="#{snippet_name}" t-attf-data-selector="#{snippet_selector}" data-no-preview="true">
|
||||
<we-select string="Filter" data-name="filter_opt" data-attribute-name="filterId">
|
||||
<we-select string="Filter" data-name="filter_opt" data-attribute-name="filterId" data-no-preview="true">
|
||||
</we-select>
|
||||
<we-select string="Template" data-name="template_opt" data-attribute-name="templateKey" data-no-preview="true">
|
||||
</we-select>
|
||||
|
||||
Reference in New Issue
Block a user