summaryrefslogtreecommitdiff
path: root/addons/website/static/src/snippets/s_dynamic_snippet/000.xml
diff options
context:
space:
mode:
authorLaurent Stukkens (LTU) <ltu@odoo.com>2020-06-17 14:48:40 +0000
committerLaurent Stukkens (LTU) <ltu@odoo.com>2020-08-18 17:40:25 +0000
commit0e7640b5f22d2bea04bbe22d3189cff7e03af545 (patch)
treeb5c388d2bd5ab95239edba0547c44371afda1ff7 /addons/website/static/src/snippets/s_dynamic_snippet/000.xml
parent8b6985eeed0a15ec673d96299b3ed331c684e62d (diff)
[IMP] website, website_sale: add dynamic snippets
* Implement new snippets that allow the user to choose a filter and a template. Three snippets have been created: - Dynamic Snippet: Displays the data in a grid format - Dynamic Carousel: Displays the date in a carousel - Dynamic Products: Let the user pick a product category and displays the products in a carousel task-2276740 PR #53175 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Diffstat (limited to 'addons/website/static/src/snippets/s_dynamic_snippet/000.xml')
-rw-r--r--addons/website/static/src/snippets/s_dynamic_snippet/000.xml20
1 files changed, 20 insertions, 0 deletions
diff --git a/addons/website/static/src/snippets/s_dynamic_snippet/000.xml b/addons/website/static/src/snippets/s_dynamic_snippet/000.xml
new file mode 100644
index 00000000000..105078e087f
--- /dev/null
+++ b/addons/website/static/src/snippets/s_dynamic_snippet/000.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<templates xml:space="preserve">
+ <t t-name="website.s_dynamic_snippet.grid">
+ <!-- Content -->
+ <t t-set="colClass" t-value="'col-' + (12 / chunkSize).toString()"/>
+ <t t-set="rowIndexGenerator" t-value="Array.from(Array(Math.ceil(data.length/chunkSize)).keys())"/>
+ <t t-set="colIndexGenerator" t-value="Array.from(Array(chunkSize).keys())"/>
+ <t t-foreach="rowIndexGenerator" t-as="rowIndex">
+ <div class="row my-4">
+ <t t-foreach="colIndexGenerator" t-as="colIndex">
+ <t t-if="(rowIndex * chunkSize + colIndex) &lt; data.length">
+ <div t-attf-class="#{colClass}">
+ <t t-raw="data[rowIndex * chunkSize + colIndex]"/>
+ </div>
+ </t>
+ </t>
+ </div>
+ </t>
+ </t>
+</templates>