impress/app/views/pet_states/_support_outfit_viewer.html.haml
Emi Matchu 347419aee8 Add SVG/PNG picker when editing pet appearances
I've known there are bugs in the SVGs pretty often, because they're not
very well attended-to—I noticed pretty quick that the Marble Eyrie, for
example, has its Body asset saved correctly in PNG, but its SVG is just
another copy of the head, oops!

I think SVG is still a nice default for this UI, but I added a little
form to switch to PNG, to give us a debugging method and escape hatch
if it starts to get weird.
2024-12-07 12:16:52 -08:00

45 lines
1.5 KiB
Text

= content_tag "support-outfit-viewer", **html_options do
= turbo_frame_tag "support-outfit-viewer-preview" do
%div
-# Render an outfit viewer in a magnifier. Use SVG by default for clarity,
-# but also offer an option to switch to PNG if it looks wrong.
%magic-magnifier
= outfit_viewer outfit,
preferred_image_format: params[:preferred_image_format] == "png" ? :png : :svg
= form_with method: :get, class: "outfit-viewer-controls" do |f|
%fieldset
%legend Format
%label
= f.radio_button "preferred_image_format", "svg",
checked: params[:preferred_image_format] != "png"
SVG
%label
= f.radio_button "preferred_image_format", "png",
checked: params[:preferred_image_format] == "png"
PNG
= f.submit "Update"
%table
%thead
%tr
%th{scope: "col"} DTI ID
%th{scope: "col"} Zone
%th{scope: "col"} Links
%tbody
- outfit.visible_layers.each do |swf_asset|
%tr
%th{scope: "row", "data-field": "id"}
= swf_asset.id
%td
= swf_asset.zone.label
(##{swf_asset.zone.id})
%td{"data-field": "links"}
%ul
- if swf_asset.image_url?
%li= link_to "PNG", swf_asset.image_url, target: "_blank"
- if swf_asset.svg_url?
%li= link_to "SVG", swf_asset.svg_url, target: "_blank"
%li= link_to "SWF", swf_asset.url, target: "_blank"
- if swf_asset.manifest_url?
%li= link_to "Manifest", swf_asset.manifest_url, target: "_blank"