[IMP] web: update Dialog class

Update Dialog class with enterprise version.
This commit is contained in:
qsm-odoo
2016-02-23 13:40:17 +01:00
parent 7eab8e26d3
commit 8f2be0d61b
+9 -2
View File
@@ -31,6 +31,7 @@ var Dialog = Widget.extend({
*/
init: function (parent, options) {
this._super(parent);
this._opened = $.Deferred();
options = _.defaults(options || {}, {
title: _t('Odoo'), subtitle: '',
@@ -96,7 +97,7 @@ var Dialog = Widget.extend({
set_title: function(title, subtitle) {
this.title = title || "";
if(subtitle !== undefined) {
if (subtitle !== undefined) {
this.subtitle = subtitle || "";
}
@@ -108,6 +109,10 @@ var Dialog = Widget.extend({
return this;
},
opened: function(handler) {
return (handler)? this._opened.then(handler) : this._opened;
},
open: function() {
$('.tooltip').remove(); // remove open tooltip if any to prevent them staying when modal is opened
@@ -115,6 +120,7 @@ var Dialog = Widget.extend({
this.replace(this.$modal.find(".modal-body")).then(function() {
self.$el.addClass('modal-body ' + self.dialogClass);
self.$modal.modal('show');
self._opened.resolve();
});
return self;
@@ -125,8 +131,9 @@ var Dialog = Widget.extend({
},
destroy: function() {
if(this.isDestroyed())
if (this.isDestroyed()) {
return;
}
this.trigger("closed");