[IMP] hr_org_chart,web: define icon class on i tag for view button icon

Before this commit, the icon of the hierarchy view should be rotate
of 90 deg to have an appropriate icon for the view. The problem is
since the icon class is added on button classes, the button will
also be rotated with the icon instead of just the icon.

This commit defines a `i` tag inside the `button` element to select
the view to be able to apply css rotation only on the icon instead
of the whole button.

task-3376776
This commit is contained in:
Xavier Bol (xbo)
2023-10-16 08:17:31 +02:00
parent e28e1e5b25
commit 1048111a18
4 changed files with 10 additions and 4 deletions
@@ -10,7 +10,7 @@ import { HierarchyRenderer } from "./hierarchy_renderer";
export const hierarchyView = {
type: "hierarchy",
display_name: _t("Hierarchy"),
icon: "fa fa-share-alt",
icon: "fa fa-share-alt o_hierarchy_icon",
isMobileFriendly: false,
multiRecord: true,
ArchParser: HierarchyArchParser,
@@ -0,0 +1,3 @@
.o_control_panel_navigation .o_switch_view .o_hierarchy_icon { // button in view switcher
rotate: 90deg;
}
@@ -61,10 +61,12 @@
<nav class="o_cp_switch_buttons d-print-none d-none d-xl-inline-flex btn-group">
<t t-foreach="env.config.viewSwitcherEntries" t-as="view" t-key="view.type">
<button class="btn btn-secondary o_switch_view "
t-attf-class="o_{{view.type}} {{view.icon}} {{view.active ? 'active' : ''}}"
t-attf-class="o_{{view.type}} {{view.active ? 'active' : ''}}"
t-att-data-tooltip="view.name"
t-on-click="() => this.onViewClicked(view.type)"
/>
>
<i t-att-class="view.icon" />
</button>
</t>
</nav>
</t>
@@ -100,8 +100,9 @@ QUnit.module("Search", (hooks) => {
assert.strictEqual(views[0].getAttribute("data-tooltip"), "List");
assert.hasClass(views[0], "active");
assert.containsOnce(views[0], ".oi-view-list");
assert.strictEqual(views[1].getAttribute("data-tooltip"), "Kanban");
assert.hasClass(views[1], "oi-view-kanban");
assert.containsOnce(views[1], ".oi-view-kanban");
controlPanel.env.services.action.switchView = (viewType) => {
assert.step(viewType);