Class: Avo::Fields::FileField::IndexComponent

Inherits:
IndexComponent show all
Defined in:
app/components/avo/fields/file_field/index_component.rb

Constant Summary

Constants included from Concerns::FindAssociationField

Concerns::FindAssociationField::ASSOCIATIONS

Instance Attribute Summary

Attributes inherited from IndexComponent

#field, #kwargs, #parent_resource, #view

Instance Method Summary collapse

Methods inherited from IndexComponent

#field_wrapper_args, #initialize, #resource_view_path

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

#find_association_field

Constructor Details

This class inherits a constructor from Avo::Fields::IndexComponent

Instance Method Details

#flush?Boolean

Returns:

  • (Boolean)


4
5
6
# File 'app/components/avo/fields/file_field/index_component.rb', line 4

def flush?
  has_image_tag? || has_audio_tag?
end

#has_audio_tag?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'app/components/avo/fields/file_field/index_component.rb', line 12

def has_audio_tag?
  field.value.present? && field.value.attached? && field.is_audio
end

#has_image_tag?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'app/components/avo/fields/file_field/index_component.rb', line 8

def has_image_tag?
  field.value.present? && field.value.attached? && field.value.representable? && field.is_image
end