1
0
Fork 0
forked from OpenNeo/impress

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!
This commit is contained in:
Emi Matchu 2024-07-02 22:03:43 -07:00
parent 0a9193aed7
commit 857812610a
2 changed files with 5 additions and 13 deletions

View file

@ -244,15 +244,5 @@ module ItemsHelper
def item_header_user_lists_form_state def item_header_user_lists_form_state
cookies.fetch("DTIItemPageUserListsFormState", "closed") cookies.fetch("DTIItemPageUserListsFormState", "closed")
end 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 end

View file

@ -15,7 +15,9 @@
= turbo_frame_tag "item-preview" do = turbo_frame_tag "item-preview" do
.outfit-viewer .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", = form_for item_path(@item), method: :get, class: "species-color-picker",
data: {"is-valid": @preview_error.nil?} do |f| 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) %li= link_to(contributor.name, user_contributions_path(contributor)) + format_contribution_count(count)
%footer= t '.contributors.footer' %footer= t '.contributors.footer'
- content_for :javascripts_body do - content_for :javascripts do
= javascript_include_tag 'item-page', defer: true = javascript_include_tag 'item-page', async: true