diff --git a/web_dialog_size/README.rst b/web_dialog_size/README.rst new file mode 100644 index 00000000..6cc0acf8 --- /dev/null +++ b/web_dialog_size/README.rst @@ -0,0 +1,67 @@ +.. 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 +============= + +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/11.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 +* Holger Brunn +* Siddharth Bhalgami +* Wolfgang Pichler +* David Vidal +* Quentin Theuret + +Do not contact contributors directly about support or help with technical issues. + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +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 https://odoo-community.org. diff --git a/web_dialog_size/__init__.py b/web_dialog_size/__init__.py new file mode 100644 index 00000000..2b46a37e --- /dev/null +++ b/web_dialog_size/__init__.py @@ -0,0 +1,2 @@ +# Copyright 2018 Quentin Theuret +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). \ No newline at end of file diff --git a/web_dialog_size/__manifest__.py b/web_dialog_size/__manifest__.py new file mode 100644 index 00000000..df894502 --- /dev/null +++ b/web_dialog_size/__manifest__.py @@ -0,0 +1,30 @@ +# Copyright 2015 ACSONE SA/NV +# Copyright 2018 Amaris +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + 'name': "Web Dialog Size", + 'summary': """ + A module that lets the user expand a + dialog box to the full screen width.""", + 'author': "ACSONE SA/NV, " + "Therp BV, " + "Siddharth Bhalgami," + "Tecnativa, " + "Amaris, " + "Odoo Community Association (OCA)", + 'website': "http://acsone.eu", + 'category': 'web', + 'version': '11.0.1.0.1', + 'license': 'AGPL-3', + 'depends': [ + 'web', + ], + 'qweb': [ + 'static/src/xml/web_dialog_size.xml', + ], + 'data': [ + 'templates/assets.xml', + ], + 'installable': True, +} diff --git a/web_dialog_size/static/description/icon.png b/web_dialog_size/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/web_dialog_size/static/description/icon.png differ diff --git a/web_dialog_size/static/src/css/web_dialog_size.css b/web_dialog_size/static/src/css/web_dialog_size.css new file mode 100644 index 00000000..bd7fdb2e --- /dev/null +++ b/web_dialog_size/static/src/css/web_dialog_size.css @@ -0,0 +1,15 @@ +.modal .modal-header button.dialog_button_extend { + padding-right: 5px; +} + +.modal .modal-header button.dialog_button_restore { + padding-right: 5px; +} + +.dialog_full_screen { + width: calc(100% - 50px); +} + +.modal .modal-header button.close { + font-size: 18px; +} diff --git a/web_dialog_size/static/src/js/web_dialog_size.js b/web_dialog_size/static/src/js/web_dialog_size.js new file mode 100644 index 00000000..f1684791 --- /dev/null +++ b/web_dialog_size/static/src/js/web_dialog_size.js @@ -0,0 +1,62 @@ +odoo.define('web_dialog_size.web_dialog_size', function (require) { +'use strict'; + +var rpc = require('web.rpc'); +var Dialog = require('web.Dialog'); + +Dialog.include({ + + willStart: function () { + var self = this; + return this._super.apply(this, arguments).then(function () { + self.$modal.find('.dialog_button_extend').on('click', self.proxy('_extending')); + self.$modal.find('.dialog_button_restore').on('click', self.proxy('_restore')); + return rpc.query({ + model: 'ir.config_parameter', + method: 'get_param', + args: ['web_dialog_size.default_maximize',], + }).then(function(default_maximize) { + if (default_maximize === "True" || default_maximize === 1) { + self._extending(); + } else { + self._restore(); + } + }); + }); + }, + + open: function() { + this._super.apply(this, arguments); + if (this.$modal) { + this.$modal.draggable({ + handle: '.modal-header', + helper: false + }); + } + }, + + close: function() { + var draggable = this.$modal.draggable( "instance" ); + if (draggable) { + this.$modal.draggable("destroy"); + } + return this._super.apply(this, arguments); + }, + + _extending: function() { + var dialog = this.$modal.find('.modal-dialog'); + dialog.addClass('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.find('.dialog_button_restore').hide(); + dialog.find('.dialog_button_extend').show(); + }, + +}); + +}); diff --git a/web_dialog_size/static/src/xml/web_dialog_size.xml b/web_dialog_size/static/src/xml/web_dialog_size.xml new file mode 100644 index 00000000..51e6fd6a --- /dev/null +++ b/web_dialog_size/static/src/xml/web_dialog_size.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/web_dialog_size/templates/assets.xml b/web_dialog_size/templates/assets.xml new file mode 100644 index 00000000..103b3d97 --- /dev/null +++ b/web_dialog_size/templates/assets.xml @@ -0,0 +1,9 @@ + + + +