Wider tables for longer item names in Item Getting Guide

If the item names are long, it helps to give them more room to breathe!
Whereas if they're short, it looks silly and makes it harder to scan
the table.

Just an extra bit of help for e.g. Dyeworks items with long names!
This commit is contained in:
Emi Matchu 2024-06-20 14:16:51 -07:00
parent b137eed4c4
commit 568c30fa90
2 changed files with 10 additions and 4 deletions

View file

@ -208,6 +208,11 @@ module ItemsHelper
dyeworks_average_num_potions_for(items) * 125
end
def complexity_for(items)
max_name_length = items.map(&:name).map(&:length).max
max_name_length >= 40 ? "high" : "low"
end
def probability(p)
case p
when 1

View file

@ -11,7 +11,7 @@
[nc]: https://secure.nc.neopets.com/get-neocash
[gc]: https://secure.nc.neopets.com/nickcash-cards
%table.item-list
%table.item-list{"data-complexity": complexity_for(@items[:nc_mall])}
%thead
%tr
%td
@ -46,7 +46,7 @@
[dyeworks]: https://www.neopets.com/mall/dyeworks/
%table.item-list{"data-complexity": "high"}
%table.item-list{"data-complexity": complexity_for(@items[:dyeworks])}
%thead
%tr
%td.thumbnail-cell
@ -120,7 +120,7 @@
[tp]: https://www.neopets.com/island/tradingpost.phtml?type=browse
[ag]: https://www.neopets.com/genie.phtml
%table.item-list
%table.item-list{"data-complexity": complexity_for(@items[:np])}
%thead
%tr
%td
@ -147,6 +147,7 @@
%table.item-list{
"data-group-type": "bundle",
"data-group-owned": items.all?(&:owned?),
"data-complexity": complexity_for(items),
}
%thead
%tr
@ -203,7 +204,7 @@
[owls]: https://www.neopets.com/~owls
%table.item-list
%table.item-list{"data-complexity": complexity_for(@items[:other_nc])}
%thead
%td
%th.name-cell{colspan: 2}