Class: Crm::AttachmentsDisplayComponent

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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



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

def attachments_container_id
  "attachments-#{context_object_id}"
end

#context_object_idObject



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_idObject



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

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