Class: Avo::Edit::FieldWrapperComponent

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/avo/edit/field_wrapper_component.rb

Instance Method Summary collapse

Constructor Details

#initialize(field: nil, dash_if_blank: true, full_width: false, displayed_in_modal: false, form: nil, resource: {}, label: nil, help: nil, **args) ⇒ FieldWrapperComponent

Returns a new instance of FieldWrapperComponent.



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/components/avo/edit/field_wrapper_component.rb', line 4

def initialize(field: nil, dash_if_blank: true, full_width: false, displayed_in_modal: false, form: nil, resource: {}, label: nil, help: nil, **args)
  @field = field
  @dash_if_blank = dash_if_blank
  @classes = args[:class].present? ? args[:class] : ""
  @args = args
  @displayed_in_modal = displayed_in_modal
  @form = form
  @resource = resource
  @model = resource.present? ? resource.model : nil
  @full_width = full_width
  @label = label
  @help = help
end

Instance Method Details

#helpObject



18
19
20
# File 'app/components/avo/edit/field_wrapper_component.rb', line 18

def help
  @help || @field.help
end