[FIX] web: fix actions in sidebar on second reload

When the user visited a view for the second time, the extra actions in the sidebar
were broken.  The reason is that the sidebar code modified in place the
fields_view information.

Note: This was not a problem before, because the field_view_get call was done each
time the view was loaded, but now it is cached.
This commit is contained in:
Géry Debongnie
2016-06-02 14:28:21 +02:00
parent 969bc66e7a
commit 9be5531f3e
+6 -7
View File
@@ -103,13 +103,13 @@ var Sidebar = Widget.extend({
_.each(['print','action','relate'], function(type) {
var items = toolbar[type];
if (items) {
for (var i = 0; i < items.length; i++) {
items[i] = {
label: items[i]['name'],
action: items[i],
var actions = _.map(items, function (item) {
return {
label: item.name,
action: item,
};
}
self.add_items(type=='print' ? 'print' : 'other', items);
});
self.add_items(type === 'print' ? 'print' : 'other', actions);
}
});
},
@@ -218,4 +218,3 @@ var Sidebar = Widget.extend({
return Sidebar;
});