From bc5eb15757cf5c9a540fd169040dc47a8a21af1c Mon Sep 17 00:00:00 2001 From: "stefanorigano (SRI)" Date: Mon, 24 May 2021 11:31:13 +0200 Subject: [PATCH] fixup! [REF] web, website: refine and simplify dropdown design --- .../web/static/src/core/debug/debug_menu.xml | 2 +- .../static/src/core/dropdown/dropdown.scss | 25 +++++++++++-------- .../web/static/src/legacy/scss/dropdown.scss | 12 ++++++--- addons/web/static/src/legacy/scss/navbar.scss | 3 ++- .../static/tests/legacy/views/pivot_tests.js | 7 +++++- 5 files changed, 33 insertions(+), 16 deletions(-) diff --git a/addons/web/static/src/core/debug/debug_menu.xml b/addons/web/static/src/core/debug/debug_menu.xml index 09825e24f784e..26fd4e65e3d26 100644 --- a/addons/web/static/src/core/debug/debug_menu.xml +++ b/addons/web/static/src/core/debug/debug_menu.xml @@ -5,7 +5,7 @@ + togglerClass="'btn btn-light'"> diff --git a/addons/web/static/src/core/dropdown/dropdown.scss b/addons/web/static/src/core/dropdown/dropdown.scss index 22875554bc5ed..82b8f4b376f16 100644 --- a/addons/web/static/src/core/dropdown/dropdown.scss +++ b/addons/web/static/src/core/dropdown/dropdown.scss @@ -1,5 +1,5 @@ -// Default Boostrap Classes customizations -//------------------------------------------------------------------------------ +// = Default Boostrap Classes customizations +// ---------------------------------------------------------------------------- .dropdown-menu { min-width: 100%; max-height: 90vh; @@ -34,7 +34,9 @@ } &.disabled a, &:disabled a { - @include o-hover-text-color($dropdown-link-disabled-color, $dropdown-link-disabled-color); + @include o-hover-text-color( + $dropdown-link-disabled-color, + $dropdown-link-disabled-color); } } @@ -48,20 +50,23 @@ } .dropdown-item-text { - // Commonly used in to wrap forms into dropdown menus. - // Specify a reasonable minimum-width to avoid inner elements - // to overlap each other. + // Commonly used in to wrap forms into dropdown menus. Specify a reasonable + // minimum-width to avoid that inner elements overlap each other. min-width: 15rem; } +.dropdown-divider:first-child { + display: none; +} + .o_rtl { .dropdown-menu { @extend .dropdown-menu-right; } } -// Extend Owl custom classes to visually match Boostrap ones -//------------------------------------------------------------------------------ +// = Extend Owl custom classes to visually match Boostrap ones +// ---------------------------------------------------------------------------- .o_dropdown { @extend .dropdown; @@ -82,8 +87,8 @@ } } -// Owl components specific rules -//------------------------------------------------------------------------------ +// = Owl components specific rules +// ----------------------------------------------------------------------------- .o_dropdown_item:not(.disabled):not(:disabled) { // Needed 'cause generate
  • html tags that for browsers are // normally not clickable. diff --git a/addons/web/static/src/legacy/scss/dropdown.scss b/addons/web/static/src/legacy/scss/dropdown.scss index b687f9be27ac8..d8a6dec9f08a7 100644 --- a/addons/web/static/src/legacy/scss/dropdown.scss +++ b/addons/web/static/src/legacy/scss/dropdown.scss @@ -1,7 +1,13 @@ -.ui-widget.ui-autocomplete { // Copy style of bootstrap dropdown +// = jQueryUI dropdown adaptations +// ---------------------------------------------------------------------------- +.ui-widget.ui-autocomplete { @extend .dropdown-menu; - top: 0; // Necessary to correctly compute the initial position - min-width: 0; // Necessary to correctly compute the initial width + top: 0; // Compute initial position + min-width: 0; // Compute initial width + + // Needed because .ui-widget are rendered at a + // lower stacking contex compared to modals. + z-index: $zindex-modal + 1; .ui-menu-item { padding: 0; diff --git a/addons/web/static/src/legacy/scss/navbar.scss b/addons/web/static/src/legacy/scss/navbar.scss index d09d2fc5ead42..49be12c651b0a 100644 --- a/addons/web/static/src/legacy/scss/navbar.scss +++ b/addons/web/static/src/legacy/scss/navbar.scss @@ -63,6 +63,7 @@ background: $-backend-entry-hover-bg; outline: 1px solid $o-navbar-inverse-link-hover-bg; outline-offset: -1px; + color: $white; } } @@ -76,7 +77,7 @@ // = Owl components // -------------------------------------------------------------------------- - .o_dropdown_toggler { + .o_dropdown .o_dropdown_toggler { @extend %-main-navbar-entry-base; @extend %-main-navbar-entry-padding; @extend %-main-navbar-entry-bg-hover; diff --git a/addons/web/static/tests/legacy/views/pivot_tests.js b/addons/web/static/tests/legacy/views/pivot_tests.js index e0fed1f4e15f6..14a04817c158b 100644 --- a/addons/web/static/tests/legacy/views/pivot_tests.js +++ b/addons/web/static/tests/legacy/views/pivot_tests.js @@ -2690,7 +2690,12 @@ QUnit.module('Views', { View: PivotView, model: "partner", data: this.data, - arch: ``, + // have at least a measure to have a separator in the Measures dropdown: + // + // Foo + // ----- + // Count + arch: ``, }); // open the "Measures" menu