Browse Source

[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
pull/1110/head
Wolfgang Pichler 7 years ago
committed by Pedro M. Baeza
parent
commit
a0b29b11da
  1. 35
      web_dialog_size/README.rst
  2. 12
      web_dialog_size/__manifest__.py
  3. 20
      web_dialog_size/static/src/js/web_dialog_size.js

35
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 Expand Dialog
============= =============
A module that lets the user expand/restore the dialog box size through a button A module that lets the user expand/restore the dialog box size through a button
in the upper right corner (mimicking most windows managers). in the upper right corner (mimicking most windows managers).
It does also add draggable support to the dialogs.
Configuration 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 to override this and have all dialogs maximized by default, set the configuration
parameter `web_dialog_size.default_maximize` to `1`. 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
<https://github.com/OCA/web/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 Credits
======= =======
Images
------
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
Contributors Contributors
------------ ------------
* Anthony Muschang <anthony.muschang@acsone.eu> * Anthony Muschang <anthony.muschang@acsone.eu>
* Stéphane Bidoul <stephane.bidoul@acsone.eu> * Stéphane Bidoul <stephane.bidoul@acsone.eu>
* Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
* Pedro M. Baeza <pedro.baeza@tecnativa.com>
* Holger Brunn <hbrunn@therp.nl> * Holger Brunn <hbrunn@therp.nl>
* Siddharth Bhalgami <siddharth.bhalgami@gmail.com> * Siddharth Bhalgami <siddharth.bhalgami@gmail.com>
* Wolfgang Pichler <wpichler@callino.at>
* David Vidal <david.vidal@tecnativa.com>
Do not contact contributors directly about support or help with technical issues.
Maintainer Maintainer
---------- ----------
.. image:: http://odoo-community.org/logo.png
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association :alt: Odoo Community Association
:target: http://odoo-community.org
:target: https://odoo-community.org
This module is maintained by the OCA. 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 mission is to support the collaborative development of Odoo features and
promote its widespread use. 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.

12
web_dialog_size/__manifest__.py

@ -4,22 +4,18 @@
{ {
'name': "Web Dialog Size", 'name': "Web Dialog Size",
'summary': """ 'summary': """
A module that lets the user expand a A module that lets the user expand a
dialog box to the full screen width.""", dialog box to the full screen width.""",
'author': "ACSONE SA/NV, " 'author': "ACSONE SA/NV, "
"Serv. Tecnol. Avanzados - Pedro M. Baeza, "
"Therp BV, " "Therp BV, "
"Odoo Community Association (OCA), "
"Siddharth Bhalgami",
"Siddharth Bhalgami,"
"Tecnativa, "
"Odoo Community Association (OCA)",
'website': "http://acsone.eu", 'website': "http://acsone.eu",
'category': 'web', 'category': 'web',
'version': '10.0.1.0.0',
'version': '10.0.1.0.1',
'license': 'AGPL-3', 'license': 'AGPL-3',
'depends': [ 'depends': [
'web', 'web',
], ],

20
web_dialog_size/static/src/js/web_dialog_size.js

@ -14,7 +14,7 @@ Dialog.include({
new Model('ir.config_parameter').query(['key', 'value']). new Model('ir.config_parameter').query(['key', 'value']).
filter([['key', '=', 'web_dialog_size.default_maximize']]).all().then(function(default_maximize) { 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(); self._extending();
} else { } else {
self._restore(); 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() { _extending: function() {
var dialog = this.$modal.find('.modal-dialog'); var dialog = this.$modal.find('.modal-dialog');
dialog.addClass('dialog_full_screen'); dialog.addClass('dialog_full_screen');

Loading…
Cancel
Save