Sha256: 25abbd4a3791af9a5e3c6b6964a934bd796aaf4e509e49d5cd76c6894dfd250a

Contents?: true

Size: 1.42 KB

Versions: 13

Compression:

Stored size: 1.42 KB

Contents

module Formtastic
  module Inputs

    # Outputs a simple `<label>` with a `<input type="file">` wrapped in the standard
    # `<li>` wrapper. This is the default input choice for objects with attributes that appear
    # to be for file uploads, by detecting some common method names used by popular file upload
    # libraries such as Paperclip and CarrierWave. You can add to or alter these method names
    # through the `file_methods` config, but can be applied to any input with `:as => :file`.
    #
    # Don't forget to set the multipart attribute in your `<form>` tag!
    #
    # @example Full form context and output
    #
    #   <%= semantic_form_for(@user, :html => { :multipart => true }) do |f| %>
    #     <%= f.inputs do %>
    #       <%= f.input :avatar, :as => :file %>
    #     <% end %>
    #   <% end %>
    #
    #   <form...>
    #     <fieldset>
    #       <ol>
    #         <li class="file">
    #           <label for="user_avatar">Avatar</label>
    #           <input type="file" id="user_avatar" name="user[avatar]">
    #         </li>
    #       </ol>
    #     </fieldset>
    #   </form>
    #
    # @see Formtastic::Helpers::InputsHelper#input InputsHelper#input for full documentation of all possible options.
    class FileInput
      include Base
      def to_html
        input_wrapping do
          label_html <<
          builder.file_field(method, input_html_options)
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 3 rubygems

Version Path
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/formtastic-4.0.0/lib/formtastic/inputs/file_input.rb
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/formtastic-4.0.0/lib/formtastic/inputs/file_input.rb
formtastic-4.0.0 lib/formtastic/inputs/file_input.rb
formtastic-4.0.0.rc1 lib/formtastic/inputs/file_input.rb
formtastic-3.1.5 lib/formtastic/inputs/file_input.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/formtastic-3.1.4/lib/formtastic/inputs/file_input.rb
formtastic-3.1.4 lib/formtastic/inputs/file_input.rb
formtastic-3.1.3 lib/formtastic/inputs/file_input.rb
formtastic-3.1.2 lib/formtastic/inputs/file_input.rb
formtastic-3.1.1 lib/formtastic/inputs/file_input.rb
formtastic-3.1.0 lib/formtastic/inputs/file_input.rb
formtastic-3.1.0.rc2 lib/formtastic/inputs/file_input.rb
formtastic-3.1.0.rc1 lib/formtastic/inputs/file_input.rb