[IMP] removed on_close in Dialog

bzr revid: nicolas.vanhoren@openerp.com-20121015135236-r5809kwwbcqo67tj
This commit is contained in:
niv-openerp 2012-10-15 15:52:36 +02:00
parent ede4edc156
commit 04353719e9
5 changed files with 15 additions and 14 deletions

View File

@ -70,7 +70,7 @@ instance.web.Dialog = instance.web.Widget.extend({
autoOpen: false, autoOpen: false,
position: [false, 40], position: [false, 40],
buttons: {}, buttons: {},
beforeClose: function () { self.on_close(); }, beforeClose: function () { self.trigger("closing") },
resizeStop: this.on_resized resizeStop: this.on_resized
}; };
for (var f in this) { for (var f in this) {
@ -84,6 +84,7 @@ instance.web.Dialog = instance.web.Widget.extend({
} }
_.extend(this.dialog_options, options); _.extend(this.dialog_options, options);
} }
this.on("closing", this, this._closing);
}, },
get_options: function(options) { get_options: function(options) {
var self = this, var self = this,
@ -153,7 +154,7 @@ instance.web.Dialog = instance.web.Widget.extend({
close: function() { close: function() {
this.$el.dialog('close'); this.$el.dialog('close');
}, },
on_close: function() { _closing: function() {
if (this.__tmp_dialog_destroying) if (this.__tmp_dialog_destroying)
return; return;
if (this.dialog_options.destroy_on_close) { if (this.dialog_options.destroy_on_close) {

View File

@ -297,7 +297,7 @@ instance.web.ActionManager = instance.web.Widget.extend({
dialogClass: executor.klass dialogClass: executor.klass
}); });
if(on_close) if(on_close)
this.dialog.on_close.add(on_close); this.dialog.on("closing", null, on_close);
} else { } else {
this.dialog_widget.destroy(); this.dialog_widget.destroy();
} }

View File

@ -450,6 +450,12 @@ instance.web_calendar.CalendarFormDialog = instance.web.Dialog.extend({
this.dataset = dataset; this.dataset = dataset;
this.view_id = view_id; this.view_id = view_id;
this.view = view; this.view = view;
this.on("closing", this, function() {
if (this.view.creating_event_id) {
scheduler.deleteEvent(this.view.creating_event_id);
this.view.creating_event_id = null;
}
});
}, },
start: function() { start: function() {
var self = this; var self = this;
@ -475,12 +481,6 @@ instance.web_calendar.CalendarFormDialog = instance.web.Dialog.extend({
this.view.reload_event(id); this.view.reload_event(id);
this.close(); this.close();
}, },
on_close: function() {
if (this.view.creating_event_id) {
scheduler.deleteEvent(this.view.creating_event_id);
this.view.creating_event_id = null;
}
}
}); });
instance.web_calendar.Sidebar = instance.web.Widget.extend({ instance.web_calendar.Sidebar = instance.web.Widget.extend({

View File

@ -194,10 +194,10 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
}); });
var am = instance.webclient.action_manager; var am = instance.webclient.action_manager;
var form = am.dialog_widget.views.form.controller; var form = am.dialog_widget.views.form.controller;
form.on("on_button_cancel", self, am.dialog.on_close); form.on("on_button_cancel", am.dialog, am.dialog.close);
form.on('record_created', self, function(r) { form.on('record_created', self, function(r) {
(new instance.web.DataSet(self, self.group_by_field.relation)).name_get([r]).then(function(new_record) { (new instance.web.DataSet(self, self.group_by_field.relation)).name_get([r]).then(function(new_record) {
am.dialog.on_close(); am.dialog.close();
var domain = self.dataset.domain.slice(0); var domain = self.dataset.domain.slice(0);
domain.push([self.group_by, '=', new_record[0][0]]); domain.push([self.group_by, '=', new_record[0][0]]);
var dataset = new instance.web.DataSetSearch(self, self.dataset.model, self.dataset.get_context(), domain); var dataset = new instance.web.DataSetSearch(self, self.dataset.model, self.dataset.get_context(), domain);
@ -672,9 +672,9 @@ instance.web_kanban.KanbanGroup = instance.web.Widget.extend({
}); });
var am = instance.webclient.action_manager; var am = instance.webclient.action_manager;
var form = am.dialog_widget.views.form.controller; var form = am.dialog_widget.views.form.controller;
form.on("on_button_cancel", self, am.dialog.on_close); form.on("on_button_cancel", am.dialog, am.dialog.close);
form.on('record_saved', self, function() { form.on('record_saved', self, function() {
am.dialog.on_close(); am.dialog.close();
self.view.do_reload(); self.view.do_reload();
}); });
}, },

View File

@ -67,7 +67,7 @@ instance.web_view_editor.ViewEditor = instance.web.Widget.extend({
{text: _t("Close"), click: function() { self.view_edit_dialog.close(); window.location.reload(); }} {text: _t("Close"), click: function() { self.view_edit_dialog.close(); window.location.reload(); }}
] ]
}).open(); }).open();
this.view_edit_dialog.on_close.add_last(function(){window.location.reload();}); this.view_edit_dialog.on("closing", this, function(){window.location.reload();});
this.main_view_id = this.parent.fields_view.view_id; this.main_view_id = this.parent.fields_view.view_id;
this.action_manager = new instance.web.ActionManager(this); this.action_manager = new instance.web.ActionManager(this);
this.action_manager.appendTo(this.view_edit_dialog.$el); this.action_manager.appendTo(this.view_edit_dialog.$el);