[IMP] web: add displayText option to tags_list

In addition to the `displayBadge` option which is already present this
commit adds a new option `displayText` which dictates whether we want
any text at all on our tags list.
This is useful for kanban view where we only want to display the avatar.

X-original-commit: 7930865f0514092960acb0f76532e794f35882a3
Part-of: odoo/odoo#100764
This commit is contained in:
William Braeckman
2022-09-22 12:23:27 +02:00
parent d2dd9a2f45
commit 7909827571
2 changed files with 4 additions and 2 deletions
@@ -28,10 +28,12 @@ TagsList.template = "web.TagsList";
TagsList.defaultProps = {
className: "",
displayBadge: true,
displayText: true,
};
TagsList.props = {
className: { type: String, optional: true },
displayBadge: { type: Boolean, optional: true },
displayText: { type: Boolean, optional: true },
name: { type: String, optional: true },
itemsVisible: { type: Number, optional: true },
tags: { type: Object, optional: true },
@@ -5,8 +5,8 @@
<t t-foreach="visibleTags" t-as="tag" t-key="tag.id or tag_index">
<span t-attf-class="{{`o_tag_color_${ tag.colorIndex or 0 } ${props.displayBadge ? 'badge rounded-pill' : ''}`}} o_tag d-inline-flex align-items-center h-100" tabindex="-1" t-att-data-color="tag.colorIndex" t-att-title="tag.text" t-on-click="(ev) => tag.onClick and tag.onClick(ev)" t-on-keydown="tag.onKeydown">
<img t-if="tag.img" t-att-src="tag.img" class="o_m2m_avatar rounded-circle" t-att-class="tag.className"/>
<div t-if="props.displayBadge" class="o_tag_badge_text" t-esc="tag.text" />
<t t-else="">
<div t-if="props.displayBadge and props.displayText" class="o_tag_badge_text" t-esc="tag.text" />
<t t-elif="props.displayText">
<span />
<div t-esc="tag.text" />
</t>