Sha256: 75ddf0c9e2f5364f46f122504ce77383be80f80dab443a3c12753f01ef56c882
Contents?: true
Size: 692 Bytes
Versions: 38
Compression:
Stored size: 692 Bytes
Contents
# frozen_string_literal: true class Avo::Fields::Common::SingleFileViewerComponent < ViewComponent::Base include Avo::ApplicationHelper def initialize(file: nil, field:, resource:) @file = file @field = field @resource = resource end def destroy_path "#{@resource.record_path}/active_storage_attachments/#{id}/#{file.id}" end def id @field.id end def file @file || @field.value.attachment rescue nil end def is_image? file.image? || @field.is_image rescue false end def is_audio? file.audio? || @field.is_audio rescue false end def is_video? file.video? || @field.is_video rescue false end end
Version data entries
38 entries across 38 versions & 1 rubygems