helpdesk_rating_five_stars/static/src/xml/rating_stars.xml

39 lines
1.5 KiB
XML
Executable File

<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<!-- Star Rating Component Template -->
<t t-name="helpdesk_rating_five_stars.RatingStars">
<div
class="rating-stars-container"
t-att-class="sizeClass"
t-on-mouseleave="onStarLeave"
t-on-keydown="onKeyDown"
t-on-focus="onFocus"
t-on-blur="onBlur"
t-att-tabindex="props.readonly ? -1 : 0"
role="slider"
t-att-aria-label="'Rating: ' + state.selectedValue + ' out of ' + maxStars + ' stars'"
t-att-aria-valuemin="1"
t-att-aria-valuemax="maxStars"
t-att-aria-valuenow="state.selectedValue"
t-att-aria-readonly="props.readonly"
>
<t t-foreach="stars" t-as="star" t-key="star">
<span
t-att-class="getStarClass(star)"
t-on-mouseenter="() => this.onStarHover(star)"
t-on-click="() => this.onStarClick(star)"
t-att-aria-label="getAriaLabel(star)"
t-att-data-star="star"
role="button"
t-att-tabindex="-1"
>
<!-- Filled star icon -->
<t t-if="isStarFilled(star)"></t>
<!-- Empty star icon -->
<t t-else=""></t>
</span>
</t>
</div>
</t>
</templates>