Class: ExportedCatalogItemPacketPresenter
- Inherits:
-
BasePresenter
- Object
- SimpleDelegator
- BasePresenter
- ExportedCatalogItemPacketPresenter
- Includes:
- Presenters::StandardOperationsForRecord
- Defined in:
- app/presenters/exported_catalog_item_packet_presenter.rb
Overview
Presenter: exported catalog item packet presenter.
Instance Attribute Summary
Attributes inherited from BasePresenter
#current_account, #options, #url_helper
Instance Method Summary collapse
-
#catalog_items_link(state = 'active') ⇒ String
Link to the catalog items search filtered by this packet's catalogs.
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
#catalog_items_link(state = 'active') ⇒ String
Link to the catalog items search filtered by this packet's catalogs.
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/presenters/exported_catalog_item_packet_presenter.rb', line 12 def catalog_items_link(state = 'active') catalogs = exported_catalog_items.map do |eci| eci.catalog_item.catalog.id rescue StandardError 'unassigned' end.uniq query_params = { catalog_id_in: catalogs.empty? ? [customer.catalog.id] : catalogs, catalog_item_state_in: [state] } h.query_template_link(ProductCatalogSearch, nil, { counter_class: 'badge bg-secondary', query_params: query_params })[0] end |