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, #resource_grid, #resource_show_path, #resource_table

Methods inherited from BaseComponent

#has_with_trial

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