Class: Avo::Fields::IndexComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- Avo::Fields::IndexComponent
- Includes:
- ResourcesHelper
- Defined in:
- app/components/avo/fields/index_component.rb
Direct Known Subclasses
BadgeField::IndexComponent, BelongsToField::IndexComponent, BooleanField::IndexComponent, BooleanGroupField::IndexComponent, CountryField::IndexComponent, DateField::IndexComponent, DateTimeField::IndexComponent, ExternalImageField::IndexComponent, FileField::IndexComponent, FilesField::IndexComponent, GravatarField::IndexComponent, HasOneField::IndexComponent, Avo::Fields::IdField::IndexComponent, NumberField::IndexComponent, PreviewField::IndexComponent, ProgressBarField::IndexComponent, SelectField::IndexComponent, StatusField::IndexComponent, TagsField::IndexComponent, TextField::IndexComponent, TimeField::IndexComponent
Constant Summary
Constants included from Concerns::FindAssociationField
Concerns::FindAssociationField::ASSOCIATIONS
Instance Attribute Summary collapse
-
#field ⇒ Object
readonly
Returns the value of attribute field.
-
#kwargs ⇒ Object
readonly
Returns the value of attribute kwargs.
-
#parent_resource ⇒ Object
readonly
Returns the value of attribute parent_resource.
-
#view ⇒ Object
readonly
Returns the value of attribute view.
Instance Method Summary collapse
- #field_wrapper_args ⇒ Object
-
#initialize(field: nil, resource: nil, reflection: nil, index: 0, parent_record: nil, parent_resource: nil, **kwargs) ⇒ IndexComponent
constructor
A new instance of IndexComponent.
- #resource_view_path ⇒ Object
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(field: nil, resource: nil, reflection: nil, index: 0, parent_record: nil, parent_resource: nil, **kwargs) ⇒ IndexComponent
Returns a new instance of IndexComponent.
11 12 13 14 15 16 17 18 19 20 |
# File 'app/components/avo/fields/index_component.rb', line 11 def initialize(field: nil, resource: nil, reflection: nil, index: 0, parent_record: nil, parent_resource: nil, **kwargs) @field = field @resource = resource @index = index @kwargs = kwargs @parent_record = parent_record @parent_resource = parent_resource @view = Avo::ViewInquirer.new("index") @reflection = reflection end |
Instance Attribute Details
#field ⇒ Object (readonly)
Returns the value of attribute field.
6 7 8 |
# File 'app/components/avo/fields/index_component.rb', line 6 def field @field end |
#kwargs ⇒ Object (readonly)
Returns the value of attribute kwargs.
7 8 9 |
# File 'app/components/avo/fields/index_component.rb', line 7 def kwargs @kwargs end |
#parent_resource ⇒ Object (readonly)
Returns the value of attribute parent_resource.
8 9 10 |
# File 'app/components/avo/fields/index_component.rb', line 8 def parent_resource @parent_resource end |
#view ⇒ Object (readonly)
Returns the value of attribute view.
9 10 11 |
# File 'app/components/avo/fields/index_component.rb', line 9 def view @view end |
Instance Method Details
#field_wrapper_args ⇒ Object
35 36 37 38 39 40 |
# File 'app/components/avo/fields/index_component.rb', line 35 def field_wrapper_args { field: @field, resource: @resource } end |
#resource_view_path ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/components/avo/fields/index_component.rb', line 22 def resource_view_path args = {} if @parent_record.present? args = { via_resource_class: @parent_resource.class, via_record_id: @parent_record.to_param } end helpers.resource_view_path(record: @resource.record, resource: parent_or_child_resource, **args) end |