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
Instance Attribute Summary collapse
-
#view ⇒ Object
readonly
Returns the value of attribute view.
Instance Method Summary collapse
-
#initialize(field: nil, resource: nil, index: 0, parent_model: nil) ⇒ IndexComponent
constructor
A new instance of IndexComponent.
- #resource_path ⇒ Object
Methods included from ResourcesHelper
#edit_field_wrapper, #filter_wrapper, #index_field_wrapper, #item_select_all_input, #item_selector_init, #item_selector_input, #resource_grid, #resource_table, #show_field_wrapper
Constructor Details
#initialize(field: nil, resource: nil, index: 0, parent_model: nil) ⇒ IndexComponent
Returns a new instance of IndexComponent.
8 9 10 11 12 13 14 |
# File 'app/components/avo/fields/index_component.rb', line 8 def initialize(field: nil, resource: nil, index: 0, parent_model: nil) @field = field @resource = resource @index = index @parent_model = parent_model @view = :index end |
Instance Attribute Details
#view ⇒ Object (readonly)
Returns the value of attribute view.
6 7 8 |
# File 'app/components/avo/fields/index_component.rb', line 6 def view @view end |
Instance Method Details
#resource_path ⇒ Object
16 17 18 19 20 21 22 |
# File 'app/components/avo/fields/index_component.rb', line 16 def resource_path if @parent_model.present? helpers.resource_path(model: @resource.model, resource: @resource, via_resource_class: @parent_model.class, via_resource_id: @parent_model.id) else helpers.resource_path(model: @resource.model, resource: @resource) end end |