odoo.define('galaxy.web.ActionManager', function (require) {
"use strict";
/**
* ActionManager
*
* The ActionManager is one of the centrepieces in the WebClient architecture.
* Its role is to makes sure that Odoo actions are properly started and
* coordinated.
*/
var AbstractAction = require('web.AbstractAction');
var concurrency = require('web.concurrency');
var Context = require('web.Context');
var core = require('web.core');
var Dialog = require('web.Dialog');
var dom = require('web.dom');
var framework = require('web.framework');
var pyUtils = require('web.py_utils');
var Widget = require('web.Widget');
var ActionManager = require('web.ActionManager');
var _t = core._t;
var galaxy_ActionManager = ActionManager.include({
/**
* Returns a description of the controllers in the given controller stack.
* It is used to render the breadcrumbs. It is an array of Objects with keys
* 'title' (what to display in the breadcrumbs) and 'controllerID' (the ID
* of the corresponding controller, used to restore it when this part of the
* breadcrumbs is clicked).
*
* @private
* @param {string[]} controllerStack
* @returns {Object[]
重载这个方法的目的是为了不重复显示相同title的面包屑
*/
_getBreadcrumbs: function (controllerStack) {
var self = this;
var title_set = '';
var pos = 0;
var rt = _.map(controllerStack, function (controllerID) {
var title = self.controllers[controllerID].title;
if (title_set.indexOf(title) == -1 && pos<2){
title_set += title;
pos++;
return {
controllerID: controllerID,
title: title,
}
}
});
return rt
},
});
return galaxy_ActionManager;
});
通常的方法只能完全禁用或启用面包屑导航,重写action manager里面的 _getBreadcrumbs方法,可以设置重复内容的title不显示,避免在更新内容的时候,出现很长的导航字符串,看起来很难看,用户也很困惑。