Class: Avo::Index::TableRowComponent
- Inherits:
-
BaseComponent
- Object
- BaseComponent
- Avo::Index::TableRowComponent
- Includes:
- Concerns::ChecksShowAuthorization, ResourcesHelper
- Defined in:
- app/components/avo/index/table_row_component.rb
Instance Attribute Summary collapse
-
#header_fields ⇒ Object
writeonly
Sets the attribute header_fields.
Instance Method Summary collapse
- #click_row_to_view_record ⇒ Object
-
#merged_tr_attributes ⇒ Object
Final attributes applied to the
. - #resource_controls_component ⇒ Object
- #view ⇒ Object
The render context for
row_optionsblocks.Methods included from Concerns::ChecksShowAuthorization
Methods included from Concerns::ChecksAssocAuthorization
Methods included from ResourcesHelper
#field_wrapper, #filter_wrapper, #index_field_wrapper, #item_selector_data_attributes, #record_path, #record_title, #resource_for_record, #resource_grid, #resource_show_path, #resource_table
Instance Attribute Details
#header_fields=(value) ⇒ Object (writeonly)
Sets the attribute header_fields
7 8 9
# File 'app/components/avo/index/table_row_component.rb', line 7 def header_fields=(value) @header_fields = value end
Instance Method Details
#click_row_to_view_record ⇒ Object
30 31 32
# File 'app/components/avo/index/table_row_component.rb', line 30 def click_row_to_view_record Avo.configuration.click_row_to_view_record && can_view? end
#merged_tr_attributes ⇒ Object
Final attributes applied to the
. User-supplied row_optionsare merged in via Avo::TableRowOptions; evaluated at render time so each request re-evaluates regardless ofcache_resources_on_index_view.44 45 46 47 48 49 50 51 52
# File 'app/components/avo/index/table_row_component.rb', line 44 def merged_tr_attributes Avo::TableRowOptions.merge( avo_attributes: default_tr_attributes, user_options: @resource.class.table_view&.dig(:row_options), record: @resource.record, resource: @resource, view: view ) end
#resource_controls_component ⇒ Object
19 20 21 22 23 24 25 26 27 28
# File 'app/components/avo/index/table_row_component.rb', line 19 def resource_controls_component Avo::Index::ResourceControlsComponent.new( resource: @resource, reflection: @reflection, parent_record: @parent_record, parent_resource: @parent_resource, view_type: :table, actions: @actions ) end
#view ⇒ Object
The render context for
row_optionsblocks. Derived from@reflectionrather than passed as a prop, matching the precedent inAvo::Views::ResourceIndexComponentandAvo::ResourceComponent.37 38 39
# File 'app/components/avo/index/table_row_component.rb', line 37 def view @reflection.present? ? :has_many : :index end