[FIX] website_event: put foreach before list-item nodes

Prior to this commit, the position of the `<li>` and `t-foreach` was not
correct.
They needed to be swapped, because we had single `<li>` with multiples
`<a>` inside, instead of multiples `<li>` with a single `<a>`.

task-3626957

Part-of: odoo/odoo#145064
This commit is contained in:
Morgane (morm)
2024-01-25 13:42:40 +00:00
parent 789c61a45a
commit b2195a11e9
@@ -99,15 +99,14 @@
<div t-attf-class="o_wevent_offcanvas_cat_#{category.name} accordion-collapse collapse">
<div class="accordion-body pt-0">
<ul class="list-group list-group-flush">
<li t-if="category.is_published and category.tag_ids and any(tag.color for tag in category.tag_ids)" class="list-group-item">
<t t-foreach="category.tag_ids" t-as="tag">
<a t-if="tag.color"
t-att-href="'/event?%s' % keep_query('*', tags=str((search_tags - tag).ids if tag in search_tags else (tag | search_tags).ids))"
<t t-if="category.is_published and category.tag_ids and any(tag.color for tag in category.tag_ids)" t-foreach="category.tag_ids" t-as="tag">
<li t-if="tag.color" class="list-group-item border-0 px-0">
<a t-att-href="'/event?%s' % keep_query('*', tags=str((search_tags - tag).ids if tag in search_tags else (tag | search_tags).ids))"
t-attf-class="dropdown-item d-flex align-items-center justify-content-between #{'active' if tag in search_tags else ''}">
<t t-out="tag.name"/>
</a>
</t>
</li>
</li>
</t>
</ul>
</div>
</div>
@@ -166,23 +165,21 @@
</button>
</h2>
<div id="o_wevent_offcanvas_date" class="o_wevent_offcanvas_date accordion-collapse collapse" aria-labelledby="offcanvas_date">
<div class="accordion-body pt-0">
<ul class="list-group list-group-flush">
<li class="list-group-item">
<div class="accordion-body pt-0">
<ul class="list-group list-group-flush">
<t t-foreach="dates" t-as="date">
<t t-if="date[3] or (date[0] in ('old','upcoming','all'))">
<li t-if="date[3] or (date[0] in ('old','upcoming','all'))" class="list-group-item px-0 border-0">
<t t-set="is_active" t-value="searches.get('date') == date[0]"/>
<a role="button" t-att-href="keep('/event', date=date[0])" t-attf-class="dropdown-item d-flex align-items-center justify-content-between #{is_active and 'active'}">
<a t-att-href="keep('/event', date=date[0])" t-attf-class="dropdown-item d-flex align-items-center justify-content-between #{is_active and 'active'}">
<t t-out="date[1]"/>
<span t-if="date[3]" t-out="date[3]" t-attf-class="badge rounded-pill #{is_active and 'text-bg-light' or 'text-bg-primary'}"/>
</a>
</t>
</li>
</t>
</li>
</ul>
</ul>
</div>
</div>
</div>
</div>
</xpath>
</template>
@@ -229,22 +226,20 @@
<div id="o_wevent_offcanvas_country" class="o_wevent_offcanvas_country accordion-collapse collapse" aria-labelledby="offcanvas_country">
<div class="accordion-body pt-0">
<ul class="list-group list-group-flush">
<li class="list-group-item">
<t t-foreach="countries" t-as="country">
<t t-if="country['country_id']">
<t t-set="is_active" t-value="searches.get('country') == str(country['country_id'] and country['country_id'][0])"/>
<a t-att-href="keep('/event', country=country['country_id'][0])" t-attf-class="dropdown-item d-flex align-items-center justify-content-between #{is_active and 'active'}">
<t t-out="country['country_id'][1]"/>
<span t-out="country['country_id_count']" t-attf-class="badge rounded-pill ms-auto #{is_active and 'text-bg-light' or 'text-bg-primary'}"/>
</a>
</t>
<t t-else="">
<t t-set="is_active" t-value="searches.get('country') == 'online'"/>
<a t-att-href="keep('/event', country='online')" t-attf-class="dropdown-item d-flex align-items-center justify-content-between #{is_active and 'active'}">
<span>Online Events</span>
<span t-out="country['country_id_count']" t-attf-class="badge rounded-pill ms-auto #{is_active and 'text-bg-light' or 'text-bg-primary'}"/>
</a>
</t>
<li t-foreach="countries" t-as="country" class="list-group-item px-0 border-0">
<t t-if="country['country_id']">
<t t-set="is_active" t-value="searches.get('country') == str(country['country_id'] and country['country_id'][0])"/>
<a t-att-href="keep('/event', country=country['country_id'][0])" t-attf-class="dropdown-item d-flex align-items-center justify-content-between #{is_active and 'active'}">
<t t-out="country['country_id'][1]"/>
<span t-out="country['country_id_count']" t-attf-class="badge rounded-pill ms-auto #{is_active and 'text-bg-light' or 'text-bg-primary'}"/>
</a>
</t>
<t t-else="">
<t t-set="is_active" t-value="searches.get('country') == 'online'"/>
<a t-att-href="keep('/event', country='online')" t-attf-class="dropdown-item d-flex align-items-center justify-content-between #{is_active and 'active'}">
<span>Online Events</span>
<span t-out="country['country_id_count']" t-attf-class="badge rounded-pill ms-auto #{is_active and 'text-bg-light' or 'text-bg-primary'}"/>
</a>
</t>
</li>
</ul>