From 58c5ff1d4f64f16d43106e6b00f0b94fe63506c2 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Wed, 24 Feb 2016 13:15:19 +0100 Subject: [PATCH] [REF] website*: frontend user navbar * Remove use of bootstrap navbar * Add navbar.less file for compatibility with enterprise * Modify the location of the "new page/product/..." elements --- .../mail/static/src/less/client_action.less | 9 - addons/web/static/src/less/navbar.less | 174 +++++++++++++ addons/web/views/webclient_templates.xml | 2 + .../website/views/website_backend_navbar.xml | 239 +++++++----------- .../views/website_blog_templates.xml | 4 +- addons/website_event/views/website_event.xml | 4 +- addons/website_forum/views/website_forum.xml | 4 +- .../views/templates.xml | 4 +- addons/website_sale/views/templates.xml | 4 +- 9 files changed, 280 insertions(+), 164 deletions(-) create mode 100644 addons/web/static/src/less/navbar.less diff --git a/addons/mail/static/src/less/client_action.less b/addons/mail/static/src/less/client_action.less index 8811eb28f4f..b2749199ca4 100644 --- a/addons/mail/static/src/less/client_action.less +++ b/addons/mail/static/src/less/client_action.less @@ -312,15 +312,6 @@ .o_mail_navbar_dropdown { width: 350px; padding: 0; - @media (max-width: @screen-xs-max) { - background-color: white!important; - max-height: none!important; - position: fixed!important; - top: @navbar-height; - right: 0; - bottom: 0; - left: 0; - } .o_spinner { .o-flex-display(); diff --git a/addons/web/static/src/less/navbar.less b/addons/web/static/src/less/navbar.less new file mode 100644 index 00000000000..8dcacd1c45c --- /dev/null +++ b/addons/web/static/src/less/navbar.less @@ -0,0 +1,174 @@ + +.o_main_navbar { + position: relative; + height: @odoo-navbar-height; + border: 1px solid @odoo-navbar-inverse-link-hover-bg; + background-color: @odoo-brand-primary; + color: white; + .box-shadow(0px 0px 8px @odoo-main-text-color); + + > button { + float: left; + width: @odoo-navbar-height - 2; + height: @odoo-navbar-height - 2; + border: none; + padding: 0; + line-height: @odoo-navbar-height - 2; + background-color: transparent; + + font-size: 18px; + .user-select(none); + + &:hover, &:focus { + background-color: @odoo-navbar-inverse-link-hover-bg; + } + &:focus, &:active, &:focus:active { + outline: none; + } + + &.o_menu_toggle { + margin-right: 5px; + } + } + + > ul { + display: block; + float: left; + margin: 0; + padding: 0; + list-style: none; + + > li { + position: relative; + display: block; + float: left; + + > a { + display: block; + height: @odoo-navbar-height - 2; + padding: 0 10px; + color: white; + line-height: @odoo-navbar-height - 2; + + &:hover { + background-color: @odoo-navbar-inverse-link-hover-bg; + } + + &:focus, &:active, &:focus:active { + outline: none; + } + } + } + + &.o_menu_systray { + float: right; + .open .dropdown-menu { + left: auto; + right: 0; + } + .o_user_menu { + float: right; + .oe_topbar_avatar { + height: 15px; + } + } + } + } + + .o_menu_brand { + display: none; + } + + .open .dropdown-menu { + max-height: 90vh; // the dropdown should not overstep the viewport + overflow: auto; + margin-top: 0; + + .o-menu-indentation(@index) when (@index < 6) { + > li.o_menu_header_lvl_@{index}, > li .o_menu_entry_lvl_@{index} { + padding-left: @odoo-dropdown-hpadding + (@index - 2)*12px; + } + .o-menu-indentation(@index + 1); + } + .o-menu-indentation(3); + } + + @media (max-width: @screen-xs-max) { + .o-transition(height, 200ms, linear); + + position: relative; + height: @odoo-navbar-height; + overflow: hidden; + + > ul { + > li { + float: none; + .dropdown-backdrop { + display: none; + } + + &.open .dropdown-menu { + max-height: none; + } + } + + &.o_menu_sections { + width: 100%; + + > li.open .dropdown-menu { + position: static; + float: none; + background-color: transparent; + box-shadow: none; + border: none; + overflow: visible; + + > li > a { + background-color: transparent; + color: inherit; + } + } + } + + &.o_menu_systray { + .o-position-absolute(0px, @odoo-navbar-height - 2, auto, @odoo-navbar-height - 2); + height: @odoo-navbar-height - 2; + text-align: right; + + > li { + display: inline-block; + + &.open .dropdown-menu { + .o-position-absolute(@odoo-navbar-height, 0, 0, 0); + position: fixed; + width: auto; + } + } + + .o_user_menu .oe_topbar_name { + display: none; + } + } + } + + .o_menu_brand { + float: none; + margin: 0; + border-bottom: 1px solid @odoo-navbar-inverse-link-hover-bg; + color: transparent; + } + } +} + +@media (max-width: @screen-xs-max) { + body.o_mobile_menu_opened { + overflow: hidden; + height: 100%; + height: 100vh; + + .o_main_navbar { + height: 100%; + overflow: auto; + } + } +} diff --git a/addons/web/views/webclient_templates.xml b/addons/web/views/webclient_templates.xml index f3de50cb56a..5ce50bd8f94 100644 --- a/addons/web/views/webclient_templates.xml +++ b/addons/web/views/webclient_templates.xml @@ -151,6 +151,8 @@ + + diff --git a/addons/website/views/website_backend_navbar.xml b/addons/website/views/website_backend_navbar.xml index afef4c81ee9..c60caf9af36 100644 --- a/addons/website/views/website_backend_navbar.xml +++ b/addons/website/views/website_backend_navbar.xml @@ -1,156 +1,105 @@ - - + - - + diff --git a/addons/website_blog/views/website_blog_templates.xml b/addons/website_blog/views/website_blog_templates.xml index c5366eb4d5b..ed305fbf61d 100644 --- a/addons/website_blog/views/website_blog_templates.xml +++ b/addons/website_blog/views/website_blog_templates.xml @@ -458,8 +458,8 @@ diff --git a/addons/website_event/views/website_event.xml b/addons/website_event/views/website_event.xml index 637117e4076..f771a456fce 100644 --- a/addons/website_event/views/website_event.xml +++ b/addons/website_event/views/website_event.xml @@ -623,8 +623,8 @@ diff --git a/addons/website_forum/views/website_forum.xml b/addons/website_forum/views/website_forum.xml index a0216121b0c..66902c2d2fb 100644 --- a/addons/website_forum/views/website_forum.xml +++ b/addons/website_forum/views/website_forum.xml @@ -1537,8 +1537,8 @@ diff --git a/addons/website_hr_recruitment/views/templates.xml b/addons/website_hr_recruitment/views/templates.xml index 9165c7992f4..01d9f6acc30 100644 --- a/addons/website_hr_recruitment/views/templates.xml +++ b/addons/website_hr_recruitment/views/templates.xml @@ -294,8 +294,8 @@ diff --git a/addons/website_sale/views/templates.xml b/addons/website_sale/views/templates.xml index e042cfd7a0b..db71fbff153 100644 --- a/addons/website_sale/views/templates.xml +++ b/addons/website_sale/views/templates.xml @@ -1471,8 +1471,8 @@