3
0
Fork 0

[FIX] web_dialog_size js warnings

13.0
emagdalena 2019-10-14 12:38:54 +02:00
parent 23e6fa8524
commit cc1a521d70
3 changed files with 60 additions and 56 deletions

View File

@ -1,66 +1,70 @@
odoo.define('web_dialog_size.web_dialog_size', function (require) { odoo.define('web_dialog_size.web_dialog_size', function (require) {
'use strict'; 'use strict';
var rpc = require('web.rpc'); var rpc = require('web.rpc');
var Dialog = require('web.Dialog'); var Dialog = require('web.Dialog');
var config = rpc.query({ var config = rpc.query({
model: 'ir.config_parameter', model: 'ir.config_parameter',
method: 'get_web_dialog_size_config', method: 'get_web_dialog_size_config',
}); });
Dialog.include({ Dialog.include({
willStart: function () { willStart: function () {
var self = this; var self = this;
return this._super.apply(this, arguments).then(function () { return this._super.apply(this, arguments).then(function () {
self.$modal.find('.dialog_button_extend').on('click', self.proxy('_extending')); self.$modal.find('.dialog_button_extend').on('click',
self.$modal.find('.dialog_button_restore').on('click', self.proxy('_restore')); self.proxy('_extending')
return config.then(function(r) { );
if (r.default_maximize) { self.$modal.find('.dialog_button_restore').on('click',
self._extending(); self.proxy('_restore')
} else { );
self._restore(); return config.then(function (r) {
} if (r.default_maximize) {
}); self._extending();
}); } else {
}, self._restore();
}
opened: function(handler) {
return this._super.apply(this, arguments).then(function(){
if (this.$modal) {
this.$modal.draggable({
handle: '.modal-header',
helper: false
}); });
});
},
opened: function () {
return this._super.apply(this, arguments).then(function () {
if (this.$modal) {
this.$modal.draggable({
handle: '.modal-header',
helper: false,
});
}
}.bind(this));
},
close: function () {
if (this.$modal) {
var draggable = this.$modal.draggable("instance");
if (draggable) {
this.$modal.draggable("destroy");
}
} }
}.bind(this)); return this._super.apply(this, arguments);
}, },
close: function() { _extending: function () {
if (this.$modal) { var dialog = this.$modal.find('.modal-dialog');
var draggable = this.$modal.draggable("instance"); dialog.addClass('dialog_full_screen');
if (draggable) { dialog.find('.dialog_button_extend').hide();
this.$modal.draggable("destroy"); dialog.find('.dialog_button_restore').show();
} },
}
return this._super.apply(this, arguments);
},
_extending: function() { _restore: function () {
var dialog = this.$modal.find('.modal-dialog'); var dialog = this.$modal.find('.modal-dialog');
dialog.addClass('dialog_full_screen'); dialog.removeClass('dialog_full_screen');
dialog.find('.dialog_button_extend').hide(); dialog.find('.dialog_button_restore').hide();
dialog.find('.dialog_button_restore').show(); dialog.find('.dialog_button_extend').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();
},
});
}); });

View File

@ -14,7 +14,7 @@
"installable": True, "installable": True,
"depends": ["web", "mail"], "depends": ["web", "mail"],
"development_status": "Production/Stable", "development_status": "Production/Stable",
"maintainers": ['Yajo', 'Tardo'], "maintainers": ["Yajo", "Tardo"],
"data": ["views/assets.xml", "views/res_users.xml", "views/web.xml"], "data": ["views/assets.xml", "views/res_users.xml", "views/web.xml"],
"qweb": [ "qweb": [
"static/src/xml/apps.xml", "static/src/xml/apps.xml",