Sha256: 03fb152cd72cfe07c1a55b2f4f418b0e862c52b97e7842379a38fcc414209a02

Contents?: true

Size: 548 Bytes

Versions: 18

Compression:

Stored size: 548 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.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

18 entries across 18 versions & 1 rubygems

Version Path
tybo-0.2.0 app/components/input/file_component.rb
tybo-0.1.2 app/components/input/file_component.rb
tybo-0.1.0 app/components/input/file_component.rb
tybo-0.0.40 app/components/input/file_component.rb
tybo-0.0.39 app/components/input/file_component.rb
tybo-0.0.38 app/components/input/file_component.rb
tybo-0.0.37 app/components/input/file_component.rb
tybo-0.0.36 app/components/input/file_component.rb
tybo-0.0.35 app/components/input/file_component.rb
tybo-0.0.34 app/components/input/file_component.rb
tybo-0.0.32 app/components/input/file_component.rb
tybo-0.0.31 app/components/input/file_component.rb
tybo-0.0.30 app/components/input/file_component.rb
tybo-0.0.29 app/components/input/file_component.rb
tybo-0.0.28 app/components/input/file_component.rb
tybo-0.0.27 app/components/input/file_component.rb
tybo-0.0.26 app/components/input/file_component.rb
tybo-0.0.24 app/components/input/file_component.rb