From 3210f108272be89f1a7b01f4e1816b7f04ae0a3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20K=C3=BChn?= Date: Mon, 16 Jul 2018 11:03:47 +0200 Subject: [IMP] web: provide infos for close action With this commit, when we perform a close action, we can provide infos to the `on_close` handler, so that it can handle different cases that caused the close action. --- addons/web/static/src/js/core/dialog.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'addons/web/static/src/js/core/dialog.js') diff --git a/addons/web/static/src/js/core/dialog.js b/addons/web/static/src/js/core/dialog.js index 075c7359a55..847845ae17e 100644 --- a/addons/web/static/src/js/core/dialog.js +++ b/addons/web/static/src/js/core/dialog.js @@ -189,12 +189,22 @@ var Dialog = Widget.extend({ this.destroy(); }, - destroy: function (arg) { + /** + * Close and destroy the dialog. + * + * @param {Object} [options] + * @param {Object} [options.infos] if provided and `silent` is unset, the + * `on_close` handler will pass this information related to closing this + * information. + * @param {boolean} [options.silent=false] if set, do not call the + * `on_close` handler. + */ + destroy: function (options) { // Need to trigger before real destroy but if 'closed' handler destroys // the widget again, we want to avoid infinite recursion if (!this.__closed) { this.__closed = true; - this.trigger("closed", arg); + this.trigger('closed', options); } if (this.isDestroyed()) { -- cgit v1.2.3