Sha256: 967ca0056d50e1f51429f337dadb0787fb947df88ebe5d412cc9c086a1b7e356

Contents?: true

Size: 470 Bytes

Versions: 6

Compression:

Stored size: 470 Bytes

Contents

module Celerity
  # For fields that accept file uploads
  class FileField < InputElement
    TAGS = [ Identifier.new('input', :type => %w[file]) ]
    DEFAULT_HOW = :name

    # Set the file field to the given path
    def set(path)
      assert_exists
      path = path.to_s
      @container.update_page @object.setValueAttribute(path)
      unless @object.getContentType
        @object.setContentType(Celerity::Util.content_type_for(path))
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
hirobumi-celerity-0.0.5 lib/celerity/elements/file_field.rb
jarib-celerity-0.0.5.1 lib/celerity/elements/file_field.rb
jarib-celerity-0.0.5.2 lib/celerity/elements/file_field.rb
jarib-celerity-0.0.5.4 lib/celerity/elements/file_field.rb
jarib-celerity-0.0.5.5 lib/celerity/elements/file_field.rb
jarib-celerity-0.0.5 lib/celerity/elements/file_field.rb