From 74be1eb57eaaedfdc504003bfc38b24a637b65ba Mon Sep 17 00:00:00 2001 From: Cyril VINH-TUNG Date: Tue, 8 Aug 2023 09:09:57 -1000 Subject: [PATCH 1/2] Revert "[IMP] - use display for element visibility" This reverts commit 22378d9dfc0ea893e5a208acce1f54b88f783ec9. The cherry pick was wrong --- report_qweb_element_page_visibility/views/layouts.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/report_qweb_element_page_visibility/views/layouts.xml b/report_qweb_element_page_visibility/views/layouts.xml index e4cefcde1e..f940da42ab 100644 --- a/report_qweb_element_page_visibility/views/layouts.xml +++ b/report_qweb_element_page_visibility/views/layouts.xml @@ -33,16 +33,16 @@ var operations = { 'not-first-page': function (elt) { - elt.style.display = (vars.sitepage == vars.frompage) ? "hidden" : "visible"; + elt.style.visibility = (vars.sitepage == vars.frompage) ? "hidden" : "visible"; }, 'not-last-page': function (elt) { - elt.style.display = (vars.sitepage == vars.sitepages) ? "hidden" : "visible"; + elt.style.visibility = (vars.sitepage == vars.sitepages) ? "hidden" : "visible"; }, 'first-page': function (elt) { - elt.style.display = (vars.sitepage == vars.frompage) ? "visible" : "hidden"; + elt.style.visibility = (vars.sitepage == vars.frompage) ? "visible" : "hidden"; }, 'last-page': function (elt) { - elt.style.display = (vars.sitepage == vars.sitepages) ? "visible" : "hidden"; + elt.style.visibility = (vars.sitepage == vars.sitepages) ? "visible" : "hidden"; }, }; for (var klass in operations) { From 9f06f3b1d3bd13a01a0e19c2fccc1f5d9ca2d91e Mon Sep 17 00:00:00 2001 From: sbejaoui Date: Fri, 30 Apr 2021 15:23:17 +0200 Subject: [PATCH 2/2] [IMP] - use display for element visibility the visibility attribute with the hidden option hides the element but don't free the space. A common use case is to have a specific header for the first page and another for the other pages. With visibility: hidden the second header cannot take the first one place and will keep a huge margin. One solution is to use the display:none instead. --- report_qweb_element_page_visibility/views/layouts.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/report_qweb_element_page_visibility/views/layouts.xml b/report_qweb_element_page_visibility/views/layouts.xml index f940da42ab..ec3aff858c 100644 --- a/report_qweb_element_page_visibility/views/layouts.xml +++ b/report_qweb_element_page_visibility/views/layouts.xml @@ -33,16 +33,16 @@ var operations = { 'not-first-page': function (elt) { - elt.style.visibility = (vars.sitepage == vars.frompage) ? "hidden" : "visible"; + elt.style.display = (vars.sitepage === vars.frompage) ? "none" : "inherit"; }, 'not-last-page': function (elt) { - elt.style.visibility = (vars.sitepage == vars.sitepages) ? "hidden" : "visible"; + elt.style.display = (vars.sitepage === vars.sitepages) ? "none" : "inherit"; }, 'first-page': function (elt) { - elt.style.visibility = (vars.sitepage == vars.frompage) ? "visible" : "hidden"; + elt.style.display = (vars.sitepage === vars.frompage) ? "inherit" : "none"; }, 'last-page': function (elt) { - elt.style.visibility = (vars.sitepage == vars.sitepages) ? "visible" : "hidden"; + elt.style.display = (vars.sitepage === vars.sitepages) ? "inherit" : "none"; }, }; for (var klass in operations) {