Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions web_dialog_size/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
===========
Expand Down
4 changes: 4 additions & 0 deletions web_dialog_size/readme/ROADMAP.md
Original file line number Diff line number Diff line change
@@ -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.
4 changes: 4 additions & 0 deletions web_dialog_size/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,10 @@ <h2><a class="toc-backref" href="#toc-entry-1">Configuration</a></h2>
<h2><a class="toc-backref" href="#toc-entry-2">Known issues / Roadmap</a></h2>
<ul class="simple">
<li>Allow setting default dialog size per user.</li>
<li>Some dialogs, like the one opened by <em>Create and edit…</em>, also show
core’s <tt class="docutils literal">onExpand</tt> 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.</li>
</ul>
</div>
<div class="section" id="bug-tracker">
Expand Down
12 changes: 11 additions & 1 deletion web_dialog_size/static/src/js/web_dialog_size.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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});
},
});

Expand Down
7 changes: 0 additions & 7 deletions web_dialog_size/static/src/scss/web_dialog_size.scss
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
6 changes: 3 additions & 3 deletions web_dialog_size/static/tests/web_dialog_size.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 () => {
Expand All @@ -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);
});
Loading