refactor: extract category change handler and add touchmove event to product cards
This commit is contained in:
parent
0f231e9d20
commit
277d740996
@ -33,5 +33,10 @@ patch(CategorySelector.prototype, {
|
||||
traverse(root, 0);
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
onChangeCategory(ev) {
|
||||
const val = ev.target.value;
|
||||
this.pos.setSelectedCategory(val ? parseInt(val, 10) : 0);
|
||||
}
|
||||
});
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
<xpath expr="//div[contains(@t-attf-class, 'category-list')]" position="replace">
|
||||
<div t-if="portraitMode.isPortrait" class="portrait-category-dropdown p-2 bg-view border-bottom w-100">
|
||||
<select class="form-select form-select-lg w-100 bg-light border-0 rounded-3 text-dark fw-bold"
|
||||
t-on-change="(ev) => this.pos.setSelectedCategory(ev.target.value ? parseInt(ev.target.value) : 0)">
|
||||
t-on-change="onChangeCategory">
|
||||
<option value="0" t-att-selected="!this.pos.selectedCategory">All Categories</option>
|
||||
<t t-foreach="allCategoriesTree" t-as="cat" t-key="cat.id">
|
||||
<option t-att-value="cat.id" t-att-selected="this.pos.selectedCategory?.id === cat.id">
|
||||
|
||||
@ -4,5 +4,8 @@
|
||||
<xpath expr="//div[@t-foreach='pos.productToDisplayByCateg']" position="attributes">
|
||||
<attribute name="t-foreach">productToDisplayByCategLimited</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//ProductCard" position="attributes">
|
||||
<attribute name="t-on-touchmove">longPressHandlers.onTouchEnd</attribute>
|
||||
</xpath>
|
||||
</t>
|
||||
</templates>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user