Class: Search::ContactPresenter

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

Overview

Presenter: contact presenter.

Direct Known Subclasses

ContactTextPresenter

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

#contactObject



8
9
10
11
12
# File 'app/presenters/search/contact_presenter.rb', line 8

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_rolesObject



20
21
22
23
24
# File 'app/presenters/search/contact_presenter.rb', line 20

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

#customerObject



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

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_faxObject



32
33
34
35
36
# File 'app/presenters/search/contact_presenter.rb', line 32

def primary_fax
  return unless r.has_columns?(:primary_fax) && r.primary_fax.present?

  h.number_to_phone(r.primary_fax)
end

#primary_fax_internationalObject



44
45
46
47
48
# File 'app/presenters/search/contact_presenter.rb', line 44

def primary_fax_international
  return unless r.has_columns?(:primary_fax) && r.primary_fax.present?

  r.primary_fax
end

#primary_phoneObject



26
27
28
29
30
# File 'app/presenters/search/contact_presenter.rb', line 26

def primary_phone
  return unless r.has_columns?(:primary_phone) && r.primary_phone.present?

  h.number_to_phone(r.primary_phone)
end

#primary_phone_internationalObject



38
39
40
41
42
# File 'app/presenters/search/contact_presenter.rb', line 38

def primary_phone_international
  return unless r.has_columns?(:primary_phone) && r.primary_phone.present?

  r.primary_phone
end