diff options
| author | Christophe Simonis <chs@odoo.com> | 2016-09-30 17:23:30 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2016-09-30 17:23:30 +0200 |
| commit | c8cc54559b75a621e4444ecdca6abd901b45e494 (patch) | |
| tree | 92141325d4dbbf70bbfb8e0c040d4435c8d2378f /addons/web/static/src/js/widgets | |
| parent | b2804b1d2ae5fd7ec5c0eca79a8db77476badc84 (diff) | |
| parent | 91a14488250bc2bb405cc6d300359aa272642484 (diff) | |
[MERGE] forward port branch 10.0 up to 91a1448
Diffstat (limited to 'addons/web/static/src/js/widgets')
| -rw-r--r-- | addons/web/static/src/js/widgets/debug_manager.js | 27 | ||||
| -rw-r--r-- | addons/web/static/src/js/widgets/systray_menu.js | 7 |
2 files changed, 12 insertions, 22 deletions
diff --git a/addons/web/static/src/js/widgets/debug_manager.js b/addons/web/static/src/js/widgets/debug_manager.js index f191eb739ea..f7ddd008e1d 100644 --- a/addons/web/static/src/js/widgets/debug_manager.js +++ b/addons/web/static/src/js/widgets/debug_manager.js @@ -48,7 +48,6 @@ var DebugManager = Widget.extend({ } }, start: function () { - core.bus.on('current_action_updated', this, this.update.bind(this, 'action')); core.bus.on('rpc:result', this, function (req, resp) { this._debug_events(resp.debug); }); @@ -647,26 +646,12 @@ if (core.debug) { SystrayMenu.Items.push(DebugManager); WebClient.include({ - start: function() { - var self = this; - return this._super().then(function () { - // Override push_action and select_action so that it triggers - // an event each time a new action is pushed. - // The DebugManager listens to this event to keep itself up-to-date - var push_action = self.action_manager.push_action; - self.action_manager.push_action = function(widget, descr) { - return push_action.apply(self.action_manager, arguments).then(function () { - core.bus.trigger('current_action_updated', descr, widget); - }); - }; - var select_action = self.action_manager.select_action; - self.action_manager.select_action = function() { - return select_action.apply(self.action_manager, arguments).then(function () { - var action = self.action_manager.get_inner_action(); - core.bus.trigger('current_action_updated', action.action_descr, action.widget); - }); - }; - }); + current_action_updated: function(action) { + this._super.apply(this, arguments); + var action_descr = action && action.action_descr; + var action_widget = action && action.widget; + var debug_manager = _.find(this.systray_menu.widgets, function(item) {return item instanceof DebugManager; }); + debug_manager.update('action', action_descr, action_widget); }, }); diff --git a/addons/web/static/src/js/widgets/systray_menu.js b/addons/web/static/src/js/widgets/systray_menu.js index 131954de15f..0d0e18476b0 100644 --- a/addons/web/static/src/js/widgets/systray_menu.js +++ b/addons/web/static/src/js/widgets/systray_menu.js @@ -11,6 +11,7 @@ var SystrayMenu = Widget.extend({ init: function(parent) { this._super(parent); this.items = []; + this.widgets = []; this.load = $.Deferred(); }, start: function() { @@ -24,9 +25,13 @@ var SystrayMenu = Widget.extend({ }, load_items: function() { var self = this; + SystrayMenu.Items = _.sortBy(SystrayMenu.Items, function (item) { + return !_.isUndefined(item.prototype.sequence) ? item.prototype.sequence : 50; + }); _.each(SystrayMenu.Items, function(widgetCls) { var cur_systray_item = new widgetCls(self); - self.items.push(cur_systray_item.appendTo(self.$el)); + self.widgets.push(cur_systray_item); + self.items.push(cur_systray_item.prependTo(self.$el)); }); }, }); |
