impress/app/views/items/show.html.haml

83 lines
3.1 KiB
Text
Raw Normal View History

2011-05-13 05:07:59 -07:00
- title @item.name
2011-07-26 15:56:14 -07:00
- canonical_path @item
2011-05-20 16:29:04 -07:00
= render partial: "item_header",
locals: {item: @item, trades: @trades, current_subpage: "preview",
current_user_lists: @current_user_lists,
current_user_quantities: @current_user_quantities}
2011-07-14 09:50:24 -07:00
Add warning for "Baby Body Paint" bugs I *think* what I'm observing is that: 1. The zone restrictions are different between these items. 2. The zone restrictions *change* when reloading the page sometimes. (I assume from remodeling?) 3. The items look very buggy on many pets, because many appearances seem to expect different zone restrictions than the item actually has. I think what this means is: 1. TNT has finally unbound restricted zones from the item level, and allowed different appearances to have different restrictions. Neat! 2. The API still serves it the same way, as a field on the item. So I think this means we need to update our schema to reflect the fact that an item's `zones_restrict` field isn't *really* a property of the item; it's a property of the combination of the item and the current body ID. My gut take here is that maybe this means it's time for the Large Refactor that I've kinda been interested in for a while, but been avoiding because of Impress 2020 compatibility issues: instead of a `body_id` field on assets, and having them directly belong to items, make an `ItemAppearance` record (closer to how 2020's GQL API modeled it, I was looking ahead to this possibility!) that's keyed on item and body ID, and assets belong to *that*. Then, we could move the zones restriction field onto the `ItemAppearance` record instead. And then it doesn't really matter to us how TNT models it internally; whatever we saw is what we use. (Again, I looked ahead to this in the 2020 app, and tried to use the `restrictedZones` field on `ItemAppearance` when possible—even though it secretly just reads directly from the `Item`!) …but that's a pretty big departure from how things are modeled now, and isn't something we can just throw together—especially coordinating it across both apps. I was getting close to being able to shut off 2020 from a *front-facing* perspective (but still keeping a lot of the GQL endpoints open for the wardrobe-2020 frontend), but I don't think we're very close to being able to try to target turning off 2020's *backend* as a prereq to this; or at least, if we do, we should expect that to take a while. (Counting now, there's still 9 GQL queries—not as many as I expected tbh, but still quite a few.) So idk how to sequence this! But for now, let's put out a warning, and start setting expectations.
2024-02-27 18:16:23 -08:00
- 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
= render partial: "outfit_viewer", locals: {outfit: @preview_outfit}
.error-indicator
💥 We couldn't load all of this outfit. Try again?
= 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
%form.species-face-picker
- @preview_pet_type_options.each do |pet_type|
%label
= radio_button_tag "species_face_id", pet_type.species_id,
checked: pet_type == @preview_outfit.pet_type
= pet_type_image pet_type, :happy, :face
.item-zones-info
%section
%h3 Occupies
- if @appearances_by_occupied_zone.present?
%ul
- @appearances_by_occupied_zone.each do |zone, appearances_in_zone|
%li
= zone.label
- if item_zone_partial_fit? appearances_in_zone, @all_appearances
%span.zone-species-info{
title: item_zone_species_list(appearances_in_zone)
}
(#{appearances_in_zone.size} species)
- else
%span.no-zones (None)
%section
%h3 Restricts
- if @item.restricted_zones.present?
%ul
- @item.restricted_zones.sort_by(&:label).each do |zone|
%li= zone.label
- else
%span.no-zones (None)
- 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 :stylesheets do
= stylesheet_link_tag "application/hanger-spinner"
- content_for :javascripts do
= javascript_include_tag "lib/idiomorph", async: true
= javascript_include_tag "outfit-viewer", async: true
= javascript_include_tag "items/show", async: true