diff --git a/web_dialog_size/README.rst b/web_dialog_size/README.rst index 2da3b071f196..646d735f781b 100644 --- a/web_dialog_size/README.rst +++ b/web_dialog_size/README.rst @@ -57,6 +57,10 @@ Known issues / Roadmap ====================== - Allow setting default dialog size per user. +- Some dialogs, like the one opened by *Create and edit...*, also show + core's ``onExpand`` button next to this module's one. They do + different things (core's opens the full form view), but two similar + icons are displayed. Unify them or make them easier to tell apart. Bug Tracker =========== diff --git a/web_dialog_size/readme/ROADMAP.md b/web_dialog_size/readme/ROADMAP.md index df8c2291b925..643255b0492c 100644 --- a/web_dialog_size/readme/ROADMAP.md +++ b/web_dialog_size/readme/ROADMAP.md @@ -1 +1,5 @@ - Allow setting default dialog size per user. +- Some dialogs, like the one opened by *Create and edit...*, also show core's + `onExpand` button next to this module's one. They do different things (core's + opens the full form view), but two similar icons are displayed. Unify them or + make them easier to tell apart. diff --git a/web_dialog_size/static/description/index.html b/web_dialog_size/static/description/index.html index 2f1d4b6ee284..bc026032a148 100644 --- a/web_dialog_size/static/description/index.html +++ b/web_dialog_size/static/description/index.html @@ -411,6 +411,10 @@

Configuration

Known issues / Roadmap

diff --git a/web_dialog_size/static/src/js/web_dialog_size.esm.js b/web_dialog_size/static/src/js/web_dialog_size.esm.js index c7fedfed25b2..e6c65abde345 100644 --- a/web_dialog_size/static/src/js/web_dialog_size.esm.js +++ b/web_dialog_size/static/src/js/web_dialog_size.esm.js @@ -55,7 +55,17 @@ patch(Dialog.prototype, { }, get size() { - return this.maximized() ? "dialog_full_screen" : super.size; + return this.maximized() ? "fs" : super.size; + }, +}); + +patch(ActionDialog.prototype, { + setup() { + super.setup(); + // Core (mail) adds its own expand button to some action dialogs, with its + // own state. This module already provides one for every dialog, so hide it. + // Defined on the instance so it wins whatever the patch order is. + Object.defineProperty(this, "canExpand", {get: () => false}); }, }); diff --git a/web_dialog_size/static/src/scss/web_dialog_size.scss b/web_dialog_size/static/src/scss/web_dialog_size.scss index 44e2066f1aa2..791f6b2e2bf0 100644 --- a/web_dialog_size/static/src/scss/web_dialog_size.scss +++ b/web_dialog_size/static/src/scss/web_dialog_size.scss @@ -1,11 +1,4 @@ .modal { - .modal-dialog_full_screen { - @include media-breakpoint-up(sm) { - max-width: 100%; - width: calc(100% - 50px); - } - } - .dialog_button_restore, .dialog_button_extend { margin-left: auto; diff --git a/web_dialog_size/static/tests/web_dialog_size.test.js b/web_dialog_size/static/tests/web_dialog_size.test.js index fd72ad0ddc6b..0c029dbd5421 100644 --- a/web_dialog_size/static/tests/web_dialog_size.test.js +++ b/web_dialog_size/static/tests/web_dialog_size.test.js @@ -26,7 +26,7 @@ test("the user can maximize and restore a dialog", async () => { await mountWithCleanup(Parent); expect(".modal-dialog.modal-md").toHaveCount(1); await contains(".dialog_button_extend").click(); - expect(".modal-dialog.modal-dialog_full_screen").toHaveCount(1); + expect(".modal-dialog.modal-fs").toHaveCount(1); expect(browser.localStorage.getItem("odoo.web_dialog_size.value")).toBe("true"); await contains(".dialog_button_restore").click(); expect(".modal-dialog.modal-md").toHaveCount(1); @@ -37,7 +37,7 @@ test("a stored preference opens the dialog maximized", async () => { browser.localStorage.setItem("odoo.web_dialog_size.value", "true"); assignDialogTestEnv(); await mountWithCleanup(Parent); - expect(".modal-dialog.modal-dialog_full_screen").toHaveCount(1); + expect(".modal-dialog.modal-fs").toHaveCount(1); }); test("the server default maximizes dialogs without a stored preference", async () => { @@ -47,5 +47,5 @@ test("the server default maximizes dialogs without a stored preference", async ( assignDialogTestEnv(); await mountWithCleanup(Parent); await animationFrame(); - expect(".modal-dialog.modal-dialog_full_screen").toHaveCount(1); + expect(".modal-dialog.modal-fs").toHaveCount(1); });