From cf4c6dba9c1b38b266b7158c02e6a1ce0eebb1c9 Mon Sep 17 00:00:00 2001 From: Jason Zimdars Date: Thu, 3 Jul 2025 15:56:25 -0500 Subject: [PATCH] Indicate cards with attachments in the description --- app/assets/images/attachment.svg | 1 + app/assets/stylesheets/icons.css | 1 + app/models/card.rb | 4 ++++ app/views/cards/display/_preview.html.erb | 1 + 4 files changed, 7 insertions(+) create mode 100644 app/assets/images/attachment.svg diff --git a/app/assets/images/attachment.svg b/app/assets/images/attachment.svg new file mode 100644 index 000000000..fe99fe607 --- /dev/null +++ b/app/assets/images/attachment.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/assets/stylesheets/icons.css b/app/assets/stylesheets/icons.css index 2870088c2..7b6b2f73a 100644 --- a/app/assets/stylesheets/icons.css +++ b/app/assets/stylesheets/icons.css @@ -22,6 +22,7 @@ .icon--arrow-right { --svg: url("arrow-right.svg "); } .icon--art { --svg: url("art.svg "); } .icon--assigned { --svg: url("assigned.svg "); } + .icon--attachment { --svg: url("attachment.svg "); } .icon--bell-off { --svg: url("bell-off.svg "); } .icon--bell { --svg: url("bell.svg "); } .icon--bolt { --svg: url("bolt.svg "); } diff --git a/app/models/card.rb b/app/models/card.rb index c83c1325b..aebbe5b45 100644 --- a/app/models/card.rb +++ b/app/models/card.rb @@ -38,6 +38,10 @@ class Card < ApplicationRecord self end + def has_attachments? + description&.body&.attachments&.any? { |attachment| attachment.attachable.is_a?(ActiveStorage::Blob) } + end + private def set_default_title self.title = "Untitled" if title.blank? diff --git a/app/views/cards/display/_preview.html.erb b/app/views/cards/display/_preview.html.erb index 6c7506149..1a4977cdb 100644 --- a/app/views/cards/display/_preview.html.erb +++ b/app/views/cards/display/_preview.html.erb @@ -7,6 +7,7 @@ <%= render "cards/display/preview/collection", card: card %> <%= render "cards/display/preview/tags", card: card %> <%= render "cards/display/preview/steps", card: card %> + <%= icon_tag "attachment", class: "card__attachments-indicator translucent txt-x-small" if card.has_attachments? %> <% if card.staged? && card.doing? %>