Class: QuickSearch::ItemPresenter
- Inherits:
-
PinPresenter
- Object
- PinPresenter
- QuickSearch::ItemPresenter
- Defined in:
- app/presenters/quick_search/item_presenter.rb
Overview
Presents an Item as a quick search result / pinned item, with state and
ASIN badges; publication items link to the publication page instead.
Instance Method Summary collapse
-
#set_attributes ⇒ void
Sets the card title (SKU), badge sub-header, link, and result class.
-
#text_sub_header ⇒ String
The item name shown as plain-text sub-header.
Instance Method Details
#set_attributes ⇒ void
This method returns an undefined value.
Sets the card title (SKU), badge sub-header, link, and result class.
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/presenters/quick_search/item_presenter.rb', line 11 def set_attributes @title = result.sku @sub_header = +'' @sub_header << item_state_badge @sub_header << h.tag.span(result.amazon_asin, class: 'badge bg-info') if result.amazon_asin.present? if result.is_publication? @link = publication_path(result) @result_class = :publication else @link = item_path(result) @result_class = :item end end |
#text_sub_header ⇒ String
Returns the item name shown as plain-text sub-header.
26 27 28 |
# File 'app/presenters/quick_search/item_presenter.rb', line 26 def text_sub_header result.name end |