[UNCOMMIT] uncommit kanban fixed width as it's broken with a lot of column

bzr revid: fp@tinyerp.com-20121220183942-wug9abfwdzbl8c9n
This commit is contained in:
Fabien Pinckaers 2012-12-20 19:39:42 +01:00
parent a109f7dc77
commit 0abda02684
3 changed files with 23 additions and 5 deletions

View File

@ -103,9 +103,6 @@
border-right: 1px solid #b9b9b9;
}
.openerp .oe_kanban_view.oe_kanban_grouped .oe_kanban_group_header {
width: 170px;
}
.openerp .oe_kanban_view.oe_kanban_grouped .oe_kanban_group_header.oe_kanban_group_folded {
width: 1%;
}
.openerp .oe_kanban_view .oe_form .oe_kanban_column {

View File

@ -128,8 +128,6 @@
border-right: 1px solid #b9b9b9
&.oe_kanban_grouped
.oe_kanban_group_header
width: 170px
.oe_kanban_group_header.oe_kanban_group_folded
width: 1%
.oe_form

View File

@ -322,6 +322,7 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
},
on_groups_started: function() {
var self = this;
this.compute_groups_width();
if (this.group_by) {
// Kanban cards drag'n'drop
var $columns = this.$el.find('.oe_kanban_column .oe_kanban_column_cards');
@ -419,6 +420,27 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
});
}
},
compute_groups_width: function() {
var unfolded = 0;
var self = this;
_.each(this.groups, function(group) {
unfolded += group.state.folded ? 0 : 1;
group.$el.children(':first').css('width', '');
});
_.each(this.groups, function(group) {
if (!group.state.folded) {
if (182*unfolded>=self.$el.width()) {
group.$el.children(':first').css('width', "170px");
} else if (262*unfolded<self.$el.width()) {
group.$el.children(':first').css('width', "250px");
} else {
// -12 because of padding 6 between cards
// -1 because of the border of the latest dummy column
group.$el.children(':first').css('width', Math.floor((self.$el.width()-1)/unfolded)-12 + 'px');
}
}
});
},
do_show: function() {
if (this.$buttons) {
@ -673,6 +695,7 @@ instance.web_kanban.KanbanGroup = instance.web.Widget.extend({
},
do_action_toggle_fold: function() {
this.do_toggle_fold();
this.view.compute_groups_width();
},
do_action_edit: function() {
var self = this;