Class: Avo::Index::FieldWrapperComponent
- Inherits:
-
BaseComponent
- Object
- BaseComponent
- Avo::Index::FieldWrapperComponent
- Defined in:
- app/components/avo/index/field_wrapper_component.rb
Instance Method Summary collapse
Instance Method Details
#after_initialize ⇒ Object
11 12 13 14 |
# File 'app/components/avo/index/field_wrapper_component.rb', line 11 def after_initialize @view = Avo::ViewInquirer.new("index") @classes = @args.dig(:class) || "" end |
#render_dash? ⇒ Boolean
31 32 33 |
# File 'app/components/avo/index/field_wrapper_component.rb', line 31 def render_dash? @field.value.blank? && @dash_if_blank end |
#stimulus_attributes ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/components/avo/index/field_wrapper_component.rb', line 16 def stimulus_attributes attributes = {} @resource.get_stimulus_controllers.split(" ").each do |controller| attributes["#{controller}-target"] = "#{@field.id.to_s.underscore}_#{@field.type.to_s.underscore}_wrapper".camelize(:lower) end wrapper_data_attributes = @field.get_html :data, view: @view, element: :wrapper if wrapper_data_attributes.present? attributes.merge! wrapper_data_attributes end attributes end |