Class: QuickSearch::OrderPresenter

Inherits:
PinPresenter
  • Object
show all
Defined in:
app/presenters/quick_search/order_presenter.rb

Overview

Presents an Order as a quick search result / pinned item.

See Also:

Instance Method Summary collapse

Instance Method Details

#build_titleString

Returns opportunity name and customer reference, deduplicated
and joined with a pipe.

Returns:

  • (String)

    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_attributesvoid

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