Sha256: 449ece94d52c9c390ae911c149adee62a0eda63fdfd211770fe3f3302fc916af
Contents?: true
Size: 737 Bytes
Versions: 32
Compression:
Stored size: 737 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 Avo::Services::URIService.parse(@resource.record_path).append_paths("active_storage_attachments", id, file.id).to_s 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
32 entries across 32 versions & 1 rubygems