Class: Avo::Fields::EditComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- Avo::Fields::EditComponent
- Includes:
- ResourcesHelper
- Defined in:
- app/components/avo/fields/edit_component.rb
Direct Known Subclasses
AreaField::EditComponent, BelongsToField::EditComponent, BooleanField::EditComponent, BooleanGroupField::EditComponent, CodeField::EditComponent, CountryField::EditComponent, DateField::EditComponent, DateTimeField::EditComponent, Avo::Fields::EasyMdeField::EditComponent, Avo::Fields::ExternalImageField::EditComponent, FileField::EditComponent, FilesField::EditComponent, HeadingField::EditComponent, HiddenField::EditComponent, IdField::EditComponent, KeyValueField::EditComponent, LocationField::EditComponent, NumberField::EditComponent, PasswordField::EditComponent, ProgressBarField::EditComponent, RadioField::EditComponent, SelectField::EditComponent, StarsField::EditComponent, StatusField::EditComponent, TagsField::EditComponent, TextField::EditComponent, TextareaField::EditComponent, TimeField::EditComponent, TiptapField::EditComponent, TrixField::EditComponent
Constant Summary
Constants included from Concerns::FindAssociationField
Concerns::FindAssociationField::ASSOCIATIONS
Instance Attribute Summary collapse
-
#field ⇒ Object
readonly
Returns the value of attribute field.
-
#form ⇒ Object
readonly
Returns the value of attribute form.
-
#full_width ⇒ Object
readonly
Returns the value of attribute full_width.
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#kwargs ⇒ Object
readonly
Returns the value of attribute kwargs.
-
#multiple ⇒ Object
readonly
Returns the value of attribute multiple.
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
-
#stacked ⇒ Object
readonly
Returns the value of attribute stacked.
-
#view ⇒ Object
readonly
Returns the value of attribute view.
Instance Method Summary collapse
- #classes(extra_classes = "") ⇒ Object
- #disabled? ⇒ Boolean
- #field_wrapper_args ⇒ Object
-
#initialize(field: nil, resource: nil, index: 0, form: nil, stacked: nil, full_width: nil, multiple: false, autofocus: false, **kwargs) ⇒ EditComponent
constructor
A new instance of EditComponent.
- #render? ⇒ Boolean
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
Methods inherited from BaseComponent
#component_name, #hotkey_badge
Methods included from ApplicationHelper
#a_button, #a_link, #body_classes, #button_classes, #chart_color, #container_classes, #d, #decode_filter_params, #e, #editor_file_path, #editor_url, #empty_state, #encode_filter_params, #frame_id, #get_model_class, #input_classes, #mount_path, #number_to_social, #possibly_rails_authentication?, #render_license_warning, #root_path_without_url, #rtl?, #text_direction, #ui, #wrap_in_modal
Methods included from Concerns::FindAssociationField
Constructor Details
#initialize(field: nil, resource: nil, index: 0, form: nil, stacked: nil, full_width: nil, multiple: false, autofocus: false, **kwargs) ⇒ EditComponent
Returns a new instance of EditComponent.
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/components/avo/fields/edit_component.rb', line 16 def initialize(field: nil, resource: nil, index: 0, form: nil, stacked: nil, full_width: nil, multiple: false, autofocus: false, **kwargs) @field = field @form = form @index = index @kwargs = kwargs @multiple = multiple @resource = resource @stacked = stacked @view = Avo::ViewInquirer.new("edit") @autofocus = autofocus @full_width = full_width end |
Instance Attribute Details
#field ⇒ Object (readonly)
Returns the value of attribute field.
6 7 8 |
# File 'app/components/avo/fields/edit_component.rb', line 6 def field @field end |
#form ⇒ Object (readonly)
Returns the value of attribute form.
7 8 9 |
# File 'app/components/avo/fields/edit_component.rb', line 7 def form @form end |
#full_width ⇒ Object (readonly)
Returns the value of attribute full_width.
14 15 16 |
# File 'app/components/avo/fields/edit_component.rb', line 14 def full_width @full_width end |
#index ⇒ Object (readonly)
Returns the value of attribute index.
8 9 10 |
# File 'app/components/avo/fields/edit_component.rb', line 8 def index @index end |
#kwargs ⇒ Object (readonly)
Returns the value of attribute kwargs.
9 10 11 |
# File 'app/components/avo/fields/edit_component.rb', line 9 def kwargs @kwargs end |
#multiple ⇒ Object (readonly)
Returns the value of attribute multiple.
10 11 12 |
# File 'app/components/avo/fields/edit_component.rb', line 10 def multiple @multiple end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
11 12 13 |
# File 'app/components/avo/fields/edit_component.rb', line 11 def resource @resource end |
#stacked ⇒ Object (readonly)
Returns the value of attribute stacked.
12 13 14 |
# File 'app/components/avo/fields/edit_component.rb', line 12 def stacked @stacked end |
#view ⇒ Object (readonly)
Returns the value of attribute view.
13 14 15 |
# File 'app/components/avo/fields/edit_component.rb', line 13 def view @view end |
Instance Method Details
#classes(extra_classes = "") ⇒ Object
29 30 31 32 33 34 35 |
# File 'app/components/avo/fields/edit_component.rb', line 29 def classes(extra_classes = "") helpers.input_classes( "#{@field.get_html(:classes, view: view, element: :input)} #{extra_classes}", has_error: @field.record_errors.include?(@field.id), size: @field.size ) end |
#disabled? ⇒ Boolean
53 54 55 |
# File 'app/components/avo/fields/edit_component.rb', line 53 def disabled? field.is_readonly? || field.is_disabled? end |
#field_wrapper_args ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/components/avo/fields/edit_component.rb', line 41 def field_wrapper_args { field: field, form: form, index: index, resource: resource, stacked: stacked, full_width: full_width, view: view } end |
#render? ⇒ Boolean
37 38 39 |
# File 'app/components/avo/fields/edit_component.rb', line 37 def render? !field.computed end |