heartcombo--simple_form/lib/simple_form.rb

65 lines
2.0 KiB
Ruby
Raw Normal View History

2010-02-06 19:41:35 +00:00
require 'action_view'
2009-12-09 20:25:12 +00:00
require 'simple_form/action_view_extensions/form_helper'
require 'simple_form/action_view_extensions/builder'
2009-12-09 20:25:12 +00:00
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.
2010-01-09 13:34:52 +00:00
mattr_accessor :hint_tag
@@hint_tag = :span
# Default tag used on errors.
2010-01-09 13:34:52 +00:00
mattr_accessor :error_tag
@@error_tag = :span
# Components used by the form builder.
mattr_accessor :components
2010-01-09 13:34:52 +00:00
@@components = [ :label, :input, :hint, :error ]
2009-12-10 02:22:53 +00:00
# Series of attemps to detect a default label method for collection.
2009-12-10 02:22:53 +00:00
mattr_accessor :collection_label_methods
2009-12-11 01:48:29 +00:00
@@collection_label_methods = [ :to_label, :name, :title, :to_s ]
2009-12-10 02:22:53 +00:00
# Series of attemps to detect a default value method for collection.
2009-12-10 02:22:53 +00:00
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
2010-02-06 20:44:07 +00:00
@@wrapper_tag = :div
2009-12-10 22:11:15 +00:00
mattr_accessor :wrapper_error_class
@@wrapper_error_class = :fieldWithErrors
2009-12-10 22:11:15 +00:00
# How the label text should be generated altogether with the required text.
mattr_accessor :label_text
@@label_text = lambda { |label, required| "#{required} #{label}" }
2009-12-11 13:12:57 +00:00
# Collection of methods to detect if a file type was given.
mattr_accessor :file_methods
2009-12-13 01:05:51 +00:00
@@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
2010-02-06 21:06:25 +00:00
# Maximum size allowed for inputs.
mattr_accessor :default_input_size
@@default_input_size = 50
# 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
2009-12-10 17:57:24 +00:00
end