Class: HasHelpers::Resource::InfoPresenter

Inherits:
FormPresenter show all
Defined in:
app/presenters/has_helpers/resource/info_presenter.rb

Overview

This class is used to present the informational details of a resource such as name, contact info, and provide service URLs for the resource.

Instance Attribute Summary collapse

Attributes inherited from FormPresenter

#current_organization, #params

Attributes inherited from BasePresenter

#errors

Instance Method Summary collapse

Methods inherited from FormPresenter

#authorize_active_element_proc, #express_form

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

#contact_info_captionObject

Returns the value of attribute contact_info_caption.



5
6
7
# File 'app/presenters/has_helpers/resource/info_presenter.rb', line 5

def contact_info_caption
  @contact_info_caption
end

#current_userObject

Returns the value of attribute current_user.



5
6
7
# File 'app/presenters/has_helpers/resource/info_presenter.rb', line 5

def current_user
  @current_user
end

#details_listsObject

Returns the value of attribute details_lists.



5
6
7
# File 'app/presenters/has_helpers/resource/info_presenter.rb', line 5

def details_lists
  @details_lists
end

#entityObject

alias_method :entity, :wrapped_object



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

def entity
  wrapped_object
end

#is_firstObject

Returns the value of attribute is_first.



5
6
7
# File 'app/presenters/has_helpers/resource/info_presenter.rb', line 5

def is_first
  @is_first
end

#is_lastObject

Returns the value of attribute is_last.



5
6
7
# File 'app/presenters/has_helpers/resource/info_presenter.rb', line 5

def is_last
  @is_last
end

#is_primaryObject

Returns the value of attribute is_primary.



5
6
7
# File 'app/presenters/has_helpers/resource/info_presenter.rb', line 5

def is_primary
  @is_primary
end

#is_warningObject

Returns the value of attribute is_warning.



5
6
7
# File 'app/presenters/has_helpers/resource/info_presenter.rb', line 5

def is_warning
  @is_warning
end

#nameObject



12
13
14
# File 'app/presenters/has_helpers/resource/info_presenter.rb', line 12

def name
  @name || (entity.respond_to?(:name) ? entity.name : nil)
end

#serviceObject

Returns a URL to the service associated with this entity



17
18
19
20
21
22
23
24
# File 'app/presenters/has_helpers/resource/info_presenter.rb', line 17

def service
  @service ||=
    if @service.nil?
      "/#{entity.class.to_s.tableize}/#{entity.id}" if entity && entity.class.respond_to?(:table_name)
    else
      @service
    end
end

#titleObject

Returns the value of attribute title.



5
6
7
# File 'app/presenters/has_helpers/resource/info_presenter.rb', line 5

def title
  @title
end

Instance Method Details

#contact_info_serviceObject



8
9
10
# File 'app/presenters/has_helpers/resource/info_presenter.rb', line 8

def contact_info_service
  service
end

#wrapped_objectObject



26
27
28
# File 'app/presenters/has_helpers/resource/info_presenter.rb', line 26

def wrapped_object
  @wrapped_object || @entity
end