Class: Crm::AttachmentsDisplayComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Crm::AttachmentsDisplayComponent
- Defined in:
- app/components/crm/attachments_display_component.rb
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.
6 7 8 9 10 |
# File 'app/components/crm/attachments_display_component.rb', line 6 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.
4 5 6 |
# File 'app/components/crm/attachments_display_component.rb', line 4 def context_object @context_object end |
#controller_path ⇒ Object (readonly)
Returns the value of attribute controller_path.
4 5 6 |
# File 'app/components/crm/attachments_display_component.rb', line 4 def controller_path @controller_path end |
Instance Method Details
#attachments_container_id ⇒ Object
20 21 22 |
# File 'app/components/crm/attachments_display_component.rb', line 20 def "attachments-#{context_object_id}" end |
#context_object_id ⇒ Object
12 13 14 |
# File 'app/components/crm/attachments_display_component.rb', line 12 def context_object_id context_object.try(:id).to_i end |
#frame_id ⇒ Object
16 17 18 |
# File 'app/components/crm/attachments_display_component.rb', line 16 def frame_id "attachments-frame-#{context_object_id}" end |