mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[ADD] module web_dialog_size
New module that let the user expand a dialog box to the full screen width.
This commit is contained in:
committed by
Pedro M. Baeza
parent
a095b86105
commit
a8122d3553
17
web_dialog_size/static/src/css/web_dialog_size.css
Normal file
17
web_dialog_size/static/src/css/web_dialog_size.css
Normal file
@@ -0,0 +1,17 @@
|
||||
.modal .modal-header button.dialog_button_extend {
|
||||
padding-top: 0px;
|
||||
padding-right: 3px;
|
||||
}
|
||||
|
||||
.modal .modal-header button.dialog_button_restore {
|
||||
padding-top: 1px;
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
.modal .modal-header .dialog_button_hide {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.dialog_full_screen {
|
||||
width: calc(100% - 50px);
|
||||
}
|
||||
37
web_dialog_size/static/src/js/web_dialog_size.js
Normal file
37
web_dialog_size/static/src/js/web_dialog_size.js
Normal file
@@ -0,0 +1,37 @@
|
||||
openerp.web_dialog_size= function (instance) {
|
||||
|
||||
instance.web.Dialog = instance.web.Dialog.extend({
|
||||
|
||||
init_dialog: function () {
|
||||
var self = this;
|
||||
this._super();
|
||||
self.$dialog_box.find('.dialog_button_restore').addClass('dialog_button_hide');
|
||||
if (this.dialog_options.size !== 'large'){
|
||||
self.$dialog_box.find('.dialog_button_extend').addClass('dialog_button_hide');
|
||||
}
|
||||
else{
|
||||
self.$dialog_box.find('.dialog_button_extend').on('click', self._extending);
|
||||
self.$dialog_box.find('.dialog_button_restore').on('click', self._restore);
|
||||
}
|
||||
},
|
||||
|
||||
_extending: function() {
|
||||
var self = this;
|
||||
$(this).parents('.modal-dialog').addClass('dialog_full_screen');
|
||||
$(this).addClass('dialog_button_hide');
|
||||
|
||||
$(this).parents('.modal-dialog').find('.dialog_button_restore').removeClass('dialog_button_hide')
|
||||
},
|
||||
|
||||
_restore: function() {
|
||||
var self = this;
|
||||
$(this).parents('.modal-dialog').removeClass('dialog_full_screen');
|
||||
$(this).addClass('dialog_button_hide');
|
||||
|
||||
$(this).parents('.modal-dialog').find('.dialog_button_extend').removeClass('dialog_button_hide')
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
9
web_dialog_size/static/src/xml/web_dialog_size.xml
Normal file
9
web_dialog_size/static/src/xml/web_dialog_size.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates id="template" xml:space="preserve">
|
||||
<t t-extend="Dialog">
|
||||
<t t-jquery="button" t-operation="after">
|
||||
<button type="button" class="dialog_button_extend close">o</button>
|
||||
<button type="button" class="dialog_button_restore close">-</button>
|
||||
</t>
|
||||
</t>
|
||||
</templates>
|
||||
Reference in New Issue
Block a user