impress/app/views/items/show.html.haml
Matchu 74748acaaf Refactor more of item outfit preview into the Outfit class
This is a cute thing that I think sets us up for other stuff down the
line: move more of the outfit appearance logic into the `Outfit` class!
Now, we set up the item page with a temporary instance of `Outfit`,
then ask for its `visible_layers`.

Still missing restricted-zones logic and such, that's next!
2024-07-01 16:07:25 -07:00

45 lines
1.8 KiB
Text

- title @item.name
- canonical_path @item
= render partial: "item_header",
locals: {item: @item, trades: @trades, current_subpage: "preview",
current_user_lists: @current_user_lists,
current_user_quantities: @current_user_quantities}
- if @item.name.include? "Baby Body Paint"
%p.warning
The Baby Body Paint items seem to have new zone restriction rules that our
system doesn't support yet, whuh oh! This might require major changes to
how we handle zones. Until then, these items will be <em>very</em> buggy,
sorry!
= turbo_frame_tag "item-preview" do
.outfit-viewer
= outfit_viewer_layers @preview_outfit.visible_layers
= form_for item_path(@item), method: :get, class: "species-color-picker",
data: {"is-valid": @preview_error.nil?} do |f|
- if @preview_error == :pet_type_does_not_exist
%span.error-icon{title: "We haven't seen this kind of pet before."} ⚠️
- elsif @preview_error == :no_item_data
%span.error-icon{title: "We haven't seen this item on this pet before."} ⚠️
= select_tag "preview[color_id]",
options_from_collection_for_select(Color.funny.alphabetical,
"id", "human_name", @selected_preview_pet_type.color_id)
= select_tag "preview[species_id]",
options_from_collection_for_select(Species.alphabetical,
"id", "human_name", @selected_preview_pet_type.species_id)
= submit_tag "Go", name: nil
- unless @contributors_with_counts.empty?
#item-contributors
%header #{t '.contributors.header'}:
%ul
- @contributors_with_counts.each do |contributor, count|
%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