From ed445ff91a15f18ee98cd8af202e7799d8480f6b Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Mon, 15 Oct 2012 15:38:15 +0200 Subject: [PATCH] [REVERT] revert commit 3224 because it didn't reproduced the original behavior and some on_close were forgotten bzr revid: nicolas.vanhoren@openerp.com-20121015133815-hmkz6h1bkhnbq7up --- addons/web/static/src/js/chrome.js | 8 +++++--- addons/web/static/src/js/views.js | 5 ++--- addons/web_view_editor/static/src/js/view_editor.js | 1 + 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index c993f3e3ad1..078082d07fd 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -70,7 +70,7 @@ instance.web.Dialog = instance.web.Widget.extend({ autoOpen: false, position: [false, 40], buttons: {}, - beforeClose: function () { self.close(); }, + beforeClose: function () { self.on_close(); }, resizeStop: this.on_resized }; for (var f in this) { @@ -150,14 +150,16 @@ instance.web.Dialog = instance.web.Widget.extend({ var res = this.start(); return res; }, - close: function() { + close: function() { + this.$el.dialog('close'); + }, + on_close: function() { if (this.__tmp_dialog_destroying) return; if (this.dialog_options.destroy_on_close) { this.__tmp_dialog_closing = true; this.destroy(); this.__tmp_dialog_closing = undefined; - this.trigger("dialog_close"); } }, on_resized: function() { diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index b5bb3a7259d..78cab1c3e33 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -296,9 +296,8 @@ instance.web.ActionManager = instance.web.Widget.extend({ buttons: { "Close": function() { $(this).dialog("close"); }}, dialogClass: executor.klass }); - if (on_close) { - this.dialog.on("dialog_close", this, on_close); - } + if(on_close) + this.dialog.on_close.add(on_close); } else { this.dialog_widget.destroy(); } diff --git a/addons/web_view_editor/static/src/js/view_editor.js b/addons/web_view_editor/static/src/js/view_editor.js index 5e7c61ab17c..63dc864c916 100644 --- a/addons/web_view_editor/static/src/js/view_editor.js +++ b/addons/web_view_editor/static/src/js/view_editor.js @@ -67,6 +67,7 @@ instance.web_view_editor.ViewEditor = instance.web.Widget.extend({ {text: _t("Close"), click: function() { self.view_edit_dialog.close(); window.location.reload(); }} ] }).open(); + this.view_edit_dialog.on_close.add_last(function(){window.location.reload();}); this.main_view_id = this.parent.fields_view.view_id; this.action_manager = new instance.web.ActionManager(this); this.action_manager.appendTo(this.view_edit_dialog.$el);