Class: QuickSearch::OrderPresenter
- Inherits:
-
PinPresenter
- Object
- PinPresenter
- QuickSearch::OrderPresenter
- Defined in:
- app/presenters/quick_search/order_presenter.rb
Overview
Presents an Order as a quick search result / pinned item.
Instance Method Summary collapse
-
#build_title ⇒ String
Opportunity name and customer reference, deduplicated and joined with a pipe.
-
#set_attributes ⇒ void
Sets the card title and badge sub-header.
Instance Method Details
#build_title ⇒ String
Returns opportunity name and customer reference, deduplicated
and joined with a pipe.
17 18 19 20 21 |
# File 'app/presenters/quick_search/order_presenter.rb', line 17 def build_title parts = [result.opportunity&.name, result.customer_reference] # Remove blank values, normalize strings, and deduplicate parts.map(&:presence).compact_blank.map(&:strip).uniq.join(' | ') end |
#set_attributes ⇒ void
This method returns an undefined value.
Sets the card title and badge sub-header.
10 11 12 13 |
# File 'app/presenters/quick_search/order_presenter.rb', line 10 def set_attributes @title = build_title @sub_header = build_sub_header end |