summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorniv-openerp <nicolas.vanhoren@openerp.com>2012-09-18 16:31:01 +0200
committerniv-openerp <nicolas.vanhoren@openerp.com>2012-09-18 16:31:01 +0200
commit2c09f43b7efe7d7696d87029b1107ce563c4dfc3 (patch)
tree72d16a60e0ec97da05d29bda2e6eb6129a0ae176 /addons/web/static/src
parent4b896c36af9f94f66e998331c7504d7fdcd41b8c (diff)
[IMP] Added helper for buttons in dialogs
bzr revid: nicolas.vanhoren@openerp.com-20120918143101-wbdyaou23l8wx9zd
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/chrome.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js
index 3114aaf315f..d5b45a87bf5 100644
--- a/addons/web/static/src/js/chrome.js
+++ b/addons/web/static/src/js/chrome.js
@@ -79,6 +79,9 @@ instance.web.Dialog = instance.web.Widget.extend({
}
}
if (options) {
+ if (options.buttons) {
+ this.params_buttons = true;
+ }
_.extend(this.dialog_options, options);
}
},
@@ -123,7 +126,13 @@ instance.web.Dialog = instance.web.Widget.extend({
if (! this.dialog_inited)
this.init_dialog();
var o = this.get_options(options);
+ if (! this.no_erase_buttons) {
+ this.$buttons.appendTo($("body"));
+ }
instance.web.dialog(this.$el, o).dialog('open');
+ if (! this.no_erase_buttons) {
+ this.$buttons.appendTo(this.$el.dialog("widget"));
+ }
if (o.height === 'auto' && o.max_height) {
this.$el.css({ 'max-height': o.max_height, 'overflow-y': 'auto' });
}
@@ -133,6 +142,10 @@ instance.web.Dialog = instance.web.Widget.extend({
this.renderElement();
var o = this.get_options(options);
instance.web.dialog(this.$el, o);
+ if (! this.params_buttons) {
+ this.$buttons = $('<div class="ui-dialog-buttonpane ui-widget-content ui-helper-clearfix" />');
+ this.$el.dialog("widget").append(this.$buttons);
+ }
var res = this.start();
this.dialog_inited = true;
return res;