From a88fc14bd7dced6fa5a9c3bc7270b6c18b2d26d8 Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Tue, 3 Sep 2024 17:34:31 -0700 Subject: [PATCH] Use hi-res pet images in face picker for new item previews --- app/assets/stylesheets/items/_show.sass | 4 ++++ app/helpers/items_helper.rb | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/items/_show.sass b/app/assets/stylesheets/items/_show.sass index 28100f0a..75745722 100644 --- a/app/assets/stylesheets/items/_show.sass +++ b/app/assets/stylesheets/items/_show.sass @@ -165,6 +165,10 @@ body.items-show display: block position: relative + img + width: 50px + height: 50px + input[type=radio] position: absolute left: -10000px diff --git a/app/helpers/items_helper.rb b/app/helpers/items_helper.rb index 7e8c0ea2..9f0636bb 100644 --- a/app/helpers/items_helper.rb +++ b/app/helpers/items_helper.rb @@ -246,7 +246,11 @@ module ItemsHelper def pet_type_image(pet_type, emotion, size, **options) src = pet_type_image_url(pet_type, emotion:, size:) - image_tag(src, **options) + srcset = if size == :face + [[pet_type_image_url(pet_type, emotion:, size: :face_2x), "2x"]] + end + + image_tag(src, srcset:, **options) end def item_header_user_lists_form_state