Class: Search::ContactPresenter
- Inherits:
-
BasePresenter
- Object
- SimpleDelegator
- BasePresenter
- Search::ContactPresenter
- Includes:
- Presenters::Timeable
- Defined in:
- app/presenters/search/contact_presenter.rb
Overview
Row presenter for ViewContact — renders the cells in the CRM contact
search/results table.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from BasePresenter
#current_account, #options, #url_helper
Instance Method Summary collapse
-
#contact ⇒ ActiveSupport::SafeBuffer?
Linked contact name → contact show page.
-
#contact_roles ⇒ String?
Human-readable, comma-separated list of the contact's roles.
-
#customer ⇒ ActiveSupport::SafeBuffer?
Linked customer name → customer show page.
-
#primary_fax ⇒ ActiveSupport::SafeBuffer?
Primary fax number formatted for domestic display.
-
#primary_fax_international ⇒ String?
Raw primary fax number (international formatting preserved).
-
#primary_phone ⇒ ActiveSupport::SafeBuffer?
Primary phone number formatted for domestic display.
-
#primary_phone_international ⇒ String?
Raw primary phone number (international formatting preserved).
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
#contact ⇒ ActiveSupport::SafeBuffer?
Linked contact name → contact show page.
13 14 15 16 17 |
# File 'app/presenters/search/contact_presenter.rb', line 13 def contact return unless r.has_columns?(:id, :full_name) && r.id && r.full_name h.link_to r.full_name, h.contact_path(r.id) end |
#contact_roles ⇒ String?
Human-readable, comma-separated list of the contact's roles.
31 32 33 34 35 |
# File 'app/presenters/search/contact_presenter.rb', line 31 def contact_roles return unless r.has_columns?(:contact_roles) && r.contact_roles.present? (r.contact_roles || []).filter_map(&:presence).map(&:titleize).try(:to_sentence) end |
#customer ⇒ ActiveSupport::SafeBuffer?
Linked customer name → customer show page.
22 23 24 25 26 |
# File 'app/presenters/search/contact_presenter.rb', line 22 def customer return unless r.has_columns?(:customer_id, :customer_full_name) && r.customer_id && r.customer_full_name h.link_to r.customer_full_name, h.customer_path(r.customer_id) end |
#primary_fax ⇒ ActiveSupport::SafeBuffer?
Primary fax number formatted for domestic display.
49 50 51 52 53 |
# File 'app/presenters/search/contact_presenter.rb', line 49 def primary_fax return unless r.has_columns?(:primary_fax) && r.primary_fax.present? h.number_to_phone(r.primary_fax) end |
#primary_fax_international ⇒ String?
Raw primary fax number (international formatting preserved).
67 68 69 70 71 |
# File 'app/presenters/search/contact_presenter.rb', line 67 def primary_fax_international return unless r.has_columns?(:primary_fax) && r.primary_fax.present? r.primary_fax end |
#primary_phone ⇒ ActiveSupport::SafeBuffer?
Primary phone number formatted for domestic display.
40 41 42 43 44 |
# File 'app/presenters/search/contact_presenter.rb', line 40 def primary_phone return unless r.has_columns?(:primary_phone) && r.primary_phone.present? h.number_to_phone(r.primary_phone) end |
#primary_phone_international ⇒ String?
Raw primary phone number (international formatting preserved).
58 59 60 61 62 |
# File 'app/presenters/search/contact_presenter.rb', line 58 def primary_phone_international return unless r.has_columns?(:primary_phone) && r.primary_phone.present? r.primary_phone end |