diff options
| author | Aaron Bohy <aab@odoo.com> | 2014-12-24 15:13:48 +0100 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2015-01-07 15:13:51 +0100 |
| commit | ba083dbb470be443ac306d33cf83c66dcc5da868 (patch) | |
| tree | aa2df4a6c374fbf330976682e1552f1a5fa1dbc1 /addons/im_chat/static/src/js | |
| parent | ecc3bb7647bde73cc34ea827be08ce6f8f13e375 (diff) | |
[IMP] Web: navbar isn't displayed on several lines while rendering
- Add a new SystrayMenu widget to improve and facilitate the way
of adding widgets in .oe_systray
- Rendering of the modules menu now waits for the systray and
user menus to be rendered
- A few refactoring of the UserMenu and Menu widgets
Diffstat (limited to 'addons/im_chat/static/src/js')
| -rw-r--r-- | addons/im_chat/static/src/js/im_chat.js | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/addons/im_chat/static/src/js/im_chat.js b/addons/im_chat/static/src/js/im_chat.js index 3ffbbb6ee07..4929fad2050 100644 --- a/addons/im_chat/static/src/js/im_chat.js +++ b/addons/im_chat/static/src/js/im_chat.js @@ -601,31 +601,29 @@ events: { "click": "clicked", }, + start: function() { + // Create the InstantMessaging widget and put it in the DOM + var im = new openerp.im_chat.InstantMessaging(self); + openerp.im_chat.single = im; + im.appendTo(openerp.client.$el); + // Bind the click action to the ImTopButton + this.on("clicked", im, im.switch_display); + return this._super(); + }, clicked: function(ev) { ev.preventDefault(); this.trigger("clicked"); }, }); - if(openerp.web && openerp.web.UserMenu) { - openerp.web.UserMenu.include({ - do_update: function(){ - var self = this; - var Users = new openerp.web.Model('res.users'); - Users.call('has_group', ['base.group_user']).done(function(is_employee) { - if (is_employee) { - self.update_promise.then(function() { - var im = new openerp.im_chat.InstantMessaging(self); - openerp.im_chat.single = im; - im.appendTo(openerp.client.$el); - var button = new openerp.im_chat.ImTopButton(this); - button.on("clicked", im, im.switch_display); - button.appendTo(window.$('.oe_systray')); - }); - } - }); - return this._super.apply(this, arguments); - }, + // Guard: only for the backend + if (openerp.web && openerp.web.Model) { + // Put the ImTopButton widget in the systray menu if the user is an employee + var Users = new openerp.web.Model('res.users'); + Users.call('has_group', ['base.group_user']).done(function(is_employee) { + if (is_employee) { + openerp.web.SystrayItems.push(openerp.im_chat.ImTopButton); + } }); } |
