Sha256: fe72a8dfec40c90e373cf009dc96ae47b58d6b6167d0f79eadbeba1b115f85b7

Contents?: true

Size: 550 Bytes

Versions: 30

Compression:

Stored size: 550 Bytes

Contents

# frozen_string_literal: true

module Input
  class FileComponent < ViewComponent::Base
    def initialize(item:, field:, form:, variant: nil)
      @item = item
      @field = field
      @form = form
      @label = label
      @variant = variant
      @picture = picture
      @object = object
    end

    def label
      I18n.t("bo.#{@item.class.name.underscore}.attributes.#{@field}")
    end

    def picture
      return object unless @variant

      object.variant(@variant)
    end

    def object
      @item.send(@field)
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
tybo-0.4.1 app/components/input/file_component.rb
tybo-0.4.0 app/components/input/file_component.rb
tybo-0.3.26 app/components/input/file_component.rb
tybo-0.3.24 app/components/input/file_component.rb
tybo-0.3.23 app/components/input/file_component.rb
tybo-0.3.22 app/components/input/file_component.rb
tybo-0.3.21 app/components/input/file_component.rb
tybo-0.3.20 app/components/input/file_component.rb
tybo-0.3.19 app/components/input/file_component.rb
tybo-0.3.18 app/components/input/file_component.rb
tybo-0.3.17 app/components/input/file_component.rb
tybo-0.3.16 app/components/input/file_component.rb
tybo-0.3.15 app/components/input/file_component.rb
tybo-0.3.14 app/components/input/file_component.rb
tybo-0.3.13 app/components/input/file_component.rb
tybo-0.3.12 app/components/input/file_component.rb
tybo-0.3.11 app/components/input/file_component.rb
tybo-0.3.10 app/components/input/file_component.rb
tybo-0.3.9 app/components/input/file_component.rb
tybo-0.3.8 app/components/input/file_component.rb