From da57ad6945908eef0acd1117c285c4258ae9e8b5 Mon Sep 17 00:00:00 2001 From: "Mehdi Outagant (MOU)" Date: Thu, 21 Dec 2023 16:23:28 +0100 Subject: [PATCH] [FIX] website: fix page properties dialog buttons MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Steps to reproduce: Go to the website's home page > Site > Properties > The control panel buttons in the footer of the "Page Properties" dialog are not aligned correctly. The "Page Properties" dialog extends the `FormViewDialog` component and updates its template using `xpath` to add extra buttons on the right side of the footer (to "duplicate" & "delete" the current page). But since [1], a `w-100` class has been added to the default button container (`.o_cp_buttons`) on form view dialogs to get the same result as the "More Options" button on `Calendar > Quick Create` dialogs (the difference here is that the extra button was added inside the default buttons wrapper, while on page properties, the buttons are added next to it). The goal of this commit is to "safely" fix this misalignment issue on stable by simply removing the `w-100` class for the page properties dialog. On master, we will adapt the page properties buttons to have the same structure as on the calendar dialog. [1]: https://github.com/odoo/odoo/commit/7dd6e5d1a55de99a4212abc6f24490e47d9ce5bb task-3642712 closes odoo/odoo#146541 Signed-off-by: Soukéina Bojabza (sobo) --- .../static/src/components/dialog/page_properties.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/addons/website/static/src/components/dialog/page_properties.js b/addons/website/static/src/components/dialog/page_properties.js index b7f7cbc25db..273ebb7bdf0 100644 --- a/addons/website/static/src/components/dialog/page_properties.js +++ b/addons/website/static/src/components/dialog/page_properties.js @@ -7,7 +7,7 @@ import {sprintf} from "@web/core/utils/strings"; import {WebsiteDialog} from './dialog'; import {FormViewDialog} from "@web/views/view_dialogs/form_view_dialog"; import { renderToFragment } from "@web/core/utils/render"; -import { Component, useEffect, useState, xml, useRef } from "@odoo/owl"; +import { Component, useEffect, useState, xml, useRef, onMounted } from "@odoo/owl"; export class PageDependencies extends Component { setup() { @@ -152,6 +152,14 @@ export class PagePropertiesDialog extends FormViewDialog { this.website = useService('website'); this.viewProps.resId = this.resId; + + // TODO: Remove in master, the `w-100` is causing a button's + // misalignment on the page properties dialog, this should be + // replaced by adding extra buttons to the default container in + // `this.viewProps.buttonTemplate`. + onMounted(() => { + this.modalRef.el?.querySelector(".modal-footer .o_cp_buttons")?.classList.remove("w-100"); + }); } get resId() {