From 66cb0d7aa3d286f3d57a7a675fd7102406dc82a5 Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Tue, 12 Jul 2016 15:04:09 +0200 Subject: [PATCH] [IMP] mail,web,web_planner: order of systray items Sort systray items by sequence to allow, e.g. to force the planner item to be the left-most item of the systray as it is not displayed in all apps, and thus produces a flickering of the other items. Also invert the push order of the two mail items to keep the previous order as they are now prepended instead of appended. --- addons/mail/static/src/js/systray.js | 3 +-- addons/web/static/src/js/widgets/systray_menu.js | 5 ++++- addons/web_planner/static/src/js/web_planner_backend.js | 4 +--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/mail/static/src/js/systray.js b/addons/mail/static/src/js/systray.js index aa8c10a0c04..cd49e72042b 100644 --- a/addons/mail/static/src/js/systray.js +++ b/addons/mail/static/src/js/systray.js @@ -42,8 +42,6 @@ var InboxItem = Widget.extend({ }, 1000, true), }); -SystrayMenu.Items.push(InboxItem); - /** * Menu item appended in the systray part of the navbar * @@ -148,5 +146,6 @@ var MessagingMenu = Widget.extend({ }); SystrayMenu.Items.push(MessagingMenu); +SystrayMenu.Items.push(InboxItem); }); diff --git a/addons/web/static/src/js/widgets/systray_menu.js b/addons/web/static/src/js/widgets/systray_menu.js index 131954de15f..025d8c83970 100644 --- a/addons/web/static/src/js/widgets/systray_menu.js +++ b/addons/web/static/src/js/widgets/systray_menu.js @@ -24,9 +24,12 @@ 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.items.push(cur_systray_item.prependTo(self.$el)); }); }, }); diff --git a/addons/web_planner/static/src/js/web_planner_backend.js b/addons/web_planner/static/src/js/web_planner_backend.js index 0044905d6bb..8bf55f2190e 100644 --- a/addons/web_planner/static/src/js/web_planner_backend.js +++ b/addons/web_planner/static/src/js/web_planner_backend.js @@ -2,18 +2,16 @@ odoo.define('web.planner', function (require) { "use strict"; var core = require('web.core'); -var Dialog = require('web.Dialog'); var Model = require('web.Model'); var SystrayMenu = require('web.SystrayMenu'); var Widget = require('web.Widget'); var planner = require('web.planner.common'); var webclient = require('web.web_client'); -var QWeb = core.qweb; -var _t = core._t; var PlannerDialog = planner.PlannerDialog; var PlannerLauncher = Widget.extend({ + sequence: 100, // force it to be the left-most item in the systray to prevent flickering as it is not displayed in all apps template: "PlannerLauncher", init: function(parent) { this._super(parent);