Sha256: 51c4140cd371f00873db811636e1710f88ecb90a8de7629f630caf39128038fd

Contents?: true

Size: 594 Bytes

Versions: 16

Compression:

Stored size: 594 Bytes

Contents

module Plutonium
  module Core
    module Fields
      module Inputs
        class AttachmentInput < SimpleFormInput
          attr_reader :reflection

          def initialize(name, reflection:, **user_options)
            @reflection = reflection
            super(name, **user_options)
          end

          private

          def input_options
            options = {attachment: true} # enable the attachment component
            options[:input_html] = {multiple: true} if reflection.macro == :has_many_attached
            options
          end
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
plutonium-0.12.9 lib/plutonium/core/fields/inputs/attachment_input.rb
plutonium-0.12.8 lib/plutonium/core/fields/inputs/attachment_input.rb
plutonium-0.12.7 lib/plutonium/core/fields/inputs/attachment_input.rb
plutonium-0.12.5 lib/plutonium/core/fields/inputs/attachment_input.rb
plutonium-0.12.4 lib/plutonium/core/fields/inputs/attachment_input.rb
plutonium-0.12.3 lib/plutonium/core/fields/inputs/attachment_input.rb
plutonium-0.12.2 lib/plutonium/core/fields/inputs/attachment_input.rb
plutonium-0.12.1 lib/plutonium/core/fields/inputs/attachment_input.rb
plutonium-0.12.0 lib/plutonium/core/fields/inputs/attachment_input.rb
plutonium-0.11.2 lib/plutonium/core/fields/inputs/attachment_input.rb
plutonium-0.11.1 lib/plutonium/core/fields/inputs/attachment_input.rb
plutonium-0.11.0 lib/plutonium/core/fields/inputs/attachment_input.rb
plutonium-0.8.0 lib/plutonium/core/fields/inputs/attachment_input.rb
plutonium-0.6.2 lib/plutonium/core/fields/inputs/attachment_input.rb
plutonium-0.6.1 lib/plutonium/core/fields/inputs/attachment_input.rb
plutonium-0.6.0 lib/plutonium/core/fields/inputs/attachment_input.rb