From a0b29b11dafd51aa09a2eba64263fd4b6140d8f7 Mon Sep 17 00:00:00 2001 From: Wolfgang Pichler Date: Mon, 18 Sep 2017 09:58:06 +0200 Subject: [PATCH] [FIX+IMP] web_dialog_size * IMP: Added draggable support to dialogs * FIX: web_dialog_size: export modal - PR #733 introduced draggable dialogs which broke some of them --- web_dialog_size/README.rst | 35 ++++++++++++++++--- web_dialog_size/__manifest__.py | 12 +++---- .../static/src/js/web_dialog_size.js | 20 ++++++++++- 3 files changed, 54 insertions(+), 13 deletions(-) diff --git a/web_dialog_size/README.rst b/web_dialog_size/README.rst index d30b2f01..c936a028 100644 --- a/web_dialog_size/README.rst +++ b/web_dialog_size/README.rst @@ -1,8 +1,14 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: https://www.gnu.org/licenses/agpl + :alt: License: AGPL-3 + +============= Expand Dialog ============= A module that lets the user expand/restore the dialog box size through a button in the upper right corner (mimicking most windows managers). +It does also add draggable support to the dialogs. Configuration ============= @@ -11,24 +17,45 @@ By default, the module respects the caller's `dialog_size` option. If you want to override this and have all dialogs maximized by default, set the configuration parameter `web_dialog_size.default_maximize` to `1`. +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/162/10.0 + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues +`_. In case of trouble, please +check there if your issue has already been reported. If you spotted it first, +help us smash it by providing detailed and welcomed feedback. + Credits ======= +Images +------ + +* Odoo Community Association: `Icon `_. + Contributors ------------ * Anthony Muschang * Stéphane Bidoul -* Pedro M. Baeza +* Pedro M. Baeza * Holger Brunn * Siddharth Bhalgami +* Wolfgang Pichler +* David Vidal + +Do not contact contributors directly about support or help with technical issues. Maintainer ---------- -.. image:: http://odoo-community.org/logo.png +.. image:: https://odoo-community.org/logo.png :alt: Odoo Community Association - :target: http://odoo-community.org + :target: https://odoo-community.org This module is maintained by the OCA. @@ -36,4 +63,4 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -To contribute to this module, please visit http://odoo-community.org. +To contribute to this module, please visit https://odoo-community.org. diff --git a/web_dialog_size/__manifest__.py b/web_dialog_size/__manifest__.py index 10b14d75..6b8df22f 100644 --- a/web_dialog_size/__manifest__.py +++ b/web_dialog_size/__manifest__.py @@ -4,22 +4,18 @@ { 'name': "Web Dialog Size", - 'summary': """ A module that lets the user expand a dialog box to the full screen width.""", - 'author': "ACSONE SA/NV, " - "Serv. Tecnol. Avanzados - Pedro M. Baeza, " "Therp BV, " - "Odoo Community Association (OCA), " - "Siddharth Bhalgami", - + "Siddharth Bhalgami," + "Tecnativa, " + "Odoo Community Association (OCA)", 'website': "http://acsone.eu", 'category': 'web', - 'version': '10.0.1.0.0', + 'version': '10.0.1.0.1', 'license': 'AGPL-3', - 'depends': [ 'web', ], diff --git a/web_dialog_size/static/src/js/web_dialog_size.js b/web_dialog_size/static/src/js/web_dialog_size.js index df56b8fe..e8f84da2 100644 --- a/web_dialog_size/static/src/js/web_dialog_size.js +++ b/web_dialog_size/static/src/js/web_dialog_size.js @@ -14,7 +14,7 @@ Dialog.include({ new Model('ir.config_parameter').query(['key', 'value']). filter([['key', '=', 'web_dialog_size.default_maximize']]).all().then(function(default_maximize) { - if (default_maximize.length && default_maximize[0]['value'] == 1) { + if (default_maximize.length && default_maximize[0].value === 1) { self._extending(); } else { self._restore(); @@ -22,6 +22,24 @@ Dialog.include({ }); }, + open: function() { + var res = this._super.apply(this, arguments); + this.$modal.draggable({ + handle: '.modal-header', + helper: false + }); + return res; + }, + + close: function() { + var draggable = this.$modal.draggable( "instance" ); + if (draggable) { + this.$modal.draggable("destroy"); + } + var res = this._super.apply(this, arguments); + return res; + }, + _extending: function() { var dialog = this.$modal.find('.modal-dialog'); dialog.addClass('dialog_full_screen');