Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 58 lines (45 sloc) 1.914 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
require 'simple_form/action_view_extensions/form_helper'
require 'simple_form/action_view_extensions/builder'
require 'simple_form/action_view_extensions/instance_tag'

module SimpleForm
  autoload :Components, 'simple_form/components'
  autoload :FormBuilder, 'simple_form/form_builder'
  autoload :I18nCache, 'simple_form/i18n_cache'
  autoload :Inputs, 'simple_form/inputs'
  autoload :MapType, 'simple_form/map_type'

  # Default tag used on hints.
  mattr_accessor :hint_tag
  @@hint_tag = :span

  # Default tag used on errors.
  mattr_accessor :error_tag
  @@error_tag = :span

  # Components used by the form builder.
  mattr_accessor :components
  @@components = [ :label, :input, :hint, :error ]

  # Series of attemps to detect a default label method for collection.
  mattr_accessor :collection_label_methods
  @@collection_label_methods = [ :to_label, :name, :title, :to_s ]

  # Series of attemps to detect a default value method for collection.
  mattr_accessor :collection_value_methods
  @@collection_value_methods = [ :id, :to_s ]

  # You can wrap all inputs in a pre-defined tag. By default is nil.
  mattr_accessor :wrapper_tag
  @@wrapper_tag = nil

  # How the label text should be generated altogether with the required text.
  mattr_accessor :label_text
  @@label_text = lambda { |label, required| "#{required} #{label}" }

  # Collection of methods to detect if a file type was given.
  mattr_accessor :file_methods
  @@file_methods = [ :mounted_as, :file?, :public_filename ]

  # Default priority for time_zone inputs.
  mattr_accessor :time_zone_priority
  @@time_zone_priority = nil

  # Default priority for country inputs.
  mattr_accessor :country_priority
  @@country_priority = nil

  # Default way to setup SimpleForm. Run script/generate simple_form_install
  # to create a fresh initializer with all configuration values.
  def self.setup
    yield self
  end
end
Something went wrong with that request. Please try again.