Module: BootstrapForm::CustomFileField

Defined in:
lib/bootstrap_form/custom_file_field.rb

Instance Method Summary collapse

Instance Method Details

#custom_file_field(name, *args) ⇒ Object

Give :choose_label as a option for changing the langfile default.



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/bootstrap_form/custom_file_field.rb', line 5

def custom_file_field(name, *args)
  options = args.extract_options!.symbolize_keys!
  args << options

  form_group_builder(name, options) do
    ('div', class: 'custom-file') do
      control = file_field_without_bootstrap(name, options.merge(class: 'custom-file-input'))
      label = label(name, @template.t('bootstrap.file_input.placeholder', default: [options[:choose_label], 'Choose file'].compact), class: "custom-file-label")
      concat(control).concat(label)
    end
  end
end