diff --git a/app/assets/stylesheets/application/item-badges.css b/app/assets/stylesheets/application/item-badges.css index b9d547ee..391c7147 100644 --- a/app/assets/stylesheets/application/item-badges.css +++ b/app/assets/stylesheets/application/item-badges.css @@ -26,6 +26,16 @@ color: #7B341E; } + &[data-item-kind="own"] { + background: #C6F6D5; + color: #22543D; + } + + &[data-item-kind="want"] { + background: #BEE3F8; + color: #2C5282; + } + .icon { vertical-align: middle; } diff --git a/app/controllers/wardrobe_controller.rb b/app/controllers/wardrobe_controller.rb index 30bbadf0..d104f574 100644 --- a/app/controllers/wardrobe_controller.rb +++ b/app/controllers/wardrobe_controller.rb @@ -113,6 +113,13 @@ class WardrobeController < ApplicationController end end + # Assign closet ownership/wishlist data to all visible items + if user_signed_in? + all_visible_items = worn_items.to_a + closeted_items.to_a + all_visible_items += @search_results.to_a if @search_mode + current_user.assign_closeted_to_items!(all_visible_items) + end + render layout: false end diff --git a/app/views/wardrobe/items/_item_card_content.html.haml b/app/views/wardrobe/items/_item_card_content.html.haml index 2ff1cc03..72fe6ac6 100644 --- a/app/views/wardrobe/items/_item_card_content.html.haml +++ b/app/views/wardrobe/items/_item_card_content.html.haml @@ -9,4 +9,5 @@ = render "items/badges/kind", item: item - if local_assigns[:appearance] = render "wardrobe/items/badges/zones", appearance: appearance + = render "wardrobe/items/badges/closet", item: item = render "items/badges/first_seen", item: item diff --git a/app/views/wardrobe/items/badges/_closet.html.haml b/app/views/wardrobe/items/badges/_closet.html.haml new file mode 100644 index 00000000..8f370ffa --- /dev/null +++ b/app/views/wardrobe/items/badges/_closet.html.haml @@ -0,0 +1,7 @@ +- if item.owned? + %abbr.item-badge{data: {item_kind: "own"}, title: "You own this item"} + Own + +- if item.wanted? + %abbr.item-badge{data: {item_kind: "want"}, title: "You want this item"} + Want