diff --git a/app/assets/stylesheets/items/sources.sass b/app/assets/stylesheets/items/sources.sass index 6c536c14..e52395c0 100644 --- a/app/assets/stylesheets/items/sources.sass +++ b/app/assets/stylesheets/items/sources.sass @@ -6,6 +6,7 @@ border: 1px solid $soft-border-color width: 60% table-layout: auto + margin-bottom: 2em td, th border-top: 1px solid $soft-border-color diff --git a/app/controllers/items_controller.rb b/app/controllers/items_controller.rb index a05b7294..e6b7580f 100644 --- a/app/controllers/items_controller.rb +++ b/app/controllers/items_controller.rb @@ -126,6 +126,8 @@ class ItemsController < ApplicationController @other_nc_items = @items.select(&:nc?).reject(&:currently_in_mall?) @np_items = @items.select(&:np?) @pb_items = @items.select(&:pb?) + @pb_items_by_color = @pb_items.group_by(&:pb_color). + sort_by { |color, items| color.name }.to_h render layout: "application" end diff --git a/app/views/items/sources.html.haml b/app/views/items/sources.html.haml index 23e45426..97cbc58c 100644 --- a/app/views/items/sources.html.haml +++ b/app/views/items/sources.html.haml @@ -60,25 +60,27 @@ these items will be semi-permanently added to your Closet, even if your pet changes color again! You can use this to mix-and-match styles for "cross-paint" outfits. - %table.item-list - %thead - %td - %th{colspan: 2} - Total: #{pluralize @pb_items.size, "item"} - %tbody - - @pb_items.each do |item| - = render "item_list_row", item: do - - if item.pb_item_name.present? + - @pb_items_by_color.each do |color, items| + %table.item-list + %thead + %td + %th + #{color.pb_item_name || color.name.humanize} + (#{pluralize items.size, "item"}) + %td.actions-cell + - if color.pb_item_name.present? = button_link_to "Shops", - shop_wizard_url_for(item.pb_item_name), + shop_wizard_url_for(color.pb_item_name), target: "_blank", icon: search_icon = button_link_to "Trades", - trading_post_url_for(item.pb_item_name), + trading_post_url_for(color.pb_item_name), target: "_blank", icon: search_icon - else .special-color-explanation - No Paint Brush for this color. Get via Lab - Ray, morphing potions, etc. + Get via Lab Ray, morphing potions, etc. + %tbody + - items.each do |item| + = render "item_list_row", item: - if @other_nc_items.present? %h2 Neocash items (Capsules, Dyeworks, events, retired, etc.)