From 39500dd4517ad09a47a25e4354b6099bc1be7138 Mon Sep 17 00:00:00 2001
From: Eric Bremner <ebremner@uwaterloo.ca>
Date: Wed, 19 Oct 2022 15:59:58 -0400
Subject: [PATCH] ISTWMCS-5880: adding media classes to node

---
 src/patterns/04-components/card/card--node/_card--node.twig | 6 +++---
 src/patterns/04-components/card/card.twig                   | 5 +++--
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/patterns/04-components/card/card--node/_card--node.twig b/src/patterns/04-components/card/card--node/_card--node.twig
index f22d052f..a2bff65e 100644
--- a/src/patterns/04-components/card/card--node/_card--node.twig
+++ b/src/patterns/04-components/card/card--node/_card--node.twig
@@ -1,7 +1,7 @@
-{% if node.media or node.image %}
-  {% set node_image_class =  'with-image' %}
+{% if media_flags.has_media %}
+  {% set node_image_class =  'with-media' %}
 {% else %}
-  {% set node_image_class =  'without-image' %}
+  {% set node_image_class =  'without-media' %}
 {% endif %}
 
 {% set modifier_classes = 'node--' ~ node.bundle %}
diff --git a/src/patterns/04-components/card/card.twig b/src/patterns/04-components/card/card.twig
index de71a066..8d74f011 100644
--- a/src/patterns/04-components/card/card.twig
+++ b/src/patterns/04-components/card/card.twig
@@ -1,6 +1,6 @@
 <article class="card{% if type %} card__{{ type }} {% endif %}{% if modifier_classes %} card__{{ modifier_classes }}{% endif %}{% if show_hover %} card--show-hover{% endif %}" {% if type == 'banner' %} id="{{ type }}{{ loop.index }}-{{ banners.uuid }}"{% endif %}>
 
-  {% if media_flags.has_media %}
+  {% if media_flags.has_media and media.media is not empty %}
     {% include '@components/card/card-elements/_media.twig' with {
       'media': media,
       'header': header,
@@ -9,7 +9,8 @@
     } %}
   {% endif %}
 
-  {% if image and bundle != 'uw_ct_profile' %}
+  {% if image is not empty and bundle != 'uw_ct_profile' %}
+    image
     {% include '@components/card/card-elements/_image.twig' with {
       'image': image
     } %}
-- 
GitLab