[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 Pedro M. Baeza
parent a095b86105
commit a8122d3553
8 changed files with 158 additions and 0 deletions

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

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

View 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>