Class: HasHelpers::Resource::EmailPresenter

Inherits:
RowPresenter show all
Defined in:
app/presenters/has_helpers/resource/email_presenter.rb

Instance Attribute Summary collapse

Attributes inherited from RowPresenter

#is_child, #is_primary, #is_section_header, #items, #template, #toggle

Attributes inherited from BasePresenter

#errors

Instance Method Summary collapse

Methods inherited from BasePresenter

#==, #error_on, #initialize, wrap, wrap_with_options

Methods included from Attributes

included

Constructor Details

This class inherits a constructor from HasHelpers::BasePresenter

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class HasHelpers::BasePresenter

Instance Attribute Details

#current_userObject

Returns the value of attribute current_user.



4
5
6
# File 'app/presenters/has_helpers/resource/email_presenter.rb', line 4

def current_user
  @current_user
end

#wrapped_objectObject

Returns the value of attribute wrapped_object.



4
5
6
# File 'app/presenters/has_helpers/resource/email_presenter.rb', line 4

def wrapped_object
  @wrapped_object
end

Instance Method Details

#cellsObject



14
15
16
17
18
19
20
21
22
23
# File 'app/presenters/has_helpers/resource/email_presenter.rb', line 14

def cells
  ::HasHelpers::Resource::CellPresenter.wrap([
                                               { value: wrapped_object.address,
                                                 service: service },
                                               { value: wrapped_object.location,
                                                 is_header: true,
                                                 is_primary: wrapped_object.is_primary,
                                                 primary_title: wrapped_object["primary_title"] || "Preferred Email" }
                                             ])
end

#primary_titleObject



31
32
33
# File 'app/presenters/has_helpers/resource/email_presenter.rb', line 31

def primary_title
  wrapped_object["primary_title"] || "Preferred Email"
end

#serviceObject



25
26
27
# File 'app/presenters/has_helpers/resource/email_presenter.rb', line 25

def service
  "mailto:#{wrapped_object.address}"
end

#subtitleObject



10
11
12
# File 'app/presenters/has_helpers/resource/email_presenter.rb', line 10

def subtitle
  wrapped_object.location
end

#titleObject



6
7
8
# File 'app/presenters/has_helpers/resource/email_presenter.rb', line 6

def title
  wrapped_object.address
end