@@ -5,7 +5,7 @@ angular.module('ui').controller('uiCardPanelController', ['uiSizes', '$timeout',
55 var ctrl = this ;
66 ctrl . width = ( sizes . columns ( $scope . group ) * sizes . sx ) + ( sizes . px * 2 ) + ( ( sizes . columns ( $scope . group ) - 1 ) * sizes . cx ) ;
77 var defaultWidth = sizes . columns ( $scope . group ) ;
8- var defaultHeight = 1 ;
8+ var defaultHeight = 0 ;
99
1010 var root ;
1111 ctrl . init = function ( rootElement ) {
@@ -36,21 +36,21 @@ angular.module('ui').controller('uiCardPanelController', ['uiSizes', '$timeout',
3636 var result = size . split ( 'x' ) ;
3737 var width = Math . max ( 1 , Math . min ( sizes . columns ( $scope . group ) , result ? parseInt ( result [ 0 ] ) || defaultWidth : defaultWidth ) ) ;
3838 var height = Math . max ( 1 , result ? parseInt ( result [ 1 ] ) || defaultHeight : defaultHeight ) ;
39- // if ((parseInt(result[1]) == = 0) && (child.attr('ui-template') !== undefined)) { /*is template node*/
40- // // template node will size the height based upon it's content
41- // // - child.height() defaults to calculating based on width of group
42- // var ch = child.height() * parseInt($scope.group.header.config.width)/width;
43- // if (!ch || (ch <= 0)) { // if height is 0 or undefined
44- // var t = (child[0].innerHTML).toLowerCase();
45- // if ((t.indexOf('<style') === -1) && (t.indexOf('<link') === -1)) { ch = 1; } // and if no style or link tag
46- // else { // or if any common tags for content
47- // if (t.indexOf('<div') !== -1) { ch = 1; }
48- // if (t.indexOf('<p') !== -1) { ch = 1; }
49- // if (t.indexOf('<span') !== -1) { ch = 1; }
50- // }
51- // }
52- // height = Math.ceil(ch / (sizes.cy + sizes.sy));
53- // }
39+ if ( ( parseInt ( result [ 1 ] ) < = 0 ) && ( child . attr ( 'ui-template' ) !== undefined ) ) { /*is template node*/
40+ // template node will size the height based upon it's content
41+ // - child.height() defaults to calculating based on width of group
42+ var ch = child . height ( ) * parseInt ( $scope . group . header . config . width ) / width ;
43+ if ( ! ch || ( ch <= 0 ) ) { // if height is 0 or undefined
44+ var t = ( child [ 0 ] . innerHTML ) . toLowerCase ( ) ;
45+ if ( ( t . indexOf ( '<style' ) === - 1 ) && ( t . indexOf ( '<link' ) === - 1 ) ) { ch = 1 ; } // and if no style or link tag
46+ else { // or if any common tags for content
47+ if ( t . indexOf ( '<div' ) !== - 1 ) { ch = 1 ; }
48+ if ( t . indexOf ( '<p' ) !== - 1 ) { ch = 1 ; }
49+ if ( t . indexOf ( '<span' ) !== - 1 ) { ch = 1 ; }
50+ }
51+ }
52+ height = Math . ceil ( ch / ( sizes . cy + sizes . sy ) ) ;
53+ }
5454
5555 var position = getNextPosition ( width , height ) ;
5656 child . css ( {
0 commit comments