Combine zones with the same label on the item page

For example, the "Red Knitted Beanie with Wig" occupies two different
"Hat" zones: one for behind the head, and one for in front. It's not
useful to split them up!
This commit is contained in:
Emi Matchu 2025-01-02 19:26:11 -08:00
parent 5be35591c2
commit 28cdef29d0
2 changed files with 9 additions and 8 deletions

View file

@ -98,8 +98,9 @@ class ItemsController < ApplicationController
@preview_error = validate_preview
@all_appearances = @item.appearances
@appearances_by_occupied_zone = @item.appearances_by_occupied_zone.
sort_by { |z, a| z.label }
@appearances_by_occupied_zone_label =
@item.appearances_by_occupied_zone.
transform_keys(&:label).sort_by { |l, a| l }
@selected_item_appearance = @preview_outfit.item_appearances.first
@preview_pet_type_options = PetType.where(color: @preview_outfit.color).

View file

@ -64,17 +64,17 @@
.item-zones-info
%section
%h3 Occupies
- if @appearances_by_occupied_zone.present?
- if @appearances_by_occupied_zone_label.present?
%ul
- @appearances_by_occupied_zone.each do |zone, appearances_in_zone|
- @appearances_by_occupied_zone_label.each do |label, appearances|
%li<
= zone.label
- if item_zone_partial_fit? appearances_in_zone, @all_appearances
= label
- if item_zone_partial_fit? appearances, @all_appearances
= " "
%span.zone-species-info{
title: item_zone_species_list(appearances_in_zone)
title: item_zone_species_list(appearances)
}<
(#{appearances_in_zone.size} species)
(#{appearances.size} species)
- else
%span.no-zones (None)