Class: Avo::Fields::StatusField
- Defined in:
- lib/avo/app/fields/status_field.rb
Instance Attribute Summary
Attributes inherited from Field
#block, #component, #computable, #default, #format_using, #help, #id, #is_array_param, #is_object_param, #name, #null_values, #nullable, #placeholder, #readonly, #required, #sortable, #updatable
Attributes included from FieldExtensions::VisibleOnDifferentViews
#show_on_create, #show_on_edit, #show_on_index, #show_on_show
Instance Method Summary collapse
- #hydrate_field(fields, model, resource, view) ⇒ Object
-
#initialize(name, **args, &block) ⇒ StatusField
constructor
A new instance of StatusField.
Methods inherited from Field
#database_id, #fetch_for_action, #fetch_for_resource, #fill_field, #has_own_panel?, #resolve_attribute
Methods included from FieldExtensions::HasFieldName
#field_name, #field_name_attribute, #get_field_name
Methods included from FieldExtensions::VisibleOnDifferentViews
#except_on, #hide_on, #only_on, #show_on
Constructor Details
#initialize(name, **args, &block) ⇒ StatusField
Returns a new instance of StatusField.
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/avo/app/fields/status_field.rb', line 4 def initialize(name, **args, &block) @defaults = { sortable: true, component: 'status-field', } super(name, **args, &block) @loading_when = args[:loading_when].present? ? [args[:loading_when]].flatten : [:waiting, :running] @failed_when = args[:failed_when].present? ? [args[:failed_when]].flatten : [:failed] end |
Instance Method Details
#hydrate_field(fields, model, resource, view) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/avo/app/fields/status_field.rb', line 16 def hydrate_field(fields, model, resource, view) { loading_when: @loading_when, failed_when: @failed_when, } end |