[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.
This commit is contained in:
Aaron Bohy
2016-09-28 16:55:51 +02:00
committed by Géry Debongnie
parent 442355518d
commit 66cb0d7aa3
3 changed files with 6 additions and 6 deletions
+1 -2
View File
@@ -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);
});
@@ -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));
});
},
});
@@ -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);