Class: Avo::Fields::IndexComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- 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, ProgressBarField::IndexComponent, SelectField::IndexComponent, StatusField::IndexComponent, TagsField::IndexComponent, TextField::IndexComponent, TimeField::IndexComponent
Instance Attribute Summary collapse
-
#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, index: 0, parent_model: nil, parent_resource: nil) ⇒ IndexComponent
constructor
A new instance of IndexComponent.
- #resource_view_path ⇒ Object
Methods included from ResourcesHelper
#field_wrapper, #filter_wrapper, #index_field_wrapper, #item_select_all_input, #item_selector_init, #item_selector_input, #resource_grid, #resource_table
Constructor Details
#initialize(field: nil, resource: nil, index: 0, parent_model: nil, parent_resource: nil) ⇒ IndexComponent
Returns a new instance of IndexComponent.
9 10 11 12 13 14 15 16 |
# File 'app/components/avo/fields/index_component.rb', line 9 def initialize(field: nil, resource: nil, index: 0, parent_model: nil, parent_resource: nil) @field = field @resource = resource @index = index @parent_model = parent_model @parent_resource = parent_resource @view = :index end |
Instance Attribute Details
#parent_resource ⇒ Object (readonly)
Returns the value of attribute parent_resource.
6 7 8 |
# File 'app/components/avo/fields/index_component.rb', line 6 def parent_resource @parent_resource end |
#view ⇒ Object (readonly)
Returns the value of attribute view.
7 8 9 |
# File 'app/components/avo/fields/index_component.rb', line 7 def view @view end |
Instance Method Details
#field_wrapper_args ⇒ Object
31 32 33 34 35 36 |
# File 'app/components/avo/fields/index_component.rb', line 31 def field_wrapper_args { field: @field, resource: @resource } end |
#resource_view_path ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/components/avo/fields/index_component.rb', line 18 def resource_view_path args = {} if @parent_model.present? args = { via_resource_class: @parent_resource.class, via_resource_id: @parent_model.id } end helpers.resource_view_path(model: @resource.model, resource: @resource, **args) end |