diff options
| author | qsm-odoo <qsm@odoo.com> | 2016-02-23 10:44:48 +0100 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2016-02-23 13:40:17 +0100 |
| commit | 8f2be0d61ba90bac34c47728f3cc4f1a5004c84b (patch) | |
| tree | 2856e839506d16bd35441925201fbb8432824ea8 /addons/web/static/src/js/framework | |
| parent | 7eab8e26d3d46c53f4be924d6a34e80a66e74960 (diff) | |
[IMP] web: update Dialog class
Update Dialog class with enterprise version.
Diffstat (limited to 'addons/web/static/src/js/framework')
| -rw-r--r-- | addons/web/static/src/js/framework/dialog.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/addons/web/static/src/js/framework/dialog.js b/addons/web/static/src/js/framework/dialog.js index b5e63834614..cbd3baa2a85 100644 --- a/addons/web/static/src/js/framework/dialog.js +++ b/addons/web/static/src/js/framework/dialog.js @@ -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"); |
