Denis Ledoux (OpenERP) has proposed merging 
lp:~openerp-dev/openerp-web/trunk-bug-1078640-dle into lp:openerp-web.

Requested reviews:
  Nicolas (OpenERP) (niv-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-bug-1078640-dle/+merge/135142

[FIX]Add_button according to jquery doc" 
Fix bugs lp:1078640
-- 
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-bug-1078640-dle/+merge/135142
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openerp-web/trunk-bug-1078640-dle.
=== modified file 'addons/web/static/src/js/chrome.js'
--- addons/web/static/src/js/chrome.js	2012-11-20 09:50:42 +0000
+++ addons/web/static/src/js/chrome.js	2012-11-20 12:49:29 +0000
@@ -140,6 +140,7 @@
     },
     _add_buttons: function(buttons) {
         var self = this;
+<<<<<<< TREE
         _.each(buttons, function(fn, text) {
             // buttons can be object or array
             if (!_.isFunction(fn)) {
@@ -150,8 +151,29 @@
             self.$buttons.append($but);
             $but.on('click', function(ev) {
                 fn.call(self.$el, ev);
+=======
+        if (buttons instanceof Array){
+            _.each(buttons, function(fn) {
+                var $but = $(QWeb.render('WidgetButton', { widget : { string: fn.text, node: { attrs: {} }}}));
+                self.$buttons.append($but);
+                $but.on('click', function(ev) {
+                    fn.call(self.$el, ev);
+                });
+>>>>>>> MERGE-SOURCE
             });
-        });
+        }
+        else if(buttons instanceof Object){
+            for(var prop in buttons) {
+                var $but = $(QWeb.render('WidgetButton', { widget : { string: prop, node: { attrs: {} }}}));
+                self.$buttons.append($but);
+                $but.on('click', function(ev) {
+                    buttons[prop].call(self.$el, ev);
+                });
+            }
+        }
+        else{
+            throw new Error("Buttons in instance.web.Dialog options should be either an array or an object");
+        }
     },
     init_dialog: function(options) {
         this.renderElement();

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : openerp-dev-gtk@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to