[IMP] website: display sample data for dynamic snippets

Before this commit when a dynamic snippet was fully configured but
returned no data, the rendered section remained empty in edit mode.

After this commit when a dynamic snippet is fully configured but has no
data to display, some sample data is generated in edit mode to give a
feel of how the page will look like when data will be available.

task-2446024
https://github.com/odoo/odoo/pull/65176
This commit is contained in:
Benoit Socias
2021-02-16 10:17:58 +00:00
parent f379e2e373
commit 0cede3fa14
5 changed files with 135 additions and 5 deletions
+2
View File
@@ -727,6 +727,7 @@
<t t-set="fields" t-value="list(record['fields'].values())"/>
<t t-set="fieldsImg" t-value="list(record['image_fields'].values())"/>
<div class="card h-100" t-att-data-url="record['fields']['call_to_action_url']">
<h4 t-if="is_sample" class="o_ribbon_right bg-warning text-uppercase">Sample</h4>
<img t-if="len(fieldsImg) > 0" class="card-img-top p-3" loading="lazy" t-att-src="fieldsImg[0]"/>
<div class="card-body">
<h5 t-if="len(fields) > 0" class="card-title">
@@ -752,6 +753,7 @@
<t t-set="fields" t-value="list(record['fields'].values())"/>
<t t-set="fieldsImg" t-value="list(record['image_fields'].values())"/>
<div class="card h-100" t-att-data-url="record['fields']['call_to_action_url']">
<h4 t-if="is_sample" class="o_ribbon_right bg-warning text-uppercase">Sample</h4>
<h5 t-if="len(fields) > 0" class="card-header">
<t t-raw="fields[0]"/>
</h5>