Class: SimpleForm::Inputs::FileInput

Inherits:
Base
  • Object
show all
Defined in:
lib/generators/simple_form_fileinput/install/templates/simple_form_fileinput.rb

Instance Method Summary collapse

Instance Method Details

#input(wrapper_options) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/generators/simple_form_fileinput/install/templates/simple_form_fileinput.rb', line 4

def input(wrapper_options)
  merged_input_options = merge_wrapper_options input_html_options, wrapper_options
  merged_input_options[:data] ||= {}
  if Rails.env.test?
    merged_input_options[:data][:bfi_disabled] = true
  else
    merged_input_options[:title] = 'Drop a file here, or click to browse...'
    merged_input_options[:data][:filename_placement] = 'inside'
  end
  @builder.file_field(attribute_name, merged_input_options)
end