Class: Crm::AttachmentsComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Crm::AttachmentsComponent
- Defined in:
- app/components/crm/attachments_component.rb
Instance Attribute Summary collapse
-
#attach_url ⇒ Object
readonly
Returns the value of attribute attach_url.
-
#category_options_for_select ⇒ Object
readonly
Returns the value of attribute category_options_for_select.
-
#context_object ⇒ Object
readonly
Returns the value of attribute context_object.
-
#disable_delete ⇒ Object
readonly
Returns the value of attribute disable_delete.
-
#multiple_files_allowed ⇒ Object
readonly
Returns the value of attribute multiple_files_allowed.
-
#parent_form_id ⇒ Object
readonly
Returns the value of attribute parent_form_id.
-
#skip_publications ⇒ Object
readonly
Returns the value of attribute skip_publications.
-
#template_options_for_select ⇒ Object
readonly
Returns the value of attribute template_options_for_select.
-
#wrapped ⇒ Object
readonly
Returns the value of attribute wrapped.
Instance Method Summary collapse
- #attachments_container_id ⇒ Object
- #context_class_name ⇒ Object
- #context_object_id ⇒ Object
- #controller_path ⇒ Object
- #frame_id ⇒ Object
-
#initialize(context_object:, attach_url:, wrapped: true, skip_publications: false, multiple_files_allowed: true, template_options_for_select: nil, category_options_for_select: nil, disable_delete: false, context_class_name: nil, controller_path: nil, parent_form_id: nil) ⇒ AttachmentsComponent
constructor
A new instance of AttachmentsComponent.
- #modal_id ⇒ Object
Constructor Details
#initialize(context_object:, attach_url:, wrapped: true, skip_publications: false, multiple_files_allowed: true, template_options_for_select: nil, category_options_for_select: nil, disable_delete: false, context_class_name: nil, controller_path: nil, parent_form_id: nil) ⇒ AttachmentsComponent
Returns a new instance of AttachmentsComponent.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/components/crm/attachments_component.rb', line 7 def initialize(context_object:, attach_url:, wrapped: true, skip_publications: false, multiple_files_allowed: true, template_options_for_select: nil, category_options_for_select: nil, disable_delete: false, context_class_name: nil, controller_path: nil, parent_form_id: nil) super() @context_object = context_object @attach_url = attach_url @wrapped = wrapped @skip_publications = skip_publications @multiple_files_allowed = multiple_files_allowed @template_options_for_select = @category_options_for_select = @disable_delete = disable_delete @explicit_context_class_name = context_class_name || context_object.class.name @controller_path = controller_path @parent_form_id = parent_form_id end |
Instance Attribute Details
#attach_url ⇒ Object (readonly)
Returns the value of attribute attach_url.
4 5 6 |
# File 'app/components/crm/attachments_component.rb', line 4 def attach_url @attach_url end |
#category_options_for_select ⇒ Object (readonly)
Returns the value of attribute category_options_for_select.
4 5 6 |
# File 'app/components/crm/attachments_component.rb', line 4 def @category_options_for_select end |
#context_object ⇒ Object (readonly)
Returns the value of attribute context_object.
4 5 6 |
# File 'app/components/crm/attachments_component.rb', line 4 def context_object @context_object end |
#disable_delete ⇒ Object (readonly)
Returns the value of attribute disable_delete.
4 5 6 |
# File 'app/components/crm/attachments_component.rb', line 4 def disable_delete @disable_delete end |
#multiple_files_allowed ⇒ Object (readonly)
Returns the value of attribute multiple_files_allowed.
4 5 6 |
# File 'app/components/crm/attachments_component.rb', line 4 def multiple_files_allowed @multiple_files_allowed end |
#parent_form_id ⇒ Object (readonly)
Returns the value of attribute parent_form_id.
4 5 6 |
# File 'app/components/crm/attachments_component.rb', line 4 def parent_form_id @parent_form_id end |
#skip_publications ⇒ Object (readonly)
Returns the value of attribute skip_publications.
4 5 6 |
# File 'app/components/crm/attachments_component.rb', line 4 def skip_publications @skip_publications end |
#template_options_for_select ⇒ Object (readonly)
Returns the value of attribute template_options_for_select.
4 5 6 |
# File 'app/components/crm/attachments_component.rb', line 4 def @template_options_for_select end |
#wrapped ⇒ Object (readonly)
Returns the value of attribute wrapped.
4 5 6 |
# File 'app/components/crm/attachments_component.rb', line 4 def wrapped @wrapped end |
Instance Method Details
#attachments_container_id ⇒ Object
52 53 54 |
# File 'app/components/crm/attachments_component.rb', line 52 def "attachments-#{context_object_id}" end |
#context_class_name ⇒ Object
36 37 38 |
# File 'app/components/crm/attachments_component.rb', line 36 def context_class_name @explicit_context_class_name end |
#context_object_id ⇒ Object
32 33 34 |
# File 'app/components/crm/attachments_component.rb', line 32 def context_object_id context_object.try(:id).to_i end |
#controller_path ⇒ Object
40 41 42 |
# File 'app/components/crm/attachments_component.rb', line 40 def controller_path @controller_path || context_object.class.name.tableize end |
#frame_id ⇒ Object
48 49 50 |
# File 'app/components/crm/attachments_component.rb', line 48 def frame_id "attachments-frame-#{context_object_id}" end |
#modal_id ⇒ Object
44 45 46 |
# File 'app/components/crm/attachments_component.rb', line 44 def modal_id "publication-picker-modal-#{context_object_id}" end |