[FIX] website_rating: display correct title and tooltip on star

Title and tooltip had no sense since every star would have its own tooltip
"One star" instead of having a single tooltip on the whole star container which
could show the exact rating "5 stars on 5".

Plus, one of the title were set on a t-foreach which does nothing.

Closes #51743
task-2369420

closes odoo/odoo#61673

X-original-commit: 6ef7d6fd8474cbf9685bf8e8c3520233c1403cfd
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Signed-off-by: Romain Derie <rdeodoo@users.noreply.github.com>
This commit is contained in:
Romain Derie
2020-11-12 13:18:30 +00:00
parent dcf3519a64
commit 262db6079c
@@ -4,15 +4,15 @@
<t t-set="val_integer" t-value="Math.floor(val)"/>
<t t-set="val_decimal" t-value="val - val_integer"/>
<t t-set="empty_star" t-value="5 - (val_integer+Math.ceil(val_decimal))"/>
<div class="o_website_rating_static" t-att-style="inline_mode ? 'display:inline' : ''">
<div class="o_website_rating_static" t-att-style="inline_mode ? 'display:inline' : ''" t-attf-aria-label="#{val} stars on 5" t-attf-title="#{val} stars on 5">
<t t-foreach="_.range(0, val_integer)" t-as="num">
<i class="fa fa-star" role="img" aria-label="One star" title="One star"></i>
<i class="fa fa-star" role="img"></i>
</t>
<t t-if="val_decimal">
<i class="fa fa-star-half-o" role="img" aria-label="Half a star" title="Half a star"></i>
<i class="fa fa-star-half-o" role="img"></i>
</t>
<t t-foreach="_.range(0, empty_star)" t-as="num" role="img" t-attf-aria-label="#{empty_star} on 5" t-attf-title="#{empty_star} on 5">
<i class="fa fa-star text-black-25"></i>
<t t-foreach="_.range(0, empty_star)" t-as="num">
<i class="fa fa-star text-black-25" role="img"></i>
</t>
</div>
</t>