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}") - title t(".title.#{@type}")
- hide_title_header - hide_title_header
= render partial: "items/item_header", = render partial: "items/item_header", locals: {item: @item,
locals: {item: @item, current_subpage: "trades_#{@type}"} trades: @item_trades, current_subpage: "trades_#{@type}"}
%h2.item-subpage-title= t(".title.#{@type}") %h2.item-subpage-title= t(".title.#{@type}")

View file

@ -1,4 +1,5 @@
- raise ArgumentError unless defined? item - raise ArgumentError unless defined? item
- raise ArgumentError unless defined? trades
- raise ArgumentError unless defined? current_subpage - raise ArgumentError unless defined? current_subpage
%header.item-header %header.item-header
@ -27,10 +28,12 @@
%header= t('items.show.subpages_nav.trades.header') %header= t('items.show.subpages_nav.trades.header')
%ul %ul
%li %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'), item_trades_path(item, type: 'offering'),
'data-is-current' => current_subpage == 'trades_offering' 'data-is-current' => current_subpage == 'trades_offering'
%li %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'), item_trades_path(item, type: 'seeking'),
'data-is-current' => current_subpage == 'trades_seeking' 'data-is-current' => current_subpage == 'trades_seeking'

View file

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

View file

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