[FIX] web: makes last breadcrumb item clickable

clicking on last breadcrumb item should reload the current view
This commit is contained in:
Géry Debongnie
2014-12-30 10:35:58 +01:00
parent fec5306326
commit 61dec05b9f
+14 -7
View File
@@ -699,17 +699,24 @@ instance.web.ViewManager = instance.web.Widget.extend({
if (!this.action_manager) return;
var breadcrumbs = this.action_manager.get_breadcrumbs();
if (!breadcrumbs.length) return;
var $breadcrumbs = _.map(_.initial(breadcrumbs), function (bc) {
var $link = $('<a>').text(bc.title);
$link.click(function () {
self.action_manager.select_widget(bc.widget, bc.index);
});
return $('<li>').append($link);
var $breadcrumbs = breadcrumbs.map(function (bc, index) {
return make_breadcrumb(bc, index === breadcrumbs.length - 1);
});
$breadcrumbs.push($('<li>').addClass('active').text(_.last(breadcrumbs).title));
this.$breadcrumbs
.empty()
.append($breadcrumbs);
function make_breadcrumb (bc, is_active) {
var handler = function () {
self.action_manager.select_widget(bc.widget, bc.index);
};
return $('<li>')
.append(is_active ? bc.title : $('<a>').text(bc.title))
.toggleClass('active', is_active)
.click(handler);
}
},
create_view: function(view) {
var self = this,