From b31daf2f7b3da3984c32004e8440c17ce8d38e89 Mon Sep 17 00:00:00 2001 From: luvi Date: Thu, 22 Dec 2022 12:38:00 +0000 Subject: [PATCH] [REF] web, *: improve view scale selector style and behavior *: hr_holidays, hr_work_entry_contract The commit introduces a new standard view component made to implement in a consistant way the scale/select the appropriate period to display in a view. This component is currently used by the Calendar view. Tests have been added for this new component, as its behavior specs must remain comprehensive. When there is no options or only one, the button is removed from the view to keep space available, as its purpose is reduced. This component gives the opportunity to keep the same style and behaviors for views implementing it (eg: Calendar, Gantt) and should be used in other views as well as soon as they are converted to Owl. Other modules have been adapted to use the component name in xpath instead of the span with the o_calendar_scale_buttons element. Tests have been adapted as well. A scss file has been modified to prevent the arrow to be misplaced on touch devices due to a higher padding in the dropdown item element. part of task #2867569 closes odoo/odoo#109090 Related: odoo/enterprise#35435 Signed-off-by: Bruno Boi (boi) --- .../views/calendar/calendar_controller.xml | 2 +- .../work_entry_calendar.xml | 2 +- .../src/views/calendar/calendar_controller.js | 12 +- .../views/calendar/calendar_controller.xml | 17 +-- .../view_components/view_scale_selector.js | 21 +++ .../view_components/view_scale_selector.xml | 21 +++ .../tests/mobile/views/calendar_view_tests.js | 8 +- .../views/calendar/calendar_view_tests.js | 14 +- .../static/tests/views/calendar/helpers.js | 4 +- .../view_scale_selector_tests.js | 125 ++++++++++++++++++ 10 files changed, 189 insertions(+), 37 deletions(-) create mode 100644 addons/web/static/src/views/view_components/view_scale_selector.js create mode 100644 addons/web/static/src/views/view_components/view_scale_selector.xml create mode 100644 addons/web/static/tests/views/view_components/view_scale_selector_tests.js diff --git a/addons/hr_holidays/static/src/views/calendar/calendar_controller.xml b/addons/hr_holidays/static/src/views/calendar/calendar_controller.xml index 0ccf66f19b1..5a3db4ea95c 100644 --- a/addons/hr_holidays/static/src/views/calendar/calendar_controller.xml +++ b/addons/hr_holidays/static/src/views/calendar/calendar_controller.xml @@ -6,7 +6,7 @@ - + - - - - - - - - - - - - +