From 81a58f865672d41d29f8be9485266319d2fc9cff Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Tue, 2 Jul 2024 22:43:36 -0700 Subject: [PATCH] Extract outfit-viewer to a separate template Just cuz this is gonna get more complex down the line! --- app/views/items/_outfit_viewer.html.haml | 9 +++++++++ app/views/items/show.html.haml | 10 +--------- 2 files changed, 10 insertions(+), 9 deletions(-) create mode 100644 app/views/items/_outfit_viewer.html.haml diff --git a/app/views/items/_outfit_viewer.html.haml b/app/views/items/_outfit_viewer.html.haml new file mode 100644 index 00000000..95bc452f --- /dev/null +++ b/app/views/items/_outfit_viewer.html.haml @@ -0,0 +1,9 @@ +.outfit-viewer + - outfit.visible_layers.each do |swf_asset| + %outfit-layer{ + data: { + "asset-id": swf_asset.id, + "zone": swf_asset.zone.label, + }, + } + = image_tag swf_asset.image_url, alt: "" \ No newline at end of file diff --git a/app/views/items/show.html.haml b/app/views/items/show.html.haml index 856d6537..df187658 100644 --- a/app/views/items/show.html.haml +++ b/app/views/items/show.html.haml @@ -14,15 +14,7 @@ sorry! = turbo_frame_tag "item-preview" do - .outfit-viewer - - @preview_outfit.visible_layers.each do |swf_asset| - %outfit-layer{ - data: { - "asset-id": swf_asset.id, - "zone": swf_asset.zone.label, - }, - } - = image_tag swf_asset.image_url, alt: "" + = render partial: "outfit_viewer", locals: {outfit: @preview_outfit} = form_for item_path(@item), method: :get, class: "species-color-picker", data: {"is-valid": @preview_error.nil?} do |f|