Add OWLS values to non-NC-Mall NC items in Item Getting Guide

Note that there's a known performance issue here: we should try to
fetch all the OWLS values at once, instead of doing them in sequence
while rendering the page!
This commit is contained in:
Emi Matchu 2024-05-27 15:50:41 -07:00
parent c49cf52939
commit 551e8941f3
5 changed files with 28 additions and 3 deletions

View file

@ -61,6 +61,17 @@
text-wrap: balance text-wrap: balance
font-style: italic font-style: italic
.subtitle
font-size: 85%
opacity: .85
a[title]
text-decoration-line: underline
text-decoration-style: dotted
&:hover, &:focus
text-decoration-style: solid
/* For wearable items that belong to a specific set that all come together, /* For wearable items that belong to a specific set that all come together,
* like a Paint Brush. */ * like a Paint Brush. */
&[data-group-type="bundle"] &[data-group-type="bundle"]

View file

@ -156,6 +156,17 @@ module ItemsHelper
"Last updated: #{date_str} (#{time_ago_str} ago)" "Last updated: #{date_str} (#{time_ago_str} ago)"
end end
def nc_trade_value_subtitle_for(item)
value = item.nc_trade_value
return nil if value.nil?
link_to "Owls listing: #{item.nc_trade_value.value_text}",
"https://www.neopets.com/~owls",
title: 'Owls keeps track of approximate "capsule" values of NC items ' +
"for trading. Items with similar values can often be traded for one " +
"another. This is an estimate, not a rule!"
end
private private
def build_on_pet_types(species, special_color=nil, &block) def build_on_pet_types(species, special_color=nil, &block)

View file

@ -28,7 +28,7 @@
= link_to t('items.show.resources.jn_items'), jn_items_url_for(item) = link_to t('items.show.resources.jn_items'), jn_items_url_for(item)
= link_to t('items.show.resources.impress_2020'), impress_2020_url_for(item) = link_to t('items.show.resources.impress_2020'), impress_2020_url_for(item)
- if item.nc_trade_value - if item.nc_trade_value
= link_to t('items.show.resources.owls', value: item.nc_trade_value.value_text), = link_to t('items.show.resources.owls', value: item.nc_trade_value_text),
"https://www.neopets.com/~owls", "https://www.neopets.com/~owls",
title: nc_trade_value_updated_at_text(item.nc_trade_value) title: nc_trade_value_updated_at_text(item.nc_trade_value)
- unless item.nc? - unless item.nc?

View file

@ -2,5 +2,8 @@
%td.thumbnail-cell %td.thumbnail-cell
= link_to item_thumbnail_for(item), item, target: "_blank", = link_to item_thumbnail_for(item), item, target: "_blank",
tabindex: "-1" tabindex: "-1"
%td.name-cell= link_to item.name, item, target: "_blank" %td.name-cell
= link_to item.name, item, target: "_blank"
- if subtitle.present?
.subtitle= subtitle
%td.actions-cell= yield %td.actions-cell= yield

View file

@ -106,7 +106,7 @@
Total: #{pluralize @other_nc_items.size, "item"} Total: #{pluralize @other_nc_items.size, "item"}
%tbody %tbody
- @other_nc_items.each do |item| - @other_nc_items.each do |item|
= render "item_list_row", item: do = render "item_list_row", item:, subtitle: nc_trade_value_subtitle_for(item) do
= button_link_to "NC Trades", = button_link_to "NC Trades",
item_trades_path(item, type: "offering"), item_trades_path(item, type: "offering"),
target: "_blank", icon: search_icon target: "_blank", icon: search_icon