From 857812610a922d940e6ea51236c33ed0a168deff Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Tue, 2 Jul 2024 22:03:43 -0700 Subject: [PATCH] Refactor `outfit_viewer_layers` helper to just be inlined into template I forget what complexity was in here previously that made this make sense before, but now it's just a loop, whatever! --- app/helpers/items_helper.rb | 10 ---------- app/views/items/show.html.haml | 8 +++++--- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/app/helpers/items_helper.rb b/app/helpers/items_helper.rb index c77a9bb2..31f0bfde 100644 --- a/app/helpers/items_helper.rb +++ b/app/helpers/items_helper.rb @@ -244,15 +244,5 @@ module ItemsHelper def item_header_user_lists_form_state cookies.fetch("DTIItemPageUserListsFormState", "closed") end - - def outfit_viewer_layers(swf_assets) - swf_assets.map { |a| outfit_viewer_layer(a) }.join("\n").html_safe - end - - def outfit_viewer_layer(swf_asset) - content_tag :div, class: "outfit-layer" do - image_tag swf_asset.image_url, alt: "" - end - end end diff --git a/app/views/items/show.html.haml b/app/views/items/show.html.haml index 6db54aeb..08b024f3 100644 --- a/app/views/items/show.html.haml +++ b/app/views/items/show.html.haml @@ -15,7 +15,9 @@ = turbo_frame_tag "item-preview" do .outfit-viewer - = outfit_viewer_layers @preview_outfit.visible_layers + - @preview_outfit.visible_layers.each do |swf_asset| + .outfit-layer + = image_tag swf_asset.image_url, alt: "" = form_for item_path(@item), method: :get, class: "species-color-picker", data: {"is-valid": @preview_error.nil?} do |f| @@ -40,6 +42,6 @@ %li= link_to(contributor.name, user_contributions_path(contributor)) + format_contribution_count(count) %footer= t '.contributors.footer' -- content_for :javascripts_body do - = javascript_include_tag 'item-page', defer: true +- content_for :javascripts do + = javascript_include_tag 'item-page', async: true