[REF] hr_contract, web: give tooltip info as t-call-context
Previously, we would use t-set to add the tooltip info under the key "info" in the rendering context, while this works fine, it was mostly just a workaround for the lack of support in owl for passing a rendering context to be used by the t-call directly. Since this is now supported in owl, the commit uses this feature for the tooltips and adapts the call sites. Part-of: odoo/odoo#92475
This commit is contained in:
committed by
Aaron Bohy
parent
be8472c851
commit
a7be88cd91
@@ -3,7 +3,7 @@
|
||||
<t t-name="hr_contract.CalendarMismatch" owl="1">
|
||||
<div class="o-tooltip px-1 py-2">
|
||||
<p style="font-size: 12px;" class="text-danger"
|
||||
t-esc="info.text"/>
|
||||
t-esc="text"/>
|
||||
</div>
|
||||
</t>
|
||||
</templates>
|
||||
|
||||
@@ -3,9 +3,7 @@
|
||||
|
||||
<t t-name="web.Tooltip" owl="1">
|
||||
<div class="o-tooltip px-2 py-1">
|
||||
<t t-if="props.template" t-call="{{props.template}}">
|
||||
<t t-set="info" t-value="props.info"/>
|
||||
</t>
|
||||
<t t-if="props.template" t-call="{{props.template}}" t-call-context="props.info"/>
|
||||
<small t-else="" t-esc="props.tooltip"/>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
@@ -3,63 +3,63 @@
|
||||
|
||||
<t t-name="web.FieldTooltip" owl="1">
|
||||
|
||||
<div t-if="info.field.label" class="o-tooltip--string" role="tooltip">
|
||||
<t t-esc="info.field.label"/> <t t-if="info.field.noLabel and info.viewMode === 'form'">(nolabel)</t>
|
||||
<div t-if="field.label" class="o-tooltip--string" role="tooltip">
|
||||
<t t-esc="field.label"/> <t t-if="field.noLabel and viewMode === 'form'">(nolabel)</t>
|
||||
</div>
|
||||
|
||||
<p t-if="info.field.help" class="o-tooltip--help" role="tooltip">
|
||||
<t t-esc="info.field.help"/>
|
||||
<p t-if="field.help" class="o-tooltip--help" role="tooltip">
|
||||
<t t-esc="field.help"/>
|
||||
</p>
|
||||
|
||||
<ul class="o-tooltip--technical" t-if="info.debug" role="tooltip">
|
||||
<li data-item="field" t-if="info.field and info.field.name">
|
||||
<ul class="o-tooltip--technical" t-if="debug" role="tooltip">
|
||||
<li data-item="field" t-if="field and field.name">
|
||||
<span class="o-tooltip--technical--title">Field:</span>
|
||||
<t t-esc="info.field.name"/>
|
||||
<t t-esc="field.name"/>
|
||||
</li>
|
||||
<li data-item="object" t-if="info.resModel">
|
||||
<li data-item="object" t-if="resModel">
|
||||
<span class="o-tooltip--technical--title">Model:</span>
|
||||
<t t-esc="info.resModel"/>
|
||||
<t t-esc="resModel"/>
|
||||
</li>
|
||||
<t t-if="info.field">
|
||||
<li t-if="info.field.type" data-item="type" >
|
||||
<t t-if="field">
|
||||
<li t-if="field.type" data-item="type" >
|
||||
<span class="o-tooltip--technical--title">Type:</span>
|
||||
<t t-esc="info.field.type"/>
|
||||
<t t-esc="field.type"/>
|
||||
</li>
|
||||
<li t-if="info.field.widget" data-item="widget">
|
||||
<li t-if="field.widget" data-item="widget">
|
||||
<span class="o-tooltip--technical--title">Widget:</span>
|
||||
<t t-if="info.field.widgetDescription" t-esc="info.field.widgetDescription"/>
|
||||
<t t-if="info.field.widgetDescription"> (</t>
|
||||
<t t-esc="info.field.widget"/>
|
||||
<t t-if="info.field.widgetDescription">)</t>
|
||||
<t t-if="field.widgetDescription" t-esc="field.widgetDescription"/>
|
||||
<t t-if="field.widgetDescription"> (</t>
|
||||
<t t-esc="field.widget"/>
|
||||
<t t-if="field.widgetDescription">)</t>
|
||||
</li>
|
||||
<li t-if="info.field.context" data-item="context">
|
||||
<li t-if="field.context" data-item="context">
|
||||
<span class="o-tooltip--technical--title">Context:</span>
|
||||
<t t-esc="info.field.context"/>
|
||||
<t t-esc="field.context"/>
|
||||
</li>
|
||||
<li t-if="info.field.domain" data-item="domain">
|
||||
<li t-if="field.domain" data-item="domain">
|
||||
<span class="o-tooltip--technical--title">Domain:</span>
|
||||
<t t-esc="info.field.domain"/>
|
||||
<t t-esc="field.domain"/>
|
||||
</li>
|
||||
<li t-if="info.field.modifiers" data-item="modifiers">
|
||||
<li t-if="field.modifiers" data-item="modifiers">
|
||||
<span class="o-tooltip--technical--title">Modifiers:</span>
|
||||
<t t-esc="info.field.modifiers"/>
|
||||
<t t-esc="field.modifiers"/>
|
||||
</li>
|
||||
<li t-if="info.field.default" data-item="default">
|
||||
<li t-if="field.default" data-item="default">
|
||||
<span class="o-tooltip--technical--title">Default:</span>
|
||||
<t t-esc="info.field.default"/>
|
||||
<t t-esc="field.default"/>
|
||||
</li>
|
||||
<li t-if="info.field.changeDefault" data-item="changeDefault">
|
||||
<li t-if="field.changeDefault" data-item="changeDefault">
|
||||
<span class="o-tooltip--technical--title">Change default:</span>
|
||||
Yes
|
||||
</li>
|
||||
<li t-if="info.field.relation" data-item="relation">
|
||||
<li t-if="field.relation" data-item="relation">
|
||||
<span class="o-tooltip--technical--title">Relation:</span>
|
||||
<t t-esc="info.field.relation"/>
|
||||
<t t-esc="field.relation"/>
|
||||
</li>
|
||||
<li t-if="info.field.selection" data-item="selection">
|
||||
<li t-if="field.selection" data-item="selection">
|
||||
<span class="o-tooltip--technical--title">Selection:</span>
|
||||
<ul class="o-tooltip--technical">
|
||||
<li t-foreach="info.field.selection" t-as="option" t-key="option_index">
|
||||
<li t-foreach="field.selection" t-as="option" t-key="option_index">
|
||||
[<t t-esc="option[0]"/>]
|
||||
<t t-if="option[1]"> - </t>
|
||||
<t t-esc="option[1]"/>
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
<t t-name="web.ImageZoomTooltip" owl="1">
|
||||
<div class="o_image_zoom">
|
||||
<img t-att-src="info.url" />
|
||||
<img t-att-src="url" />
|
||||
</div>
|
||||
</t>
|
||||
|
||||
|
||||
@@ -543,7 +543,7 @@ export class KanbanRenderer extends Component {
|
||||
}
|
||||
return {
|
||||
"data-tooltip-template": "web.KanbanGroupTooltip",
|
||||
"data-tooltip-info": JSON.stringify(group.tooltip),
|
||||
"data-tooltip-info": JSON.stringify({ entries: group.tooltip }),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@
|
||||
|
||||
<t t-name="web.KanbanGroupTooltip" owl="1">
|
||||
<div>
|
||||
<t t-foreach="info" t-as="entry" t-key="entry_index">
|
||||
<t t-foreach="entries" t-as="entry" t-key="entry_index">
|
||||
<t t-esc="entry.title"/>
|
||||
<br/>
|
||||
<t t-esc="entry.value"/>
|
||||
|
||||
@@ -22,50 +22,50 @@
|
||||
</t>
|
||||
|
||||
<t t-name="views.ViewButtonTooltip" owl="1">
|
||||
<t t-if="info.debug || info.button.help">
|
||||
<div class="o-tooltip--string" t-if="info.debug || info.button.string" role="tooltip">
|
||||
<t t-if="info.debug">
|
||||
<t t-if="debug || button.help">
|
||||
<div class="o-tooltip--string" t-if="debug || button.string" role="tooltip">
|
||||
<t t-if="debug">
|
||||
Button
|
||||
<t t-if="info.button.string">: </t>
|
||||
<t t-if="!info.button.string"> (no string)</t>
|
||||
<t t-if="button.string">: </t>
|
||||
<t t-if="!button.string"> (no string)</t>
|
||||
</t>
|
||||
<t t-esc="info.button.string"/>
|
||||
<t t-esc="button.string"/>
|
||||
</div>
|
||||
<p t-if="info.button.title" class="o-tooltip--help" role="tooltip">
|
||||
<t t-esc="info.button.title"/>
|
||||
<p t-if="button.title" class="o-tooltip--help" role="tooltip">
|
||||
<t t-esc="button.title"/>
|
||||
</p>
|
||||
<p t-if="info.button.help" class="o-tooltip--help" role="tooltip">
|
||||
<t t-esc="info.button.help"/>
|
||||
<p t-if="button.help" class="o-tooltip--help" role="tooltip">
|
||||
<t t-esc="button.help"/>
|
||||
</p>
|
||||
<ul t-if="info.debug" class="o-tooltip--technical" role="tooltip">
|
||||
<ul t-if="debug" class="o-tooltip--technical" role="tooltip">
|
||||
<li data-item="object">
|
||||
<span class="o-tooltip--technical--title">Object:</span>
|
||||
<t t-esc="info.model"/>
|
||||
<t t-esc="model"/>
|
||||
</li>
|
||||
<li t-if="info.button.context" data-item="context">
|
||||
<li t-if="button.context" data-item="context">
|
||||
<span class="o-tooltip--technical--title">Context:</span>
|
||||
<t t-esc="info.button.context || info.context"/>
|
||||
<t t-esc="button.context || context"/>
|
||||
</li>
|
||||
<li t-if="info.button.modifiers" data-item="modifiers">
|
||||
<li t-if="button.modifiers" data-item="modifiers">
|
||||
<span class="o-tooltip--technical--title">Modifiers:</span>
|
||||
<t t-esc="info.button.modifiers"/>
|
||||
<t t-esc="button.modifiers"/>
|
||||
</li>
|
||||
<li t-if="info.button.special" data-item="special">
|
||||
<li t-if="button.special" data-item="special">
|
||||
<span class="o-tooltip--technical--title">Special:</span>
|
||||
<t t-esc="info.button.special"/>
|
||||
<t t-esc="button.special"/>
|
||||
</li>
|
||||
<t t-set="button_type" t-value="info.button.type"/>
|
||||
<t t-set="button_type" t-value="button.type"/>
|
||||
<li t-if="button_type" data-item="button_type">
|
||||
<span class="o-tooltip--technical--title">Button Type:</span>
|
||||
<t t-esc="button_type"/>
|
||||
</li>
|
||||
<li t-if="button_type === 'object'" data-item="button_method">
|
||||
<span class="o-tooltip--technical--title">Method:</span>
|
||||
<t t-esc="info.button.name"/>
|
||||
<t t-esc="button.name"/>
|
||||
</li>
|
||||
<li t-if="button_type === 'action'" data-item="button_action">
|
||||
<span class="o-tooltip--technical--title">Action ID:</span>
|
||||
<t t-esc="info.button.name"/>
|
||||
<t t-esc="button.name"/>
|
||||
</li>
|
||||
</ul>
|
||||
</t>
|
||||
|
||||
@@ -151,7 +151,7 @@ QUnit.module("Tooltip service", (hooks) => {
|
||||
await makeParent(MyComponent, { mockSetTimeout, mockSetInterval });
|
||||
|
||||
assert.containsNone(target, ".o_popover_container .o_popover");
|
||||
let [outerSpan, innerSpan] = target.querySelectorAll("span.our_span");
|
||||
const [outerSpan, innerSpan] = target.querySelectorAll("span.our_span");
|
||||
outerSpan.dispatchEvent(new Event("mouseenter"));
|
||||
innerSpan.dispatchEvent(new Event("mouseenter"));
|
||||
await nextTick();
|
||||
@@ -327,8 +327,8 @@ QUnit.module("Tooltip service", (hooks) => {
|
||||
const templates = {
|
||||
my_tooltip_template: `
|
||||
<ul>
|
||||
<li>X: <t t-esc="info.x"/></li>
|
||||
<li>Y: <t t-esc="info.y"/></li>
|
||||
<li>X: <t t-esc="x"/></li>
|
||||
<li>Y: <t t-esc="y"/></li>
|
||||
</ul>
|
||||
`,
|
||||
};
|
||||
|
||||
@@ -7042,7 +7042,7 @@ QUnit.module("Views", (hooks) => {
|
||||
assert.strictEqual(
|
||||
target.querySelector(".o_kanban_group:nth-child(2) .o_kanban_header_title").dataset
|
||||
.tooltipInfo,
|
||||
`[{"title":"Kikou","value":"hello"}]`,
|
||||
`{"entries":[{"title":"Kikou","value":"hello"}]}`,
|
||||
"second column should have a tooltip with the group_by_tooltip title and many2one field value"
|
||||
);
|
||||
assert.strictEqual(
|
||||
|
||||
Reference in New Issue
Block a user