class Trestle::Form::Fields::FileField

Public Instance Methods

browse_text() click to toggle source
# File lib/trestle/form/fields/file_field.rb, line 24
def browse_text
  I18n.t("trestle.file.browse", default: "Browse")
end
choose_file_text() click to toggle source
# File lib/trestle/form/fields/file_field.rb, line 20
def choose_file_text
  I18n.t("trestle.file.choose_file", default: "Choose file...")
end
custom?() click to toggle source
# File lib/trestle/form/fields/file_field.rb, line 16
def custom?
  options[:custom] != false
end
field() click to toggle source
# File lib/trestle/form/fields/file_field.rb, line 5
def field
  if custom?
    content_tag(:div, class: "custom-file") do
      concat builder.raw_file_field(name, options.merge(class: "custom-file-input"))
      concat builder.label(name, choose_file_text, class: "custom-file-label", data: { browse: browse_text })
    end
  else
    builder.raw_file_field(name, options)
  end
end