diff options
| author | Alexandre Kühn <aku@odoo.com> | 2018-04-13 09:44:16 +0200 |
|---|---|---|
| committer | Alexandre Kühn <aku@odoo.com> | 2018-04-13 16:21:58 +0200 |
| commit | 8bdc650f79e0e35de152d456cc9cc565db46a027 (patch) | |
| tree | 7ccf9914f50b6c24c9384eced3422dfd638f23ef /addons/web/static/src | |
| parent | 3b158b65c118d24b32aedc27c50e9dd726b04280 (diff) | |
[FIX] web: always update breadcrumb on change title
Revision on https://github.com/odoo/odoo/commit/32b8cec5361174c92c45a4975d4e02f1fb448aa2
Before this commit, when we switch channels in the Discuss app, the breadcrumb
was visually not updated: it keeps the name of the first opened channel.
With this commit, the breadcrumb is updated on each change of channel, so that
it displays the name of the currently opened channel.
Technical details:
This is due to a change of logic of updating the GUI of the breadcrumb:
before the refactoring above, discuss had to pass the content of the
breadcrumb to the control panel, in order to update the breadcrumb visually.
After the refactoring, the action manager should warn the control panel to
update the breadcrumb on any change of the title. This is already the case
for `ir.actions.act_window`, but not for all types of client actions.
Diffstat (limited to 'addons/web/static/src')
| -rw-r--r-- | addons/web/static/src/js/chrome/action_manager.js | 15 | ||||
| -rw-r--r-- | addons/web/static/src/js/chrome/action_manager_act_window.js | 8 |
2 files changed, 15 insertions, 8 deletions
diff --git a/addons/web/static/src/js/chrome/action_manager.js b/addons/web/static/src/js/chrome/action_manager.js index e1c0ddd3e8e..36c94a95c0e 100644 --- a/addons/web/static/src/js/chrome/action_manager.js +++ b/addons/web/static/src/js/chrome/action_manager.js @@ -835,12 +835,27 @@ var ActionManager = Widget.extend({ * is ready when it will be appended to the DOM. This allows to prevent * flickering for widgets doing async stuff in willStart() or start(). * + * Also updates the control panel on any change of the title on controller's + * widget. + * * @private * @param {Object} controller * @returns {Deferred<Object>} resolved with the controller when it is ready */ _startController: function (controller) { + var self = this; var fragment = document.createDocumentFragment(); + // AAB: change this logic to stop using the properties mixin + controller.widget.on("change:title", this, function () { + if (self.getCurrentController() !== controller) { + return; + } + var action = self.actions[controller.actionID]; + if (!action.flags || !action.flags.headless) { + var breadcrumbs = self._getBreadcrumbs(); + self.controlPanel.update({breadcrumbs: breadcrumbs}, {clear: false}); + } + }); return controller.widget.appendTo(fragment).then(function () { return controller; }); diff --git a/addons/web/static/src/js/chrome/action_manager_act_window.js b/addons/web/static/src/js/chrome/action_manager_act_window.js index 4e636de6355..2621071731c 100644 --- a/addons/web/static/src/js/chrome/action_manager_act_window.js +++ b/addons/web/static/src/js/chrome/action_manager_act_window.js @@ -202,15 +202,7 @@ ActionManager.include({ // the action has been removed, so simply destroy the widget widget.destroy(); } else { - // AAB: change this logic to stop using the properties mixin - widget.on("change:title", this, function () { - if (!action.flags.headless) { - var breadcrumbs = self._getBreadcrumbs(); - self.controlPanel.update({breadcrumbs: breadcrumbs}, {clear: false}); - } - }); controller.widget = widget; - def.resolve(controller); } }).fail(def.reject.bind(def)); |
