Class: Search::RoomConfigurationPresenter

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

Overview

Presents room configuration search results with HTML links and badges.

Direct Known Subclasses

RoomConfigurationTextPresenter

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

Returns a link to the associated customer.

Returns:

  • (ActiveSupport::SafeBuffer)

    the customer link



45
46
47
# File 'app/presenters/search/room_configuration_presenter.rb', line 45

def customer_link
  h.link_to r.customer_full_name, h.customer_path(r.customer_id)
end

#has_quotesString

Returns a "Yes"/"No" label for the has_quotes flag.

Returns:

  • (String)

    "Yes" or "No"



52
53
54
# File 'app/presenters/search/room_configuration_presenter.rb', line 52

def has_quotes
  h.y r.has_quotes
end

Returns a link to the associated opportunity, if available.

Returns:

  • (ActiveSupport::SafeBuffer, nil)

    the opportunity link, or nil



29
30
31
32
33
# File 'app/presenters/search/room_configuration_presenter.rb', line 29

def opportunity_link
  return unless r.has_columns?(:opportunity_name, :opportunity_id)

  h.link_to r.opportunity_name, h.opportunity_path(r.opportunity_id)
end

#priority_labelActiveSupport::SafeBuffer

Returns a priority badge with a Bootstrap background class.

Returns:

  • (ActiveSupport::SafeBuffer)

    the priority badge



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

def priority_label
  label_class = %w[danger warning info primary secondary][r.priority_factor]
  h. :span, r.priority, class: "badge bg-#{label_class}"
end

Returns a link to the room configuration.

Returns:

  • (ActiveSupport::SafeBuffer)

    the room link



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

def room_link
  h.link_to r.reference_number, h.room_configuration_path(r.id)
end

#stateString

Returns the human-readable state name.

Returns:

  • (String)

    the room configuration state



38
39
40
# File 'app/presenters/search/room_configuration_presenter.rb', line 38

def state
  RoomConfiguration.human_state_name(r.state)
end