[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:
Anthony Muschang
2015-02-27 00:29:22 +01:00
committed by Mantux11
parent 23cec05e3c
commit 2c1216c791
8 changed files with 158 additions and 0 deletions

View 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')
},
});
};