Class: Crm::AttachmentsDisplayComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Crm::AttachmentsDisplayComponent
- Defined in:
- app/components/crm/attachments_display_component.rb
Overview
ViewComponent: renders the attachments display block.
Instance Attribute Summary collapse
-
#context_object ⇒ Object
readonly
Returns the value of attribute context_object.
-
#controller_path ⇒ Object
readonly
Returns the value of attribute controller_path.
Instance Method Summary collapse
- #attachments_container_id ⇒ Object
- #context_object_id ⇒ Object
- #frame_id ⇒ Object
-
#initialize(context_object:, controller_path: nil) ⇒ AttachmentsDisplayComponent
constructor
A new instance of AttachmentsDisplayComponent.
Constructor Details
#initialize(context_object:, controller_path: nil) ⇒ AttachmentsDisplayComponent
Returns a new instance of AttachmentsDisplayComponent.
7 8 9 10 11 |
# File 'app/components/crm/attachments_display_component.rb', line 7 def initialize(context_object:, controller_path: nil) super() @context_object = context_object @controller_path = controller_path || context_object.class.name.tableize end |
Instance Attribute Details
#context_object ⇒ Object (readonly)
Returns the value of attribute context_object.
5 6 7 |
# File 'app/components/crm/attachments_display_component.rb', line 5 def context_object @context_object end |
#controller_path ⇒ Object (readonly)
Returns the value of attribute controller_path.
5 6 7 |
# File 'app/components/crm/attachments_display_component.rb', line 5 def controller_path @controller_path end |
Instance Method Details
#attachments_container_id ⇒ Object
21 22 23 |
# File 'app/components/crm/attachments_display_component.rb', line 21 def "attachments-#{context_object_id}" end |
#context_object_id ⇒ Object
13 14 15 |
# File 'app/components/crm/attachments_display_component.rb', line 13 def context_object_id context_object.try(:id).to_i end |
#frame_id ⇒ Object
17 18 19 |
# File 'app/components/crm/attachments_display_component.rb', line 17 def frame_id "attachments-frame-#{context_object_id}" end |