Class: Jav::Fields::EditComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Jav::Fields::EditComponent
- Includes:
- ResourcesHelper
- Defined in:
- app/components/jav/fields/edit_component.rb
Direct Known Subclasses
AreaField::EditComponent, BelongsToField::EditComponent, BooleanField::EditComponent, BooleanGroupField::EditComponent, CodeField::EditComponent, CountryField::EditComponent, DateField::EditComponent, DateTimeField::EditComponent, Jav::Fields::ExternalImageField::EditComponent, FileField::EditComponent, FilesField::EditComponent, HeadingField::EditComponent, HiddenField::EditComponent, IdField::EditComponent, KeyValueField::EditComponent, LocationField::EditComponent, MarkdownField::EditComponent, NumberField::EditComponent, PasswordField::EditComponent, ProgressBarField::EditComponent, SelectField::EditComponent, StatusField::EditComponent, TagsField::EditComponent, TextField::EditComponent, TextareaField::EditComponent, TimeField::EditComponent, TrixField::EditComponent
Instance Attribute Summary collapse
-
#compact ⇒ Object
readonly
Returns the value of attribute compact.
-
#field ⇒ Object
readonly
Returns the value of attribute field.
-
#form ⇒ Object
readonly
Returns the value of attribute form.
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#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, compact: false, stacked: nil, multiple: false, **kwargs) ⇒ EditComponent
constructor
A new instance of EditComponent.
- #render? ⇒ Boolean
Methods included from ResourcesHelper
#field_wrapper, #filter_wrapper, #index_field_wrapper, #item_select_all_input, #item_selector_init, #item_selector_input, #resource_grid, #resource_table
Constructor Details
#initialize(field: nil, resource: nil, index: 0, form: nil, compact: false, stacked: nil, multiple: false, **kwargs) ⇒ EditComponent
Returns a new instance of EditComponent.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/components/jav/fields/edit_component.rb', line 8 def initialize(field: nil, resource: nil, index: 0, form: nil, compact: false, stacked: nil, multiple: false, **kwargs) super @compact = compact @field = field @form = form @index = index @multiple = multiple @resource = resource @stacked = stacked @view = :edit end |
Instance Attribute Details
#compact ⇒ Object (readonly)
Returns the value of attribute compact.
6 7 8 |
# File 'app/components/jav/fields/edit_component.rb', line 6 def compact @compact end |
#field ⇒ Object (readonly)
Returns the value of attribute field.
6 7 8 |
# File 'app/components/jav/fields/edit_component.rb', line 6 def field @field end |
#form ⇒ Object (readonly)
Returns the value of attribute form.
6 7 8 |
# File 'app/components/jav/fields/edit_component.rb', line 6 def form @form end |
#index ⇒ Object (readonly)
Returns the value of attribute index.
6 7 8 |
# File 'app/components/jav/fields/edit_component.rb', line 6 def index @index end |
#multiple ⇒ Object (readonly)
Returns the value of attribute multiple.
6 7 8 |
# File 'app/components/jav/fields/edit_component.rb', line 6 def multiple @multiple end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
6 7 8 |
# File 'app/components/jav/fields/edit_component.rb', line 6 def resource @resource end |
#stacked ⇒ Object (readonly)
Returns the value of attribute stacked.
6 7 8 |
# File 'app/components/jav/fields/edit_component.rb', line 6 def stacked @stacked end |
#view ⇒ Object (readonly)
Returns the value of attribute view.
6 7 8 |
# File 'app/components/jav/fields/edit_component.rb', line 6 def view @view end |
Instance Method Details
#classes(extra_classes = "") ⇒ Object
20 21 22 |
# File 'app/components/jav/fields/edit_component.rb', line 20 def classes(extra_classes = "") helpers.input_classes("#{@field.get_html(:classes, view: view, element: :input)} #{extra_classes}", has_error: @field.model_errors.include?(@field.id)) end |
#disabled? ⇒ Boolean
40 41 42 |
# File 'app/components/jav/fields/edit_component.rb', line 40 def disabled? field.is_readonly? || field.is_disabled? end |
#field_wrapper_args ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/components/jav/fields/edit_component.rb', line 28 def field_wrapper_args { compact: compact, field: field, form: form, index: index, resource: resource, stacked: stacked, view: view } end |
#render? ⇒ Boolean
24 25 26 |
# File 'app/components/jav/fields/edit_component.rb', line 24 def render? !field.computed end |