[FIX] removed dirty hack to put buttons in footer of dialogs with an official dirty feature

bzr revid: nicolas.vanhoren@openerp.com-20121016125627-vevqllvshay5fpv4
This commit is contained in:
niv-openerp 2012-10-16 14:56:27 +02:00
parent a3cef23827
commit 73950424bb
2 changed files with 10 additions and 9 deletions

View File

@ -110,6 +110,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
"not_interactible_on_create": false,
"initial_mode": "view",
"disable_autofocus": false,
"footer_to_buttons": false,
});
this.is_initialized = $.Deferred();
this.mutating_mutex = new $.Mutex();
@ -166,6 +167,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
this.$buttons = $(QWeb.render("FormView.buttons", {'widget':self}));
if (this.options.$buttons) {
this.options.$buttons.children().remove();
this.$buttons.appendTo(this.options.$buttons);
} else {
this.$el.find('.oe_form_buttons').replaceWith(this.$buttons);
@ -174,6 +176,9 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
this.$buttons.on('click', '.oe_form_button_edit', this.on_button_edit);
this.$buttons.on('click', '.oe_form_button_save', this.on_button_save);
this.$buttons.on('click', '.oe_form_button_cancel', this.on_button_cancel);
if (this.options.footer_to_buttons) {
this.$el.find('footer').appendTo(this.$buttons);
}
this.$sidebar = this.options.$sidebar || this.$el.find('.oe_form_sidebar');
if (!this.sidebar && this.options.$sidebar) {

View File

@ -293,7 +293,7 @@ instance.web.ActionManager = instance.web.Widget.extend({
if (this.dialog === null || this.dialog.isDestroyed()) {
this.dialog = new instance.web.Dialog(this, {
buttons: {"Close": function() {$(this).dialog("close")}},
dialogClass: executor.klass
dialogClass: executor.klass,
});
if (on_close)
this.dialog.on("closing", null, on_close);
@ -303,7 +303,10 @@ instance.web.ActionManager = instance.web.Widget.extend({
}
this.dialog.dialog_title = executor.action.name;
if (widget instanceof instance.web.ViewManager) {
_.extend(widget.flags, {$buttons: this.dialog.$buttons,});
_.extend(widget.flags, {
$buttons: this.dialog.$buttons,
footer_to_buttons: true,
});
}
this.dialog_widget = widget;
var initialized = this.dialog_widget.appendTo(this.dialog.$el);
@ -497,13 +500,6 @@ instance.web.ViewManager = instance.web.Widget.extend({
container.hide();
controller.do_hide();
}
// put the <footer> in the dialog's buttonpane
if (self.$el.parent('.ui-dialog-content') && self.$el.find('footer')) {
self.$el.parent('.ui-dialog-content').parent().find('div.ui-dialog-buttonset').hide()
self.$el.find('footer').appendTo(
self.$el.parent('.ui-dialog-content').parent().find('div.ui-dialog-buttonpane')
);
}
}
});
self.trigger('switch_mode', view_type, no_store, view_options);