Class: Avo::Index::FieldWrapperComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- Avo::Index::FieldWrapperComponent
show all
- Defined in:
- app/components/avo/index/field_wrapper_component.rb
Constant Summary
Concerns::FindAssociationField::ASSOCIATIONS
Instance Method Summary
collapse
#has_with_trial
#find_association_field
Instance Method Details
#after_initialize ⇒ Object
14
15
16
|
# File 'app/components/avo/index/field_wrapper_component.rb', line 14
def after_initialize
@view = Avo::ViewInquirer.new("index")
end
|
#classes ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
|
# File 'app/components/avo/index/field_wrapper_component.rb', line 18
def classes
result = @classes
unless @flush
result += " py-3"
end
result += " #{@field.get_html(:classes, view: @view, element: :wrapper)}"
result
end
|
#render_dash? ⇒ Boolean
49
50
51
52
53
54
55
|
# File 'app/components/avo/index/field_wrapper_component.rb', line 49
def render_dash?
if @field.type == "boolean"
@field.value.nil?
else
@field.value.blank? && @dash_if_blank
end
end
|
#stimulus_attributes ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'app/components/avo/index/field_wrapper_component.rb', line 34
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
|
#style ⇒ Object
30
31
32
|
# File 'app/components/avo/index/field_wrapper_component.rb', line 30
def style
@field.get_html(:style, view: @view, element: :wrapper)
end
|