[FIX] web_dialog_size: Fixes on legacy Dialogs

The problems found on Legacy Dialogs are the next:

1. The modal can't be dragged
2. The button for extending and reduce the modal is doing nothing
3. The x for close the modal is showed twice

You can test it with dialogs showed on Vault module
pull/3042/head
Carlos Roca 2024-06-11 09:08:48 +02:00 committed by jguerriat
parent c54f972057
commit 5495f4ac09
5 changed files with 9 additions and 32 deletions

View File

@ -7,7 +7,7 @@ Web Dialog Size
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:12e664b8d9a56a20606514048d61cfecbade928aa7878d88fb6530eec6c732f1
!! source digest: sha256:79e0e0e4e8e452e0ff8721c42fc5cda3c078b0461dfb7bdb454fb4d768c4b6af
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png

View File

@ -15,7 +15,7 @@
"Odoo Community Association (OCA)",
"website": "https://github.com/OCA/web",
"category": "web",
"version": "16.0.1.0.0",
"version": "16.0.1.0.1",
"license": "AGPL-3",
"depends": ["web"],
"installable": True,

View File

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
@ -367,7 +366,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:12e664b8d9a56a20606514048d61cfecbade928aa7878d88fb6530eec6c732f1
!! source digest: sha256:79e0e0e4e8e452e0ff8721c42fc5cda3c078b0461dfb7bdb454fb4d768c4b6af
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/web/tree/16.0/web_dialog_size"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/web-16-0/web-16-0-web_dialog_size"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/web&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>A module that lets the user expand/restore the dialog box size through a button

View File

@ -19,6 +19,10 @@ odoo.define("web_dialog_size.web_dialog_size", function (require) {
self.$modal
.find(".dialog_button_restore")
.on("click", self.proxy("_restore"));
self.$modal.find(">:first-child").draggable({
handle: ".modal-header",
helper: false,
});
return config.then(function (r) {
if (r.default_maximize) {
self._extending();
@ -29,39 +33,16 @@ odoo.define("web_dialog_size.web_dialog_size", function (require) {
});
},
opened: function () {
return this._super.apply(this, arguments).then(
function () {
if (this.$modal) {
this.$modal.find(">:first-child").draggable({
handle: ".modal-header",
helper: false,
});
}
}.bind(this)
);
},
close: function () {
if (this.$modal) {
var draggable = this.$modal.find(">:first-child").draggable("instance");
if (draggable) {
this.$modal.find(">:first-child").draggable("destroy");
}
}
return this._super.apply(this, arguments);
},
_extending: function () {
var dialog = this.$modal.find(".modal-dialog");
dialog.addClass("dialog_full_screen");
dialog.addClass("modal-dialog_full_screen");
dialog.find(".dialog_button_extend").hide();
dialog.find(".dialog_button_restore").show();
},
_restore: function () {
var dialog = this.$modal.find(".modal-dialog");
dialog.removeClass("dialog_full_screen");
dialog.removeClass("modal-dialog_full_screen");
dialog.find(".dialog_button_restore").hide();
dialog.find(".dialog_button_extend").show();
},

View File

@ -3,9 +3,6 @@
<!-- This is for old Dialog template.
Because Odoo haven't done every template to OWL. -->
<t t-extend="web.DialogWidget">
<t t-jquery="button.btn-close" t-operation="inner">
<i class="fa fa-close" />
</t>
<t t-jquery="button.btn-close" t-operation="before">
<button type="button" class="dialog_button_extend btn btn-secondary">
<i class="fa fa-expand" />