summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2015-06-30 14:34:45 +0200
committerAaron Bohy <aab@odoo.com>2015-07-01 11:36:31 +0200
commit3a511aaa700bc9965cd6967b2b8fb1b21ccdce8d (patch)
tree77f1f1610322124d6d59512440e769522339891a
parentc128ddf827bc7da0be1b9901ebc6a4c3a2268ed8 (diff)
[IMP] web,web_kanban: Dialog.confirm api
takes now an object of options for the Dialog, containing two possible callbacks (for confirm and cancel).
-rw-r--r--addons/web/static/src/js/framework/dialog.js16
-rw-r--r--addons/web_kanban/static/src/js/kanban_view.js2
2 files changed, 11 insertions, 7 deletions
diff --git a/addons/web/static/src/js/framework/dialog.js b/addons/web/static/src/js/framework/dialog.js
index 45a00bcaa60..7053b29bc22 100644
--- a/addons/web/static/src/js/framework/dialog.js
+++ b/addons/web/static/src/js/framework/dialog.js
@@ -147,24 +147,28 @@ var Dialog = Widget.extend({
// static method to open simple confirm dialog
-Dialog.confirm = function (owner, message, confirm_callback) {
+Dialog.confirm = function (owner, message, options) {
var buttons = [
{
text: _t("Ok"),
classes: 'btn-primary',
close: true,
- click: confirm_callback
+ click: options && options.confirm_callback
},
- {text: _t("Cancel"), close: true}
+ {
+ text: _t("Cancel"),
+ close: true,
+ click: options && options.cancel_callback
+ }
];
- return new Dialog(owner, {
+ return new Dialog(owner, _.extend({
size: 'medium',
buttons: buttons,
$content: $('<div>', {
text: message,
}),
- }).open();
-}
+ }, options)).open();
+};
return Dialog;
diff --git a/addons/web_kanban/static/src/js/kanban_view.js b/addons/web_kanban/static/src/js/kanban_view.js
index e45bbb65df6..73ddfa31d55 100644
--- a/addons/web_kanban/static/src/js/kanban_view.js
+++ b/addons/web_kanban/static/src/js/kanban_view.js
@@ -448,7 +448,7 @@ var KanbanView = View.extend({
});
}
if (this.options.confirm_on_delete) {
- Dialog.confirm(this, _t("Are you sure you want to delete this record ?"), do_it);
+ Dialog.confirm(this, _t("Are you sure you want to delete this record ?"), { confirm_callback: do_it });
} else {
do_it();
}