Sha256: 4b38cb0a947515ca9ff5b642d7c94f5811d1fa6afc83d86287fac53fdaa26f30

Contents?: true

Size: 836 Bytes

Versions: 12

Compression:

Stored size: 836 Bytes

Contents

module Coprl
  module Presenters
    module DSL
      module Components
        class FileInput < Input
          include Mixins::Append
          include Mixins::Buttons
          include Mixins::Grids

          attr_reader :accept, :preview, :components

          def initialize(**attribs_, &block)
            super(type: :file_input, **attribs_, &block)

            @accept =  attribs.delete(:accept) { nil }
            @preview = attribs.delete(:preview) { nil }
            @components = []
            expand!
            default_button
          end

          def value(value=nil)
            return @value if locked?
            @value = value
          end
          private
          def default_button
            button(icon: :cloud_upload) unless components.any?
          end
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
coprl-3.0.0.beta.12 lib/coprl/presenters/dsl/components/file_input.rb
coprl-3.0.0.beta.11 lib/coprl/presenters/dsl/components/file_input.rb
coprl-3.0.0.beta.10 lib/coprl/presenters/dsl/components/file_input.rb
coprl-3.0.0.beta.9 lib/coprl/presenters/dsl/components/file_input.rb
coprl-3.0.0.beta.8 lib/coprl/presenters/dsl/components/file_input.rb
coprl-3.0.0.beta.7 lib/coprl/presenters/dsl/components/file_input.rb
coprl-3.0.0.beta.6 lib/coprl/presenters/dsl/components/file_input.rb
coprl-3.0.0.beta.5 lib/coprl/presenters/dsl/components/file_input.rb
coprl-3.0.0.beta.4 lib/coprl/presenters/dsl/components/file_input.rb
coprl-3.0.0.beta.3 lib/coprl/presenters/dsl/components/file_input.rb
coprl-3.0.0.beta.2 lib/coprl/presenters/dsl/components/file_input.rb
coprl-3.0.0.beta.1 lib/coprl/presenters/dsl/components/file_input.rb