mirror of https://github.com/OCA/web.git
[IMP] web_dialog_size: Select default dialog size by config
* [IMP] web_dialog_size: Put dialog size expanded by default * [REM] web_popup_large: By duplication of the functionality * [IMP] web_dialog_size: README and contributors * [ADD] configuration parameter for default behavior [FIX] return super's promise [IMP] use fontawesome icons for buttonspull/2425/head
parent
5c1477fac2
commit
734d2673e9
|
@ -1,19 +1,16 @@
|
||||||
Expand Dialog
|
Expand Dialog
|
||||||
=============
|
=============
|
||||||
|
|
||||||
A module that lets the user expand a dialog box to the full screen width.
|
A module that lets the user expand/restore the dialog box size through a button
|
||||||
|
in the upper right corner (mimicking most windows managers). By default,
|
||||||
|
all dialog boxes are expanded.
|
||||||
|
|
||||||
It is named web_dialog_size as it could be extended to propose other dialog size management feature.
|
Configuration
|
||||||
|
=============
|
||||||
|
|
||||||
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 smashing it by providing a detailed and welcomed feedback
|
|
||||||
`here <https://github.com/OCA/web/issues/new?body=module:%20web_dialog_size%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
|
||||||
|
|
||||||
|
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`.
|
||||||
|
|
||||||
Credits
|
Credits
|
||||||
=======
|
=======
|
||||||
|
@ -23,6 +20,8 @@ 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>
|
||||||
|
* Holger Brunn <hbrunn@therp.nl>
|
||||||
|
|
||||||
Maintainer
|
Maintainer
|
||||||
----------
|
----------
|
||||||
|
@ -33,6 +32,8 @@ Maintainer
|
||||||
|
|
||||||
This module is maintained by the OCA.
|
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.
|
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 http://odoo-community.org.
|
|
@ -28,7 +28,10 @@
|
||||||
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,Odoo Community Association (OCA)",
|
'author': "ACSONE SA/NV,"
|
||||||
|
"Serv. Tecnol. Avanzados - Pedro M. Baeza,"
|
||||||
|
"Therp BV,"
|
||||||
|
"Odoo Community Association (OCA)",
|
||||||
'website': "http://acsone.eu",
|
'website': "http://acsone.eu",
|
||||||
|
|
||||||
'category': 'web',
|
'category': 'web',
|
||||||
|
|
|
@ -1,17 +1,15 @@
|
||||||
.modal .modal-header button.dialog_button_extend {
|
.modal .modal-header button.dialog_button_extend {
|
||||||
padding-top: 0px;
|
|
||||||
padding-right: 3px;
|
padding-right: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal .modal-header button.dialog_button_restore {
|
.modal .modal-header button.dialog_button_restore {
|
||||||
padding-top: 1px;
|
padding-right: 3px;
|
||||||
padding-right: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.modal .modal-header .dialog_button_hide {
|
|
||||||
display: none;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.dialog_full_screen {
|
.dialog_full_screen {
|
||||||
width: calc(100% - 50px);
|
width: calc(100% - 50px);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.modal .modal-header button.close {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
|
@ -1,34 +1,58 @@
|
||||||
openerp.web_dialog_size= function (instance) {
|
openerp.web_dialog_size= function (instance) {
|
||||||
|
|
||||||
instance.web.Dialog = instance.web.Dialog.extend({
|
instance.web.Dialog = instance.web.Dialog.extend({
|
||||||
|
|
||||||
init_dialog: function () {
|
init_dialog: function () {
|
||||||
var self = this;
|
var self = this,
|
||||||
this._super();
|
result = this._super();
|
||||||
self.$dialog_box.find('.dialog_button_restore').addClass('dialog_button_hide');
|
self.$dialog_box.find('.dialog_button_extend')
|
||||||
if (this.dialog_options.size !== 'large'){
|
.on('click', self.proxy('_extending'));
|
||||||
self.$dialog_box.find('.dialog_button_extend').addClass('dialog_button_hide');
|
self.$dialog_box.find('.dialog_button_restore')
|
||||||
}
|
.on('click', self.proxy('_restore'));
|
||||||
else{
|
if(this.dialog_options.size == 'large')
|
||||||
self.$dialog_box.find('.dialog_button_extend').on('click', self._extending);
|
{
|
||||||
self.$dialog_box.find('.dialog_button_restore').on('click', self._restore);
|
self._extending();
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
return jQuery.when(result).then(function()
|
||||||
|
{
|
||||||
|
var deferred = null;
|
||||||
|
if(openerp.web_dialog_size.default_maximize === undefined)
|
||||||
|
{
|
||||||
|
deferred = (new openerp.web.Model('ir.config_parameter'))
|
||||||
|
.call('get_param',
|
||||||
|
['web_dialog_size.default_maximize'])
|
||||||
|
.then(function(default_maximize)
|
||||||
|
{
|
||||||
|
openerp.web_dialog_size.default_maximize =
|
||||||
|
default_maximize;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return jQuery.when(deferred).then(function()
|
||||||
|
{
|
||||||
|
if(openerp.web_dialog_size.default_maximize)
|
||||||
|
{
|
||||||
|
self._extending();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
self._restore();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_extending: function() {
|
_extending: function(e) {
|
||||||
var self = this;
|
var dialog = this.$el.parents('.modal-dialog');
|
||||||
$(this).parents('.modal-dialog').addClass('dialog_full_screen');
|
dialog.addClass('dialog_full_screen');
|
||||||
$(this).addClass('dialog_button_hide');
|
dialog.find('.dialog_button_extend').hide();
|
||||||
|
dialog.find('.dialog_button_restore').show();
|
||||||
$(this).parents('.modal-dialog').find('.dialog_button_restore').removeClass('dialog_button_hide')
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_restore: function() {
|
_restore: function(e) {
|
||||||
var self = this;
|
var dialog = this.$el.parents('.modal-dialog');
|
||||||
$(this).parents('.modal-dialog').removeClass('dialog_full_screen');
|
dialog.removeClass('dialog_full_screen');
|
||||||
$(this).addClass('dialog_button_hide');
|
dialog.find('.dialog_button_restore').hide();
|
||||||
|
dialog.find('.dialog_button_extend').show();
|
||||||
$(this).parents('.modal-dialog').find('.dialog_button_extend').removeClass('dialog_button_hide')
|
|
||||||
},
|
},
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<templates id="template" xml:space="preserve">
|
<templates id="template" xml:space="preserve">
|
||||||
<t t-extend="Dialog">
|
<t t-extend="Dialog">
|
||||||
<t t-jquery="button" t-operation="after">
|
<t t-jquery="button.close" t-operation="inner">
|
||||||
<button type="button" class="dialog_button_extend close">o</button>
|
<i class="fa fa-close" />
|
||||||
<button type="button" class="dialog_button_restore close">-</button>
|
</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>
|
||||||
</t>
|
</t>
|
||||||
</templates>
|
</templates>
|
Loading…
Reference in New Issue