Browse Source

Merge pull request #869 from qtheuret/11.0-mig-web_dialog_size

11.0 mig web dialog size
pull/899/head
Pedro M. Baeza 6 years ago
committed by GitHub
parent
commit
ef135d7521
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 67
      web_dialog_size/README.rst
  2. 2
      web_dialog_size/__init__.py
  3. 30
      web_dialog_size/__manifest__.py
  4. BIN
      web_dialog_size/static/description/icon.png
  5. 15
      web_dialog_size/static/src/css/web_dialog_size.css
  6. 62
      web_dialog_size/static/src/js/web_dialog_size.js
  7. 12
      web_dialog_size/static/src/xml/web_dialog_size.xml
  8. 9
      web_dialog_size/templates/assets.xml

67
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
<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
=======
Images
------
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
Contributors
------------
* Anthony Muschang <anthony.muschang@acsone.eu>
* Stéphane Bidoul <stephane.bidoul@acsone.eu>
* Pedro M. Baeza <pedro.baeza@tecnativa.com>
* Holger Brunn <hbrunn@therp.nl>
* Siddharth Bhalgami <siddharth.bhalgami@gmail.com>
* Wolfgang Pichler <wpichler@callino.at>
* David Vidal <david.vidal@tecnativa.com>
* Quentin Theuret <quentin.theuret@amaris.com>
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.

2
web_dialog_size/__init__.py

@ -0,0 +1,2 @@
# Copyright 2018 Quentin Theuret <quentin.theuret@amaris.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

30
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,
}

BIN
web_dialog_size/static/description/icon.png

After

Width: 128  |  Height: 128  |  Size: 9.2 KiB

15
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;
}

62
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();
},
});
});

12
web_dialog_size/static/src/xml/web_dialog_size.xml

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-extend="Dialog">
<t t-jquery="button.close" t-operation="inner">
<i class="fa fa-close" />
</t>
<t t-jquery="button.close" t-operation="after">
<button type="button" class="dialog_button_extend close"><i class="fa fa-expand" /></button>
<button type="button" class="dialog_button_restore close"><i class="fa fa-compress" /></button>
</t>
</t>
</templates>

9
web_dialog_size/templates/assets.xml

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<template id="assets_backend" name="web_dialog_size assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<link rel="stylesheet" href="/web_dialog_size/static/src/css/web_dialog_size.css"/>
<script type="text/javascript" src="/web_dialog_size/static/src/js/web_dialog_size.js"></script>
</xpath>
</template>
</odoo>
Loading…
Cancel
Save