forked from OpenNeo/impress
Flag items you already own in the Item Getting Guide
This commit is contained in:
parent
56fe5e4889
commit
36452a4704
4 changed files with 117 additions and 65 deletions
|
@ -58,10 +58,34 @@
|
|||
.thumbnail-cell img
|
||||
outline: 1px solid $soft-border-color
|
||||
|
||||
.actions-cell button
|
||||
.actions-cell
|
||||
button, a.button
|
||||
/* Bootstrap's Purple 600 */
|
||||
+awesome-button-color(#59359a)
|
||||
|
||||
tr[data-item-owned]
|
||||
color: #aaa
|
||||
|
||||
a:not(.button)
|
||||
color: inherit
|
||||
|
||||
.thumbnail-cell
|
||||
filter: grayscale(1)
|
||||
opacity: .75
|
||||
|
||||
.item-name
|
||||
font-style: italic
|
||||
text-decoration: line-through
|
||||
text-decoration-color: rgba($text-color, 0.35)
|
||||
|
||||
.owned-explanation
|
||||
font-style: italic
|
||||
font-size: 85%
|
||||
|
||||
.actions-cell
|
||||
button, a.button
|
||||
+awesome-button-color(#999)
|
||||
|
||||
.price-breakdown
|
||||
text-decoration-line: underline
|
||||
text-decoration-style: dotted
|
||||
|
@ -100,3 +124,8 @@
|
|||
|
||||
tr:hover .thumbnail-cell
|
||||
opacity: 0.85
|
||||
|
||||
&[data-group-owned]
|
||||
thead
|
||||
button, a.button
|
||||
+awesome-button-color(#999)
|
||||
|
|
|
@ -116,6 +116,7 @@ class ItemsController < ApplicationController
|
|||
item_ids = params[:ids].split(",")
|
||||
@items = Item.where(id: item_ids).includes(:nc_mall_record).
|
||||
includes(:dyeworks_base_item).order(:name).limit(50)
|
||||
assign_closeted!
|
||||
|
||||
if @items.empty?
|
||||
render file: "public/404.html", status: :not_found, layout: nil
|
||||
|
@ -155,6 +156,16 @@ class ItemsController < ApplicationController
|
|||
[color, color.example_pet_type(preferred_species: species)]
|
||||
end.to_h
|
||||
|
||||
# Create a second value that only include the items the user *needs*: that
|
||||
# is, that they don't already own.
|
||||
@nc_mall_items_needed = @nc_mall_items.reject(&:owned?)
|
||||
@buyable_dyeworks_items_needed = @buyable_dyeworks_items.reject(&:owned?)
|
||||
@np_items_needed = @np_items.reject(&:owned?)
|
||||
@pb_items_needed = @pb_items.reject(&:owned?)
|
||||
@other_nc_items_needed = @other_nc_items.reject(&:owned?)
|
||||
@pb_items_needed_by_color =
|
||||
@pb_items_by_color.transform_values { |items| items.reject(&:owned?) }
|
||||
|
||||
# Finish loading the NC trade values.
|
||||
trade_values_task.wait
|
||||
|
||||
|
|
|
@ -4,12 +4,15 @@
|
|||
- content = yield
|
||||
- subtitle = yield :subtitle
|
||||
|
||||
%tr
|
||||
%tr{"data-item-owned": item.owned?}
|
||||
%td.thumbnail-cell
|
||||
= link_to item_thumbnail_for(item), item, target: "_blank",
|
||||
tabindex: "-1"
|
||||
%td.name-cell
|
||||
= link_to item.name, item, target: "_blank"
|
||||
= link_to item.name, item, target: "_blank", class: "item-name"
|
||||
- if item.owned?
|
||||
%span.owned-explanation
|
||||
(You own this)
|
||||
- if subtitle.present?
|
||||
.subtitle= subtitle
|
||||
%td.actions-cell= content
|
||||
|
|
|
@ -16,10 +16,11 @@
|
|||
%tr
|
||||
%td
|
||||
%th
|
||||
Total: #{nc_total_for @nc_mall_items} NC
|
||||
(#{pluralize @nc_mall_items.size, "item"})
|
||||
Total: #{nc_total_for @nc_mall_items_needed} NC
|
||||
(#{pluralize @nc_mall_items_needed.size, "item"})
|
||||
|
||||
%td.actions-cell
|
||||
- if @nc_mall_items_needed.present?
|
||||
%button{onclick: "alert('Todo!')"}
|
||||
= cart_icon alt: ""
|
||||
Buy all in NC Mall
|
||||
|
@ -42,22 +43,24 @@
|
|||
|
||||
%table.item-list
|
||||
%thead
|
||||
%tr
|
||||
%td.thumbnail-cell
|
||||
= image_tag "https://images.neopets.com/items/mall_80x80_cleaning.gif",
|
||||
alt: "Dyeworks Hue Brew Potion"
|
||||
%th
|
||||
Total: #{dyeworks_nc_total_for @buyable_dyeworks_items} NC
|
||||
Total: #{dyeworks_nc_total_for @buyable_dyeworks_items_needed} NC
|
||||
= surround "(", ")" do
|
||||
%span.price-breakdown{
|
||||
title: "#{dyeworks_items_nc_total_for(@buyable_dyeworks_items)} NC"
|
||||
title: "#{dyeworks_items_nc_total_for(@buyable_dyeworks_items_needed)} NC"
|
||||
}<
|
||||
#{pluralize @buyable_dyeworks_items.size, "item"}
|
||||
#{pluralize @buyable_dyeworks_items_needed.size, "item"}
|
||||
+
|
||||
%span.price-breakdown{
|
||||
title: dyeworks_potions_nc_summary(@buyable_dyeworks_items.size)
|
||||
title: dyeworks_potions_nc_summary(@buyable_dyeworks_items_needed.size)
|
||||
}<
|
||||
#{pluralize @buyable_dyeworks_items.size, "potion"}
|
||||
#{pluralize @buyable_dyeworks_items_needed.size, "potion"}
|
||||
%td.actions-cell
|
||||
- if @buyable_dyeworks_items_needed.present?
|
||||
%button{onclick: "alert('Todo!')"}
|
||||
= cart_icon alt: ""
|
||||
Buy all in NC Mall
|
||||
|
@ -96,9 +99,10 @@
|
|||
|
||||
%table.item-list
|
||||
%thead
|
||||
%tr
|
||||
%td
|
||||
%th{colspan: 2}
|
||||
Total: #{pluralize @np_items.size, "item"}
|
||||
Total: #{pluralize @np_items_needed.size, "item"}
|
||||
%tbody
|
||||
- @np_items.each do |item|
|
||||
= render "item_list_row", item: do
|
||||
|
@ -116,8 +120,13 @@
|
|||
"cross-paint" outfits.
|
||||
|
||||
- @pb_items_by_color.each do |color, items|
|
||||
%table.item-list{"data-group-type": "bundle"}
|
||||
- items_needed = @pb_items_needed_by_color[color]
|
||||
%table.item-list{
|
||||
"data-group-type": "bundle",
|
||||
"data-group-owned": items.all?(&:owned?),
|
||||
}
|
||||
%thead
|
||||
%tr
|
||||
%td.thumbnail-cell
|
||||
- if color&.pb_item_thumbnail_url?
|
||||
= image_tag color.pb_item_thumbnail_url,
|
||||
|
@ -134,7 +143,7 @@
|
|||
#{color.pb_item_name || color.name.humanize}
|
||||
- else
|
||||
Basic colors
|
||||
(#{pluralize items.size, "item"})
|
||||
(#{pluralize items_needed.size, "item"})
|
||||
%td.actions-cell
|
||||
- if color&.pb_item_name?
|
||||
= button_link_to "Shops",
|
||||
|
@ -175,7 +184,7 @@
|
|||
%thead
|
||||
%td
|
||||
%th{colspan: 2}
|
||||
Total: #{pluralize @other_nc_items.size, "item"}
|
||||
Total: #{pluralize @other_nc_items_needed.size, "item"}
|
||||
%tbody
|
||||
- @other_nc_items.each do |item|
|
||||
= render "item_list_row", item: do
|
||||
|
|
Loading…
Reference in a new issue