[ADD] Added Kanban oe_kanban_auto_height class.
authorFabien Meghazi <fme@openerp.com>
Wed, 23 May 2012 08:53:58 +0000 (10:53 +0200)
committerFabien Meghazi <fme@openerp.com>
Wed, 23 May 2012 08:53:58 +0000 (10:53 +0200)
bzr revid: fme@openerp.com-20120523085358-03mfl919f3b2w8yz

addons/web_kanban/static/src/js/kanban.js

index 93a726d..e6f9b23 100644 (file)
@@ -424,18 +424,23 @@ instance.web_kanban.KanbanGroup = instance.web.OldWidget.extend({
         this.$element.data('widget', this);
         this.$records.data('widget', this);
         this.$has_been_started.resolve();
-        this.compute_cards_height();
+        this.compute_cards_auto_height();
         return def;
     },
-    compute_cards_height: function() {
+    compute_cards_auto_height: function() {
+        // oe_kanban_auto_height is an empty class used by the kanban view in order
+        // to normalize height amongst kanban cards. (by group)
         var self = this;
         var min_height = 0;
+        var els = [];
         _.each(this.records, function(r) {
-            min_height = Math.max(min_height, r.$element.outerHeight());
-        });
-        _.each(this.records, function(r) {
-            r.$element.css('min-height', min_height);
+            var $e = r.$element.find('.oe_kanban_auto_height').first();
+            if ($e.length) {
+                els.push($e[0]);
+                min_height = Math.max(min_height, $e.outerHeight());
+            }
         });
+        $(els).css('min-height', min_height);
     },
     destroy: function() {
         this._super();