Class: Search::SupplierItemPresenter

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

Overview

Presents supplier item search results with HTML links and status icons.

See Also:

Direct Known Subclasses

SupplierItemTextPresenter

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

#activeString

Returns an active/inactive status icon.

Returns:

  • (String)

    the status icon HTML



23
24
25
# File 'app/presenters/search/supplier_item_presenter.rb', line 23

def active
  h.check_or_cross r.active
end

Returns a link to the associated item, if available.

Returns:

  • (ActiveSupport::SafeBuffer, nil)

    the item link, or nil



14
15
16
17
18
# File 'app/presenters/search/supplier_item_presenter.rb', line 14

def item_link
  return unless r.has_columns?(:sku, :item_id)

  h.link_to r.sku, h.item_path(r.item_id)
end