[IMP] web: improve notebook

to allow for easier overriding
related to odoo/enterprise/#35426

task-3111695

closes odoo/odoo#109594

X-original-commit: 2ad805d5a88a510844fc398d089b3e3c46e5cb9d
Related: odoo/enterprise#35641
Signed-off-by: Laurent Smet <las@odoo.com>
Signed-off-by: Ayob Habib (ayh) <ayh@odoo.com>
This commit is contained in:
Laurent Smet
2023-01-11 13:20:53 +01:00
committed by Habib (ayh)
parent 0cdf410a44
commit 7a8a712a34
2 changed files with 5 additions and 1 deletions
@@ -108,6 +108,10 @@ export class Notebook extends Component {
}
}
activatePage(pageIndex) {
this.state.currentPage = pageIndex;
}
computePages(props) {
if (!props.slots && !props.pages) {
return [];
@@ -6,7 +6,7 @@
<div class="o_notebook_headers" t-att-class="{ 'm-0': props.orientation === 'vertical' }">
<ul t-attf-class="nav nav-tabs {{ props.orientation === 'horizontal' ? 'flex-row flex-nowrap' : 'flex-column p-0' }}">
<li t-foreach="navItems" t-as="navItem" t-key="navItem[0]" class="nav-item flex-nowrap cursor-pointer" t-if="navItem[1].isVisible">
<a class="nav-link" t-attf-class="{{ navItem[0] === state.currentPage ? 'active' : '' }} {{ props.orientation === 'vertical' ? 'p-3 rounded-0' : '' }} {{ navItem[1].className }}" t-att-name="navItem[1].name" t-on-click.prevent="() => state.currentPage = navItem[0]" href="#" role="tab" tabindex="-1" t-esc="navItem[1].title"/>
<a class="nav-link" t-attf-class="{{ navItem[0] === state.currentPage ? 'active' : '' }} {{ props.orientation === 'vertical' ? 'p-3 rounded-0' : '' }} {{ navItem[1].className }}" t-att-name="navItem[1].name" t-on-click.prevent="() => this.activatePage(navItem[0])" href="#" role="tab" tabindex="-1" t-esc="navItem[1].title"/>
</li>
</ul>
</div>