Class: Search::RoomConfigurationPresenter
- Inherits:
-
BasePresenter
- Object
- SimpleDelegator
- BasePresenter
- Search::RoomConfigurationPresenter
- 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
Instance Attribute Summary
Attributes inherited from BasePresenter
#current_account, #options, #url_helper
Instance Method Summary collapse
-
#customer_link ⇒ ActiveSupport::SafeBuffer
Returns a link to the associated customer.
-
#has_quotes ⇒ String
Returns a "Yes"/"No" label for the has_quotes flag.
-
#opportunity_link ⇒ ActiveSupport::SafeBuffer?
Returns a link to the associated opportunity, if available.
-
#priority_label ⇒ ActiveSupport::SafeBuffer
Returns a priority badge with a Bootstrap background class.
-
#room_link ⇒ ActiveSupport::SafeBuffer
Returns a link to the room configuration.
-
#state ⇒ String
Returns the human-readable state name.
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
#customer_link ⇒ ActiveSupport::SafeBuffer
Returns a link to the associated customer.
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_quotes ⇒ String
Returns a "Yes"/"No" label for the has_quotes flag.
52 53 54 |
# File 'app/presenters/search/room_configuration_presenter.rb', line 52 def has_quotes h.y r.has_quotes end |
#opportunity_link ⇒ ActiveSupport::SafeBuffer?
Returns a link to the associated opportunity, if available.
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_label ⇒ ActiveSupport::SafeBuffer
Returns a priority badge with a Bootstrap background class.
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.content_tag :span, r.priority, class: "badge bg-#{label_class}" end |
#room_link ⇒ ActiveSupport::SafeBuffer
Returns a link to the room configuration.
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 |
#state ⇒ String
Returns the human-readable state name.
38 39 40 |
# File 'app/presenters/search/room_configuration_presenter.rb', line 38 def state RoomConfiguration.human_state_name(r.state) end |