@@ -332,7 +332,7 @@ function cardString(template, components) {
332 var headerAsOverlay = hasArt && template && template["overlay"] === true && (hasTitle || hasMascot);
332 var headerAsOverlay = hasArt && template && template["overlay"] === true && (hasTitle || hasMascot);
333 var hasSubtitle = hasTitle && components["subtitle"] || false;
333 var hasSubtitle = hasTitle && components["subtitle"] || false;
334 var hasHeaderRow = hasMascot && hasTitle;
334 var hasHeaderRow = hasMascot && hasTitle;
335− var hasAttributes = hasTitle && components["attributes"] || false;
335+ var hasAttributes = hasTitle && components["attributes"]["field"] || false;
337 if (hasBackground) {
337 if (hasBackground) {
338 code += kBackgroundLoaderCode;
338 code += kBackgroundLoaderCode;
@@ -443,6 +443,7 @@ function cardString(template, components) {
444 var summaryColorWithBackground = 'backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : (root.scopeStyle ? root.scopeStyle.foreground : "grey")';
444 var summaryColorWithBackground = 'backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : (root.scopeStyle ? root.scopeStyle.foreground : "grey")';
446+ var hasTitleContainer = hasTitle && (hasEmblem || (hasMascot && (hasSubtitle || hasAttributes)));
446 var titleSubtitleCode = '';
447 var titleSubtitleCode = '';
447 if (hasTitle) {
448 if (hasTitle) {
448 var titleColor;
449 var titleColor;
@@ -480,7 +481,7 @@ function cardString(template, components) {
480 rightMargin: units.gu(1); \n';
481 rightMargin: units.gu(1); \n';
483− if (hasEmblem || (hasMascot && (hasSubtitle || hasAttributes))) {
484+ if (hasTitleContainer) {
484 // Using headerTitleContainer
485 // Using headerTitleContainer
485 titleAnchors = titleRightAnchor;
486 titleAnchors = titleRightAnchor;
486 titleAnchors += 'left: parent.left; \n\
487 titleAnchors += 'left: parent.left; \n\
@@ -557,7 +558,7 @@ function cardString(template, components) {
557 containerHeight += ' + attributesRow.height';
558 containerHeight += ' + attributesRow.height';
560− if (hasEmblem || (hasMascot && (hasSubtitle || hasAttributes))) {
561+ if (hasTitleContainer) {
561 // use container
562 // use container
562 titleSubtitleCode = kHeaderContainerCodeGenerator(titleContainerAnchors, containerHeight, containerCode);
563 titleSubtitleCode = kHeaderContainerCodeGenerator(titleContainerAnchors, containerHeight, containerCode);
@@ -587,7 +588,7 @@ function cardString(template, components) {
587 if (isHorizontal && hasArt) summaryTopAnchor = 'artShapeHolder.bottom';
588 if (isHorizontal && hasArt) summaryTopAnchor = 'artShapeHolder.bottom';
588 else if (headerAsOverlay && hasArt) summaryTopAnchor = 'artShapeHolder.bottom';
589 else if (headerAsOverlay && hasArt) summaryTopAnchor = 'artShapeHolder.bottom';
589 else if (hasHeaderRow) summaryTopAnchor = 'row.bottom';
590 else if (hasHeaderRow) summaryTopAnchor = 'row.bottom';
590− else if (hasEmblem || (hasMascot && (hasSubtitle || hasAttributes))) summaryTopAnchor = 'headerTitleContainer.bottom';
591+ else if (hasTitleContainer) summaryTopAnchor = 'headerTitleContainer.bottom';
591 else if (hasMascot) summaryTopAnchor = 'mascotImage.bottom';
592 else if (hasMascot) summaryTopAnchor = 'mascotImage.bottom';
592 else if (hasAttributes) summaryTopAnchor = 'attributesRow.bottom';
593 else if (hasAttributes) summaryTopAnchor = 'attributesRow.bottom';
593 else if (hasSubtitle) summaryTopAnchor = 'subtitleLabel.bottom';
594 else if (hasSubtitle) summaryTopAnchor = 'subtitleLabel.bottom';
@@ -617,23 +618,26 @@ function cardString(template, components) {
618 code += kTouchdownCode.arg(touchdownAnchors);
619 code += kTouchdownCode.arg(touchdownAnchors);
621+ var implicitHeight = 'implicitHeight: ';
620 if (hasSummary) {
622 if (hasSummary) {
621− code += 'implicitHeight: summary.y + summary.height + (summary.text ? units.gu(1) : 0);\n';
623+ implicitHeight += 'summary.y + summary.height + (summary.text ? units.gu(1) : 0);\n';
622 } else if (hasHeaderRow) {
624 } else if (hasHeaderRow) {
623− code += 'implicitHeight: row.y + row.height + units.gu(1);\n';
625+ implicitHeight += 'row.y + row.height + units.gu(1);\n';
624 } else if (hasMascot) {
626 } else if (hasMascot) {
625− code += 'implicitHeight: mascotImage.y + mascotImage.height;\n';
627+ implicitHeight += 'mascotImage.y + mascotImage.height;\n';
628+ } else if (hasTitleContainer) {
629+ implicitHeight += 'headerTitleContainer.y + headerTitleContainer.height + units.gu(1);\n';
626 } else if (hasAttributes) {
630 } else if (hasAttributes) {
627− code += 'implicitHeight: attributesRow.y + attributesRow.height + units.gu(1);\n';
631+ implicitHeight += 'attributesRow.y + attributesRow.height + units.gu(1);\n';
628 } else if (hasSubtitle) {
632 } else if (hasSubtitle) {
629− code += 'implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1);\n';
633+ implicitHeight += 'subtitleLabel.y + subtitleLabel.height + units.gu(1);\n';
630 } else if (hasTitle) {
634 } else if (hasTitle) {
631− code += 'implicitHeight: titleLabel.y + titleLabel.height + units.gu(1);\n';
635+ implicitHeight += 'titleLabel.y + titleLabel.height + units.gu(1);\n';
632 } else if (hasArt) {
636 } else if (hasArt) {
633− code += 'implicitHeight: artShapeHolder.height;\n';
637+ implicitHeight += 'artShapeHolder.height;\n';
635 // Close the AbstractButton
639 // Close the AbstractButton
636− code += '}\n';
640+ code += implicitHeight + '}\n';
638 return code;
642 return code;