From 66f20747a93355e7790503fd0861d20749a2fcec Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Thu, 8 Feb 2024 10:07:09 -0800 Subject: [PATCH] Use higher-res outfit thumbnails if the device has at least 2x DPI --- app/helpers/outfits_helper.rb | 7 +++++++ app/views/outfits/_outfit.html.haml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/helpers/outfits_helper.rb b/app/helpers/outfits_helper.rb index d3cd1fc6..732e4581 100644 --- a/app/helpers/outfits_helper.rb +++ b/app/helpers/outfits_helper.rb @@ -48,6 +48,13 @@ module OutfitsHelper content_tag :li, :class => class_name, &block end + def outfit_image_tag(outfit) + image_tag( + outfit.image.small.url, + srcset: [[outfit.image.medium.url, "2x"]], + ) + end + def pet_attribute_select(name, collection, value=nil) options = options_from_collection_for_select(collection, :id, :human_name, value) select_tag name, options, id: nil, class: name diff --git a/app/views/outfits/_outfit.html.haml b/app/views/outfits/_outfit.html.haml index 3734e284..13656983 100644 --- a/app/views/outfits/_outfit.html.haml +++ b/app/views/outfits/_outfit.html.haml @@ -1,6 +1,6 @@ = outfit_li_for(outfit) do - if outfit.image? - = link_to image_tag(outfit.image.small.url), outfit + = link_to outfit_image_tag(outfit), outfit %header .outfit-star