diff options
| author | Alexandre Kühn <aku@odoo.com> | 2018-10-15 14:33:02 +0000 |
|---|---|---|
| committer | Alexandre Kühn <aku@odoo.com> | 2018-10-15 14:37:21 +0000 |
| commit | 661483c026777fff4c6dd6ec245c991f7c4248ac (patch) | |
| tree | 171a6bd1564352436bf40363826ff7ec1adc30b3 /addons/web/static/src/js | |
| parent | f2ff47403fc061aec7d6f77898962859b05e75de (diff) | |
[FIX] web: no duplication function for `change_menu_section`
Revision on https://github.com/odoo/odoo/commit/b7cf456560dc4fd7c1217ba90f0b5609466ede50
The commit above assumed the function `change_menu_section` was
mistakenly removed. However, it was turned into a handler function
and renamed according to our JS guidelines `_onChangeMenuSection`.
This commit removes the duplicated logic by removing the
function `_onChangeMenuSection` and using `change_menu_section`
as the handler for the bus event `change_menu_section`.
closes odoo/odoo#27809
Diffstat (limited to 'addons/web/static/src/js')
| -rw-r--r-- | addons/web/static/src/js/chrome/menu.js | 32 |
1 files changed, 1 insertions, 31 deletions
diff --git a/addons/web/static/src/js/chrome/menu.js b/addons/web/static/src/js/chrome/menu.js index 589b9cb2c06..6f9d5fe651c 100644 --- a/addons/web/static/src/js/chrome/menu.js +++ b/addons/web/static/src/js/chrome/menu.js @@ -38,7 +38,7 @@ var Menu = Widget.extend({ }); // Bus event - core.bus.on('change_menu_section', this, this._onChangeMenuSection); + core.bus.on('change_menu_section', this, this.change_menu_section); }, start: function () { var self = this; @@ -198,36 +198,6 @@ var Menu = Widget.extend({ }, /** * @private - * @param {integer} primaryMenuID - */ - _onChangeMenuSection: function (primaryMenuID) { - if (!this.$menu_sections[primaryMenuID]) { - return; // unknown menu_id - } - - if (this.current_primary_menu === primaryMenuID) { - return; // already in that menu - } - - if (this.current_primary_menu) { - this.$menu_sections[this.current_primary_menu].detach(); - } - - // Get back the application name - for (var i = 0; i < this.menu_data.children.length; i++) { - if (this.menu_data.children[i].id === primaryMenuID) { - this.$menu_brand_placeholder.text(this.menu_data.children[i].name); - break; - } - } - - this.$menu_sections[primaryMenuID].appendTo(this.$section_placeholder); - this.current_primary_menu = primaryMenuID; - - core.bus.trigger('resize'); - }, - /** - * @private * @param {MouseEvent} ev */ _onMouseOverMenu: function (ev) { |
