Class: Search::ItemPresenter

Inherits:
BasePresenter show all
Includes:
Presenters::Timeable
Defined in:
app/presenters/search/item_presenter.rb

Overview

Renders CRM item search result rows as HTML cells.

Wraps a ViewItem projection and produces thumbnail links, SKU/name
links, and a yes/no discontinued indicator.

Direct Known Subclasses

ItemTextPresenter

Instance Attribute Summary

Attributes inherited from BasePresenter

#current_account, #options, #url_helper

Instance Method Summary collapse

Methods inherited from BasePresenter

#can?, #capture, #concat, #content_tag, #fa_icon, #h, #initialize, #link_to, #number_to_currency, #present, presents, #r, #safe_present, #simple_format, #u

Constructor Details

This class inherits a constructor from BasePresenter

Instance Method Details

#is_discontinuedActiveSupport::SafeBuffer

Y / blank indicator for discontinued status.

Returns:

  • (ActiveSupport::SafeBuffer)


36
37
38
# File 'app/presenters/search/item_presenter.rb', line 36

def is_discontinued
  h.y r.is_discontinued
end

Item thumbnail image linked to the item show page.

Returns:

  • (ActiveSupport::SafeBuffer)


15
16
17
# File 'app/presenters/search/item_presenter.rb', line 15

def item_thumbnail_link
  h.item_thumbnail_link r
end

Linked item name → item show page.

Returns:

  • (ActiveSupport::SafeBuffer)


29
30
31
# File 'app/presenters/search/item_presenter.rb', line 29

def name_with_link
  h.link_to r.name, h.item_path(r.id)
end

Linked item SKU → item show page.

Returns:

  • (ActiveSupport::SafeBuffer)


22
23
24
# File 'app/presenters/search/item_presenter.rb', line 22

def sku_with_link
  h.link_to r.sku, h.item_path(r.id)
end