From d6ed530876c016256ce0bf09801b3be7e3de7d3e Mon Sep 17 00:00:00 2001 From: ebremner <ebremner@uwaterloo.ca> Date: Fri, 14 May 2021 11:07:13 -0400 Subject: [PATCH] ISTWCMS-4695: fixing displaying/not displaying title on cards --- .../04-components/banners/banners.yml | 1 - source/_patterns/04-components/card/card.twig | 83 ++++++++++--------- 2 files changed, 43 insertions(+), 41 deletions(-) diff --git a/source/_patterns/04-components/banners/banners.yml b/source/_patterns/04-components/banners/banners.yml index 44f6529d..02bc7a06 100644 --- a/source/_patterns/04-components/banners/banners.yml +++ b/source/_patterns/04-components/banners/banners.yml @@ -66,7 +66,6 @@ banners: type: 'image/jpeg' img_element: '../../../../source/images/president/president_xlarge.jpg' alt: 'Alternative text' - big_text: 'Image3' link: 'http://google.ca' autoplay: 1 slide_speed: 7000 diff --git a/source/_patterns/04-components/card/card.twig b/source/_patterns/04-components/card/card.twig index 20e42e62..8498f2fd 100644 --- a/source/_patterns/04-components/card/card.twig +++ b/source/_patterns/04-components/card/card.twig @@ -2,56 +2,59 @@ <article class="card {{ modifier_classes }} {% if show_hover %} card--show-hover {% endif %} {{ type }}" > <div class="card__body"> - <div class="card__header"> - {% if date %} - <div class="card__date"> - {% if date is iterable %} - {% for d in date %} + + {% if title or author or date %} + <div class="card__header"> + {% if date %} + <div class="card__date"> + {% if date is iterable %} + {% for d in date %} + {% include "@base/date-formats/_date-format.twig" with { + 'date_format': date_format, + 'date': d + }%} + {% endfor %} + {% else %} {% include "@base/date-formats/_date-format.twig" with { 'date_format': date_format, - 'date': d + 'date': date }%} - {% endfor %} - {% else %} - {% include "@base/date-formats/_date-format.twig" with { - 'date_format': date_format, - 'date': date - }%} - {% endif %} - </div> - {% endif %} + {% endif %} + </div> + {% endif %} - {% if title %} - <h{{ header_level }} class="card__title"> - {% if url %} - <a href="{{ url }}"> - {% endif %} - {{ title }} - {% if url %} - </a> + {% if title %} + <h{{ header_level }} class="card__title"> + {% if url %} + <a href="{{ url }}"> + {% endif %} + {{ title }} + {% if url %} + </a> + {% endif %} + </h{{ header_level }}> + {% if sub_title %} + <span class="sub-title">{{ sub_title }}</span> {% endif %} - </h{{ header_level }}> - {% if sub_title %} - <span class="sub-title">{{ sub_title }}</span> {% endif %} - {% endif %} - {% if author_name %} - <div class="card__author"> - {% if author_link %} - by - <a href="{{ author_link }}"> - {% endif %} + {% if author_name %} + <div class="card__author"> + {% if author_link %} + by + <a href="{{ author_link }}"> + {% endif %} - {{ author_name }} + {{ author_name }} - {% if author_link %} - </a> - {% endif %} - </div> - {% endif %} + {% if author_link %} + </a> + {% endif %} + </div> + {% endif %} - </div> + </div> + {% endif %} {% if sources or img_element %} -- GitLab