Class: Avo::Fields::TrixField::EditComponent
- Inherits:
-
EditComponent
- Object
- ViewComponent::Base
- BaseComponent
- EditComponent
- Avo::Fields::TrixField::EditComponent
- Defined in:
- app/components/avo/fields/trix_field/edit_component.rb
Constant Summary
Constants included from Concerns::FindAssociationField
Concerns::FindAssociationField::ASSOCIATIONS
Instance Attribute Summary collapse
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
Attributes inherited from EditComponent
#compact, #field, #form, #index, #kwargs, #multiple, #stacked, #view
Instance Method Summary collapse
- #data_values ⇒ Object
-
#initialize(**args) ⇒ EditComponent
constructor
A new instance of EditComponent.
- #trix_id ⇒ Object
Methods inherited from EditComponent
#classes, #disabled?, #field_wrapper_args, #render?
Methods included from ResourcesHelper
#field_wrapper, #filter_wrapper, #index_field_wrapper, #item_selector_data_attributes, #resource_grid, #resource_show_path, #resource_table
Methods inherited from BaseComponent
Methods included from Concerns::FindAssociationField
Constructor Details
#initialize(**args) ⇒ EditComponent
Returns a new instance of EditComponent.
6 7 8 9 10 11 12 |
# File 'app/components/avo/fields/trix_field/edit_component.rb', line 6 def initialize(**args) @resource = args[:resource] @resource_id = args[:resource_id] || @resource&.record&.to_param @resource_name = args[:resource_name] || @resource&.singular_route_key super(**args) end |
Instance Attribute Details
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
4 5 6 |
# File 'app/components/avo/fields/trix_field/edit_component.rb', line 4 def resource @resource end |
Instance Method Details
#data_values ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/components/avo/fields/trix_field/edit_component.rb', line 22 def data_values { resource_name: @resource_name, resource_id: @resource_id, attachments_disabled: @field., attachment_key: @field., hide_attachment_filename: @field., hide_attachment_filesize: @field., hide_attachment_url: @field., is_action_text: @field.is_action_text?, }.transform_keys { |key| "trix_field_#{key}_value" } end |
#trix_id ⇒ Object
14 15 16 17 18 19 20 |
# File 'app/components/avo/fields/trix_field/edit_component.rb', line 14 def trix_id if @resource_name.present? "trix_#{@resource_name}_#{@field.id}" elsif form.present? "trix_#{form.index}_#{@field.id}" end end |