Add trade counts to item page tab navigation

This commit is contained in:
Emi Matchu 2024-01-21 04:45:22 -08:00
parent eb6f196b15
commit b9bb697ca1
4 changed files with 10 additions and 7 deletions

View file

@ -1,8 +1,8 @@
- title t(".title.#{@type}")
- hide_title_header
= render partial: "items/item_header",
locals: {item: @item, current_subpage: "trades_#{@type}"}
= render partial: "items/item_header", locals: {item: @item,
trades: @item_trades, current_subpage: "trades_#{@type}"}
%h2.item-subpage-title= t(".title.#{@type}")

View file

@ -1,4 +1,5 @@
- raise ArgumentError unless defined? item
- raise ArgumentError unless defined? trades
- raise ArgumentError unless defined? current_subpage
%header.item-header
@ -27,10 +28,12 @@
%header= t('items.show.subpages_nav.trades.header')
%ul
%li
= link_to t('items.show.subpages_nav.trades.offering'),
= link_to t('items.show.subpages_nav.trades.offering',
count: trades[:offering].size),
item_trades_path(item, type: 'offering'),
'data-is-current' => current_subpage == 'trades_offering'
%li
= link_to t('items.show.subpages_nav.trades.seeking'),
= link_to t('items.show.subpages_nav.trades.seeking',
count: trades[:offering].size),
item_trades_path(item, type: 'seeking'),
'data-is-current' => current_subpage == 'trades_seeking'

View file

@ -2,7 +2,7 @@
- canonical_path @item
= render partial: "item_header",
locals: {item: @item, current_subpage: "preview"}
locals: {item: @item, trades: @trades, current_subpage: "preview"}
%section#item-info-section
#item-info

View file

@ -330,8 +330,8 @@ en:
preview: Preview
trades:
header: Trades
offering: Offering
seeking: Seeking
offering: Offering (%{count})
seeking: Seeking (%{count})
preview:
header: Preview
customize_more: Customize more