Module: SimpleForm
- Extended by:
- ActiveSupport::Autoload
- Defined in:
- lib/simple_form.rb,
lib/simple_form/tags.rb,
lib/simple_form/inputs.rb,
lib/simple_form/helpers.rb,
lib/simple_form/version.rb,
lib/simple_form/railtie.rb,
lib/simple_form/wrappers.rb,
lib/simple_form/map_type.rb,
lib/simple_form/i18n_cache.rb,
lib/simple_form/components.rb,
lib/simple_form/inputs/base.rb,
lib/simple_form/form_builder.rb,
lib/simple_form/wrappers/root.rb,
lib/simple_form/wrappers/many.rb,
lib/simple_form/wrappers/single.rb,
lib/simple_form/helpers/disabled.rb,
lib/simple_form/wrappers/builder.rb,
lib/simple_form/components/html5.rb,
lib/simple_form/helpers/required.rb,
lib/simple_form/helpers/readonly.rb,
lib/simple_form/components/hints.rb,
lib/simple_form/components/labels.rb,
lib/simple_form/components/errors.rb,
lib/simple_form/inputs/text_input.rb,
lib/simple_form/helpers/autofocus.rb,
lib/simple_form/inputs/file_input.rb,
lib/simple_form/error_notification.rb,
lib/simple_form/components/min_max.rb,
lib/simple_form/inputs/range_input.rb,
lib/simple_form/inputs/block_input.rb,
lib/simple_form/helpers/validators.rb,
lib/simple_form/components/pattern.rb,
lib/simple_form/inputs/hidden_input.rb,
lib/simple_form/components/readonly.rb,
lib/simple_form/inputs/string_input.rb,
lib/simple_form/inputs/numeric_input.rb,
lib/simple_form/inputs/boolean_input.rb,
lib/simple_form/components/maxlength.rb,
lib/simple_form/inputs/password_input.rb,
lib/simple_form/inputs/priority_input.rb,
lib/simple_form/inputs/date_time_input.rb,
lib/simple_form/components/label_input.rb,
lib/simple_form/inputs/collection_input.rb,
lib/simple_form/components/placeholders.rb,
lib/generators/simple_form/install_generator.rb,
lib/simple_form/inputs/collection_select_input.rb,
lib/simple_form/action_view_extensions/builder.rb,
lib/simple_form/action_view_extensions/form_helper.rb,
lib/simple_form/inputs/collection_check_boxes_input.rb,
lib/simple_form/inputs/collection_radio_buttons_input.rb,
lib/simple_form/inputs/grouped_collection_select_input.rb
Defined Under Namespace
Modules: ActionViewExtensions, Components, Generators, Helpers, I18nCache, Inputs, MapType, Tags, Wrappers Classes: ErrorNotification, FormBuilder, Railtie, WrapperNotFound
Constant Summary
- VERSION =
"3.0.0.beta1".freeze
- @@error_method =
:first- @@error_notification_tag =
:p- @@error_notification_class =
:error_notification- @@collection_label_methods =
[:to_label, :name, :title, :to_s]
- @@collection_value_methods =
[:id, :to_s]
- @@collection_wrapper_tag =
nil- @@collection_wrapper_class =
nil- @@item_wrapper_tag =
:span- @@item_wrapper_class =
nil- @@label_text =
lambda { |label, required| "#{required} #{label}" }
- @@label_class =
nil- @@boolean_style =
:inline- @@form_class =
:simple_form- @@generate_additional_classes_for =
[:wrapper, :label, :input]
- @@required_by_default =
true- @@browser_validations =
true- @@file_methods =
[:mounted_as, :file?, :public_filename]
- @@input_mappings =
nil- @@wrapper_mappings =
nil- @@time_zone_priority =
nil- @@country_priority =
nil- @@default_input_size =
nil- @@translate_labels =
true- @@inputs_discovery =
true- @@cache_discovery =
defined?(Rails) && !Rails.env.development?
'button'- @@default_wrapper =
:default- @@wrappers =
{}
Class Method Summary (collapse)
- + (Object) additional_classes_for(component)
-
+ (Object) build(options = {}) {|builder| ... }
Builds a new wrapper using SimpleForm::Wrappers::Builder.
-
+ (Object) default_input_size=
SETUP.
- + (Object) eager_load!
-
+ (Object) setup {|_self| ... }
Default way to setup SimpleForm.
-
+ (Object) wrapper(name)
Retrieves a given wrapper.
-
+ (Object) wrappers(*args, &block)
Define a new wrapper using SimpleForm::Wrappers::Builder and store it in the given name.
Instance Method Summary (collapse)
-
- (Object) default_wrapper
WRAPPER CONFIGURATION The default wrapper to be used by the FormBuilder.
Class Method Details
+ (Object) additional_classes_for(component)
191 192 193 |
# File 'lib/simple_form.rb', line 191 def self.additional_classes_for(component) generate_additional_classes_for.include?(component) ? yield : [] end |
+ (Object) build(options = {}) {|builder| ... }
Builds a new wrapper using SimpleForm::Wrappers::Builder.
170 171 172 173 174 175 |
# File 'lib/simple_form.rb', line 170 def self.build(={}) [:tag] = :div if [:tag].nil? builder = SimpleForm::Wrappers::Builder.new() yield builder SimpleForm::Wrappers::Root.new(builder.to_a, ) end |
+ (Object) default_input_size=
SETUP
197 198 199 |
# File 'lib/simple_form.rb', line 197 def self.default_input_size=(*) ActiveSupport::Deprecation.warn "[SIMPLE_FORM] SimpleForm.default_input_size= is deprecated and has no effect", caller end |
+ (Object) eager_load!
21 22 23 24 25 |
# File 'lib/simple_form.rb', line 21 def self.eager_load! super SimpleForm::Inputs.eager_load! SimpleForm::Components.eager_load! end |
+ (Object) setup {|_self| ... }
Default way to setup SimpleForm. Run rails generate simple_form:install to create a fresh initializer with all configuration values.
203 204 205 |
# File 'lib/simple_form.rb', line 203 def self.setup yield self end |
+ (Object) wrapper(name)
Retrieves a given wrapper
149 150 151 |
# File 'lib/simple_form.rb', line 149 def self.wrapper(name) @@wrappers[name.to_sym] or raise WrapperNotFound, "Couldn't find wrapper with name #{name}" end |
+ (Object) wrappers(*args, &block)
Define a new wrapper using SimpleForm::Wrappers::Builder and store it in the given name.
159 160 161 162 163 164 165 166 167 |
# File 'lib/simple_form.rb', line 159 def self.wrappers(*args, &block) if block_given? = args. name = args.first || :default @@wrappers[name.to_sym] = build(, &block) else @@wrappers end end |
Instance Method Details
- (Object) default_wrapper
WRAPPER CONFIGURATION The default wrapper to be used by the FormBuilder.
144 |
# File 'lib/simple_form.rb', line 144 mattr_accessor :default_wrapper |