2009-12-09 15:25:12 -05:00
|
|
|
require 'simple_form/action_view_extensions/form_helper'
|
|
|
|
require 'simple_form/action_view_extensions/builder'
|
2009-12-11 11:37:33 -05:00
|
|
|
require 'simple_form/action_view_extensions/instance_tag'
|
2009-12-09 13:06:59 -05:00
|
|
|
|
2009-12-09 15:25:12 -05:00
|
|
|
module SimpleForm
|
2009-12-09 15:54:47 -05:00
|
|
|
autoload :Components, 'simple_form/components'
|
|
|
|
autoload :FormBuilder, 'simple_form/form_builder'
|
|
|
|
autoload :I18nCache, 'simple_form/i18n_cache'
|
|
|
|
autoload :MapType, 'simple_form/map_type'
|
|
|
|
autoload :RequiredHelpers, 'simple_form/required_helpers'
|
2009-12-09 20:57:05 -05:00
|
|
|
|
2009-12-10 12:57:24 -05:00
|
|
|
# Default tag used in components.
|
2009-12-09 20:57:05 -05:00
|
|
|
mattr_accessor :component_tag
|
|
|
|
@@component_tag = :span
|
|
|
|
|
|
|
|
# Components used by the form builder.
|
|
|
|
mattr_accessor :components
|
|
|
|
@@components = [
|
2009-12-10 08:01:44 -05:00
|
|
|
SimpleForm::Components::Wrapper, SimpleForm::Components::Label,
|
2009-12-10 08:23:48 -05:00
|
|
|
SimpleForm::Components::Input, SimpleForm::Components::Hint,
|
|
|
|
SimpleForm::Components::Error
|
2009-12-09 20:57:05 -05:00
|
|
|
]
|
2009-12-09 21:22:53 -05:00
|
|
|
|
|
|
|
# Series of attemps to detect a default label method for collection
|
|
|
|
mattr_accessor :collection_label_methods
|
2009-12-10 20:48:29 -05:00
|
|
|
@@collection_label_methods = [ :to_label, :name, :title, :to_s ]
|
2009-12-09 21:22:53 -05:00
|
|
|
|
|
|
|
# Series of attemps to detect a default value method for collection
|
|
|
|
mattr_accessor :collection_value_methods
|
|
|
|
@@collection_value_methods = [ :id, :to_s ]
|
2009-12-09 21:34:45 -05:00
|
|
|
|
|
|
|
# You can wrap all inputs in a pre-defined tag. By default is nil.
|
|
|
|
mattr_accessor :wrapper_tag
|
|
|
|
@@wrapper_tag = nil
|
2009-12-10 17:11:15 -05: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 08:12:57 -05:00
|
|
|
|
|
|
|
# Collection of methods to detect if a file type was given.
|
|
|
|
mattr_accessor :file_methods
|
|
|
|
@@file_methods = [ :file?, :public_filename ]
|
2009-12-11 08:53:18 -05:00
|
|
|
|
|
|
|
# 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
|
2009-12-11 15:23:00 -05:00
|
|
|
|
|
|
|
# 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 12:57:24 -05:00
|
|
|
end
|