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:
parent
5be35591c2
commit
28cdef29d0
2 changed files with 9 additions and 8 deletions
|
@ -98,8 +98,9 @@ class ItemsController < ApplicationController
|
||||||
@preview_error = validate_preview
|
@preview_error = validate_preview
|
||||||
|
|
||||||
@all_appearances = @item.appearances
|
@all_appearances = @item.appearances
|
||||||
@appearances_by_occupied_zone = @item.appearances_by_occupied_zone.
|
@appearances_by_occupied_zone_label =
|
||||||
sort_by { |z, a| z.label }
|
@item.appearances_by_occupied_zone.
|
||||||
|
transform_keys(&:label).sort_by { |l, a| l }
|
||||||
@selected_item_appearance = @preview_outfit.item_appearances.first
|
@selected_item_appearance = @preview_outfit.item_appearances.first
|
||||||
|
|
||||||
@preview_pet_type_options = PetType.where(color: @preview_outfit.color).
|
@preview_pet_type_options = PetType.where(color: @preview_outfit.color).
|
||||||
|
|
|
@ -64,17 +64,17 @@
|
||||||
.item-zones-info
|
.item-zones-info
|
||||||
%section
|
%section
|
||||||
%h3 Occupies
|
%h3 Occupies
|
||||||
- if @appearances_by_occupied_zone.present?
|
- if @appearances_by_occupied_zone_label.present?
|
||||||
%ul
|
%ul
|
||||||
- @appearances_by_occupied_zone.each do |zone, appearances_in_zone|
|
- @appearances_by_occupied_zone_label.each do |label, appearances|
|
||||||
%li<
|
%li<
|
||||||
= zone.label
|
= label
|
||||||
- if item_zone_partial_fit? appearances_in_zone, @all_appearances
|
- if item_zone_partial_fit? appearances, @all_appearances
|
||||||
= " "
|
= " "
|
||||||
%span.zone-species-info{
|
%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
|
- else
|
||||||
%span.no-zones (None)
|
%span.no-zones (None)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue