Sha256: 82f65eb04f663e040346f7c24e8aee7694433cb71d03e188a048445cfcd80f21

Contents?: true

Size: 545 Bytes

Versions: 25

Compression:

Stored size: 545 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("#{@item.class.name.downcase}.attributes.#{@field}")
    end

    def picture
      return object unless @variant

      object.variant(@variant)
    end

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

Version data entries

25 entries across 25 versions & 2 rubygems

Version Path
tybo-0.0.23 app/components/input/file_component.rb
tybo-0.0.22 app/components/input/file_component.rb
tybo-0.0.21 app/components/input/file_component.rb
tybo-0.0.20 app/components/input/file_component.rb
tybo-0.0.19 app/components/input/file_component.rb
tybo-0.0.18 app/components/input/file_component.rb
tybo-0.0.17 app/components/input/file_component.rb
tybo-0.0.16 app/components/input/file_component.rb
tybo-0.0.15 app/components/input/file_component.rb
tybo-0.0.14 app/components/input/file_component.rb
tybo-0.0.13 app/components/input/file_component.rb
tybo-0.0.12 app/components/input/file_component.rb
tybo-0.0.11 app/components/input/file_component.rb
tybo-0.0.10 app/components/input/file_component.rb
tybo-0.0.9 app/components/input/file_component.rb
tybo-0.0.8 app/components/input/file_component.rb
tybo-0.0.7 app/components/input/file_component.rb
tybo-0.0.6 app/components/input/file_component.rb
tybo-0.0.5 app/components/input/file_component.rb
tybo-0.0.4 app/components/input/file_component.rb