Class: HasHelpers::Resource::InfoPresenter
- Inherits:
-
FormPresenter
- Object
- BasePresenter
- FormPresenter
- HasHelpers::Resource::InfoPresenter
- 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
-
#contact_info_caption ⇒ Object
Returns the value of attribute contact_info_caption.
-
#current_user ⇒ Object
Returns the value of attribute current_user.
-
#details_lists ⇒ Object
Returns the value of attribute details_lists.
-
#entity ⇒ Object
alias_method :entity, :wrapped_object.
-
#is_first ⇒ Object
Returns the value of attribute is_first.
-
#is_last ⇒ Object
Returns the value of attribute is_last.
-
#is_primary ⇒ Object
Returns the value of attribute is_primary.
-
#is_warning ⇒ Object
Returns the value of attribute is_warning.
- #name ⇒ Object
-
#service ⇒ Object
Returns a URL to the service associated with this entity.
-
#title ⇒ Object
Returns the value of attribute title.
Attributes inherited from FormPresenter
#current_organization, #params
Attributes inherited from BasePresenter
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
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_caption ⇒ Object
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_user ⇒ Object
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_lists ⇒ Object
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 |
#entity ⇒ Object
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_first ⇒ Object
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_last ⇒ Object
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_primary ⇒ Object
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_warning ⇒ Object
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 |
#name ⇒ Object
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 |
#service ⇒ Object
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 |
#title ⇒ Object
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_service ⇒ Object
8 9 10 |
# File 'app/presenters/has_helpers/resource/info_presenter.rb', line 8 def contact_info_service service end |
#wrapped_object ⇒ Object
26 27 28 |
# File 'app/presenters/has_helpers/resource/info_presenter.rb', line 26 def wrapped_object @wrapped_object || @entity end |