diff --git a/app/assets/stylesheets/items/sources.sass b/app/assets/stylesheets/items/sources.sass index e52395c0..862778c3 100644 --- a/app/assets/stylesheets/items/sources.sass +++ b/app/assets/stylesheets/items/sources.sass @@ -50,6 +50,9 @@ th text-align: left + .thumbnail-cell img + outline: 1px solid $soft-border-color + .actions-cell button /* Bootstrap's Purple 600 */ +awesome-button-color(#59359a) @@ -57,3 +60,13 @@ .special-color-explanation text-wrap: balance font-style: italic + + /* For wearable items that belong to a specific set that all come together, + * like a Paint Brush. */ + &[data-group-type="bundle"] + tbody + .thumbnail-cell + opacity: 0.65 + + tr:hover .thumbnail-cell + opacity: 0.85 diff --git a/app/views/items/sources.html.haml b/app/views/items/sources.html.haml index 97cbc58c..76bedf46 100644 --- a/app/views/items/sources.html.haml +++ b/app/views/items/sources.html.haml @@ -61,14 +61,17 @@ pet changes color again! You can use this to mix-and-match styles for "cross-paint" outfits. - @pb_items_by_color.each do |color, items| - %table.item-list + %table.item-list{"data-group-type": "bundle"} %thead - %td + %td.thumbnail-cell + - if color.pb_item_thumbnail_url? + = image_tag color.pb_item_thumbnail_url, + alt: "Item thumbnail for #{color.pb_item_name}" %th #{color.pb_item_name || color.name.humanize} (#{pluralize items.size, "item"}) %td.actions-cell - - if color.pb_item_name.present? + - if color.pb_item_name? = button_link_to "Shops", shop_wizard_url_for(color.pb_item_name), target: "_blank", icon: search_icon diff --git a/db/migrate/20240522233638_add_pb_item_thumbnail_url_to_colors.rb b/db/migrate/20240522233638_add_pb_item_thumbnail_url_to_colors.rb new file mode 100644 index 00000000..5e4e25b2 --- /dev/null +++ b/db/migrate/20240522233638_add_pb_item_thumbnail_url_to_colors.rb @@ -0,0 +1,5 @@ +class AddPbItemThumbnailUrlToColors < ActiveRecord::Migration[7.1] + def change + add_column :colors, :pb_item_thumbnail_url, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index ac34a581..ff24a46f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.1].define(version: 2024_05_22_222040) do +ActiveRecord::Schema[7.1].define(version: 2024_05_22_233638) do create_table "alt_styles", charset: "utf8mb4", collation: "utf8mb4_unicode_520_ci", force: :cascade do |t| t.integer "species_id", null: false t.integer "color_id", null: false @@ -77,6 +77,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_05_22_222040) do t.boolean "prank", default: false, null: false t.string "name", null: false t.string "pb_item_name" + t.string "pb_item_thumbnail_url" end create_table "contributions", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_520_ci", force: :cascade do |t|