[REM] web: Remove preview of avatar in sidebar filter in calendar view
Spec: Completely remove the avatar preview from the calendar sidebar. Purpose: The zoom on the employee's picture is not very smooth and can make an ugly scroll appear while it is being displayed. It brings little value and adds a lot of edge cases regarding sizing, positioning, etc. closes odoo/odoo#106887 Task: https://www.odoo.com/mail/view?model=project.task&res_id=2519822&access_token=44b0ba1f-a0c4-43b6-910f-eab462e7a320 Signed-off-by: Luca Vitali <luvi@odoo.com>
This commit is contained in:
@@ -10,9 +10,6 @@ import { SelectCreateDialog } from "@web/views/view_dialogs/select_create_dialog
|
||||
|
||||
import { Component, useState } from "@odoo/owl";
|
||||
|
||||
class CalendarFilterTooltip extends Component {}
|
||||
CalendarFilterTooltip.template = "web.CalendarFilterPanel.tooltip";
|
||||
|
||||
let nextId = 1;
|
||||
|
||||
export class CalendarFilterPanel extends Component {
|
||||
@@ -24,7 +21,6 @@ export class CalendarFilterPanel extends Component {
|
||||
this.addDialog = useOwnedDialogs();
|
||||
this.orm = useService("orm");
|
||||
this.popover = usePopover();
|
||||
this.removePopover = null;
|
||||
}
|
||||
|
||||
getAutoCompleteProps(section) {
|
||||
@@ -155,13 +151,6 @@ export class CalendarFilterPanel extends Component {
|
||||
return this.state.collapsed[section.fieldName] || false;
|
||||
}
|
||||
|
||||
closeTooltip() {
|
||||
if (this.removePopover) {
|
||||
this.removePopover();
|
||||
this.removePopover = null;
|
||||
}
|
||||
}
|
||||
|
||||
onFilterInputChange(section, filter, ev) {
|
||||
this.props.model.updateFilters(section.fieldName, {
|
||||
[filter.value]: ev.target.checked,
|
||||
@@ -178,28 +167,6 @@ export class CalendarFilterPanel extends Component {
|
||||
this.props.model.updateFilters(section.fieldName, filters);
|
||||
}
|
||||
|
||||
onFilterMouseEnter(section, filter, ev) {
|
||||
this.closeTooltip();
|
||||
if (!section.hasAvatar || !filter.hasAvatar) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.removePopover = this.popover.add(
|
||||
ev.currentTarget,
|
||||
CalendarFilterTooltip,
|
||||
{ section, filter },
|
||||
{
|
||||
closeOnClickAway: false,
|
||||
popoverClass: "o-calendar-filter--tooltip",
|
||||
position: "top",
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
onFilterMouseLeave() {
|
||||
this.closeTooltip();
|
||||
}
|
||||
|
||||
onFilterRemoveBtnClick(section, filter) {
|
||||
this.props.model.unlinkFilter(section.fieldName, filter.recordId);
|
||||
}
|
||||
|
||||
@@ -73,8 +73,6 @@
|
||||
class="o_calendar_filter_item w-100 position-relative mb-2"
|
||||
t-att-class="filter.colorIndex !== null ? 'o_cw_filter_color_' + filter.colorIndex : ''"
|
||||
t-att-data-value="filter.value"
|
||||
t-on-mouseenter="(ev) => this.onFilterMouseEnter(section, filter, ev)"
|
||||
t-on-mouseleave="() => this.onFilterMouseLeave(section, filter)"
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
@@ -128,19 +126,4 @@
|
||||
</div>
|
||||
</t>
|
||||
|
||||
<t t-name="web.CalendarFilterPanel.tooltip" owl="1">
|
||||
<div class="card">
|
||||
<h6
|
||||
class="text-center card-header"
|
||||
t-esc="props.filter.label"
|
||||
/>
|
||||
<div class="card-body">
|
||||
<img
|
||||
t-attf-src="/web/image/{{ props.section.avatar.model }}/{{ props.filter.value }}/{{ props.section.avatar.field }}"
|
||||
class="mx-auto"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
</templates>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { CalendarFilterPanel } from "@web/views/calendar/filter_panel/calendar_filter_panel";
|
||||
import { click, getFixture, triggerEvent } from "../../helpers/utils";
|
||||
import { click, getFixture } from "../../helpers/utils";
|
||||
import { makeEnv, makeFakeModel, mountComponent } from "./helpers";
|
||||
|
||||
let target;
|
||||
@@ -178,36 +178,4 @@ QUnit.module("CalendarView - FilterPanel", ({ beforeEach }) => {
|
||||
"partner_ids all false",
|
||||
]);
|
||||
});
|
||||
|
||||
QUnit.test("hover filter opens tooltip", async (assert) => {
|
||||
await start({
|
||||
services: {
|
||||
popover: {
|
||||
start: () => ({
|
||||
add: (target, _, props) => {
|
||||
assert.step(props.filter.label);
|
||||
assert.step("" + props.filter.hasAvatar);
|
||||
assert.step("" + props.filter.value);
|
||||
return () => {
|
||||
assert.step("popOver Closed");
|
||||
};
|
||||
},
|
||||
}),
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const section = target.querySelectorAll(".o_calendar_filter")[0];
|
||||
const filters = section.querySelectorAll(".o_calendar_filter_item");
|
||||
|
||||
await triggerEvent(filters[0], null, "mouseenter");
|
||||
assert.verifySteps(["Mitchell Admin", "true", "3"]);
|
||||
await triggerEvent(filters[0], null, "mouseleave");
|
||||
assert.verifySteps(["popOver Closed"]);
|
||||
|
||||
await triggerEvent(filters[3], null, "mouseenter");
|
||||
assert.verifySteps([]);
|
||||
await triggerEvent(filters[3], null, "mouseleave");
|
||||
assert.verifySteps([]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user