Class: Formtastic::FormBuilder
Constant Summary
Helpers::ErrorsHelper::INLINE_ERROR_TYPES
Class Attribute Summary collapse
Class Method Summary
collapse
semantic_errors
#model_name
actions
action
inputs
input
Class Attribute Details
.action_class_finder ⇒ Object
.action_namespaces ⇒ Object
48
|
# File 'lib/formtastic/form_builder.rb', line 48
configure :action_namespaces, [::Object, ::Formtastic::Actions]
|
.all_fields_required_by_default ⇒ Object
23
|
# File 'lib/formtastic/form_builder.rb', line 23
configure :all_fields_required_by_default, true
|
.auto_index ⇒ Object
Returns the value of attribute auto_index.
56
57
58
|
# File 'lib/formtastic/form_builder.rb', line 56
def auto_index
@auto_index
end
|
.collection_label_methods ⇒ Object
29
|
# File 'lib/formtastic/form_builder.rb', line 29
configure :collection_label_methods, %w[to_label display_name full_name name title username login value to_s]
|
.collection_value_methods ⇒ Object
30
|
# File 'lib/formtastic/form_builder.rb', line 30
configure :collection_value_methods, %w[id to_s]
|
.custom_namespace ⇒ Object
19
|
# File 'lib/formtastic/form_builder.rb', line 19
configure :custom_namespace
|
38
|
# File 'lib/formtastic/form_builder.rb', line 38
configure :default_commit_button_accesskey
|
.default_error_list_class ⇒ Object
40
|
# File 'lib/formtastic/form_builder.rb', line 40
configure :default_error_list_class, 'errors'
|
.default_hint_class ⇒ Object
41
|
# File 'lib/formtastic/form_builder.rb', line 41
configure :default_hint_class, 'inline-hints'
|
.default_inline_error_class ⇒ Object
39
|
# File 'lib/formtastic/form_builder.rb', line 39
configure :default_inline_error_class, 'inline-errors'
|
.default_text_area_height ⇒ Object
21
|
# File 'lib/formtastic/form_builder.rb', line 21
configure :default_text_area_height, 20
|
.default_text_area_width ⇒ Object
22
|
# File 'lib/formtastic/form_builder.rb', line 22
configure :default_text_area_width
|
.default_text_field_size ⇒ Object
20
|
# File 'lib/formtastic/form_builder.rb', line 20
configure :default_text_field_size
|
.escape_html_entities_in_hints_and_labels ⇒ Object
37
|
# File 'lib/formtastic/form_builder.rb', line 37
configure :escape_html_entities_in_hints_and_labels, true
|
32
|
# File 'lib/formtastic/form_builder.rb', line 32
configure :file_metadata_suffixes, ['content_type', 'file_name', 'file_size']
|
.file_methods ⇒ Object
31
|
# File 'lib/formtastic/form_builder.rb', line 31
configure :file_methods, [ :file?, :public_filename, :filename ]
|
.i18n_cache_lookups ⇒ Object
35
|
# File 'lib/formtastic/form_builder.rb', line 35
configure :i18n_cache_lookups, true
|
.i18n_localizer ⇒ Object
36
|
# File 'lib/formtastic/form_builder.rb', line 36
configure :i18n_localizer, Formtastic::Localizer
|
.i18n_lookups_by_default ⇒ Object
34
|
# File 'lib/formtastic/form_builder.rb', line 34
configure :i18n_lookups_by_default, true
|
.include_blank_for_select_by_default ⇒ Object
24
|
# File 'lib/formtastic/form_builder.rb', line 24
configure :include_blank_for_select_by_default, true
|
.inline_errors ⇒ Object
27
|
# File 'lib/formtastic/form_builder.rb', line 27
configure :inline_errors, :sentence
|
45
|
# File 'lib/formtastic/form_builder.rb', line 45
configure :input_namespaces, [::Object, ::Formtastic::Inputs]
|
.label_str_method ⇒ Object
28
|
# File 'lib/formtastic/form_builder.rb', line 28
configure :label_str_method, :humanize
|
.optional_string ⇒ Object
26
|
# File 'lib/formtastic/form_builder.rb', line 26
configure :optional_string, ''
|
43
|
# File 'lib/formtastic/form_builder.rb', line 43
configure :perform_browser_validations, false
|
.priority_countries ⇒ Object
33
|
# File 'lib/formtastic/form_builder.rb', line 33
configure :priority_countries, ["Australia", "Canada", "United Kingdom", "United States"]
|
.priority_time_zones ⇒ Object
52
|
# File 'lib/formtastic/form_builder.rb', line 52
configure :priority_time_zones, []
|
.required_string ⇒ Object
25
|
# File 'lib/formtastic/form_builder.rb', line 25
configure :required_string, proc { %{<abbr title="#{Formtastic::I18n.t(:required)}">*</abbr>}.html_safe }
|
.skipped_columns ⇒ Object
51
|
# File 'lib/formtastic/form_builder.rb', line 51
configure :skipped_columns, [:created_at, :updated_at, :created_on, :updated_on, :lock_version, :version]
|
.template ⇒ Object
Returns the value of attribute template.
54
55
56
|
# File 'lib/formtastic/form_builder.rb', line 54
def template
@template
end
|
.use_required_attribute ⇒ Object
42
|
# File 'lib/formtastic/form_builder.rb', line 42
configure :use_required_attribute, false
|
Class Method Details
.initialize(object_name, object, template, options) ⇒ Object
98
99
100
101
102
103
104
|
# File 'lib/formtastic/form_builder.rb', line 98
def initialize(object_name, object, template, options)
super
if respond_to?('multipart=') && options.is_a?(Hash) && options[:html]
self.multipart = options[:html][:multipart]
end
end
|
.semantic_fields_for(record_or_name_or_array, *args, &block) ⇒ Object
TODO:
is there a way to test the params structure of the Rails helper we wrap to ensure forward compatibility?
This is a wrapper around Rails' ActionView::Helpers::FormBuilder#fields_for
, originally
provided to ensure that the :builder
from semantic_form_for
was passed down into
the nested fields_for
. Our supported versions of Rails no longer require us to do this,
so this method is provided purely for backwards compatibility and DSL consistency.
When constructing a fields_for
form fragment outside of semantic_form_for
, please use
Formtastic::Helpers::FormHelper#semantic_fields_for
.
94
95
96
|
# File 'lib/formtastic/form_builder.rb', line 94
def semantic_fields_for(record_or_name_or_array, *args, &block)
fields_for(record_or_name_or_array, *args, &block)
end
|