Class: Crm::AttachmentsDisplayComponent

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/crm/attachments_display_component.rb

Overview

ViewComponent: renders the attachments display block.

Instance Attribute Summary collapse

Instance Method Summary collapse

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_objectObject (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_pathObject (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_idObject



21
22
23
# File 'app/components/crm/attachments_display_component.rb', line 21

def attachments_container_id
  "attachments-#{context_object_id}"
end

#context_object_idObject



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_idObject



17
18
19
# File 'app/components/crm/attachments_display_component.rb', line 17

def frame_id
  "attachments-frame-#{context_object_id}"
end