Skip to content

Commit e7cb811

Browse files
edi-odooAntoineVDV
authored andcommitted
[IMP] odoo_theme: revamp side menu to add overlay
task-2800937 X-original-commit: 4ed8c22
1 parent 0138a08 commit e7cb811

File tree

2 files changed

+47
-30
lines changed

2 files changed

+47
-30
lines changed

extensions/odoo_theme/layout.html

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,18 @@
6262
</nav>
6363
</noscript>
6464
{# Shown when the JS has properly set all the classes on the TOC elements #}
65-
<nav id="o_menu" class="o_side_nav border-end">
66-
{%- if 'hide-page-toc' not in meta %}
67-
{# Shown when the JS has properly set all the classes on the TOC elements #}
68-
<aside id="o_page_toc_in_nav" class="o_page_toc o_in_nav_toc border-bottom pt-3 pb-3" hidden>
69-
{%- include "layout_templates/page_toc.html" %}
70-
</aside>
71-
{%- endif %}
72-
<div id="o_main_toctree" class="o_main_toc mt-3" hidden>
73-
{%- include "layout_templates/menu.html" %}
65+
<nav id="o_menu" class="o_side_nav">
66+
<div class="o_mobile-overlay" data-bs-toggle="collapse" data-bs-target="#o_menu"></div>
67+
<div class="o_side_nav-inner border-end">
68+
{%- if 'hide-page-toc' not in meta %}
69+
{# Shown when the JS has properly set all the classes on the TOC elements #}
70+
<aside id="o_page_toc_in_nav" class="o_page_toc o_in_nav_toc border-bottom pt-3 pb-3" hidden>
71+
{%- include "layout_templates/page_toc.html" %}
72+
</aside>
73+
{%- endif %}
74+
<div id="o_main_toctree" class="o_main_toc mt-3" hidden>
75+
{%- include "layout_templates/menu.html" %}
76+
</div>
7477
</div>
7578
</nav>
7679
<header class="o_headers">

extensions/odoo_theme/static/style.scss

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ div[aria-label="related navigation"] {
1111
}
1212

1313
body {
14+
position: relative;
1415
a:not(:hover), a.o_logo {
1516
text-decoration: none !important;
1617
}
@@ -178,31 +179,44 @@ header {
178179

179180
.o_side_nav {
180181
width: 100%;
181-
height: calc(100% - (#{$o-headers-mobile-height});
182-
overflow-y: auto;
183-
position: fixed;
184-
top: $o-headers-mobile-height;
185-
left: -100%;
186-
@include o-transition(all, .3s);
187-
padding-left: $padding-s;
188-
background-color: lighten($o-violet-dark, 70%) ;
189-
z-index: 10;
190-
@include font-size($font-size-secondary);
191-
color: $o-violet-dark;
192-
font-weight: $fw_regular;
193-
@include media-breakpoint-up(lg) {
194-
width: calc(#{$o-side-nav-width} - 1rem);
195-
height: calc(100vh - #{$o-headers-height});
196-
left: 0;
197-
padding-top: $padding-m;
198-
padding-left: $padding-m;
182+
.o_mobile-overlay {
183+
background-color: rgba(0,0,0,.3);
184+
@include o-position-absolute($top: 0, $bottom: 0, $left: 0, $right:0);
185+
opacity: 0;
186+
transition: opacity .2s linear;
187+
z-index: -100;
199188
}
200-
@include media-breakpoint-up(xl) {
201-
width: $o-side-nav-width;
189+
.o_side_nav-inner {
190+
width: 90%;
191+
height: calc(100% - (#{$o-headers-mobile-height});
192+
overflow-y: auto;
193+
position: fixed;
194+
left: -100%;
195+
@include o-transition(all, .3s);
196+
padding-left: $padding-s;
197+
background-color: lighten($o-violet-dark, 70%) ;
198+
z-index: 10;
199+
@include font-size($font-size-secondary);
200+
color: $o-violet-dark;
201+
font-weight: $fw_regular;
202+
@include media-breakpoint-up(lg) {
203+
width: $o-side-nav-width;
204+
height: calc(100vh - (#{$o-headers-height}));
205+
left: 0;
206+
padding-top: $padding-m;
207+
padding-left: $padding-m;
208+
}
202209
}
203210
204211
&.show {
205-
left: 0;
212+
.o_mobile-overlay {
213+
opacity: 1;
214+
z-index: 1;
215+
}
216+
217+
.o_side_nav-inner {
218+
left: 0;
219+
}
206220
}
207221
208222
.toctree-l1 {

0 commit comments

Comments
 (0)