Module: Formtastic::Inputs::Base
- Extended by:
- ActiveSupport::Autoload
- Includes:
- Associations, Database, Errors, Fileish, Hints, Html, Labelling, Naming, Options, Validations, Wrapping
- Included in:
- BooleanInput, CheckBoxesInput, CountryInput, DatePickerInput, DateSelectInput, DatetimePickerInput, DatetimeSelectInput, EmailInput, FileInput, HiddenInput, NumberInput, PasswordInput, PhoneInput, RadioInput, RangeInput, SearchInput, SelectInput, StringInput, TextInput, TimePickerInput, TimeSelectInput, TimeZoneInput, UrlInput
- Defined in:
- lib/formtastic/inputs/base.rb,
lib/formtastic/inputs/base/html.rb,
lib/formtastic/inputs/base/hints.rb,
lib/formtastic/inputs/base/errors.rb,
lib/formtastic/inputs/base/naming.rb,
lib/formtastic/inputs/base/choices.rb,
lib/formtastic/inputs/base/fileish.rb,
lib/formtastic/inputs/base/numeric.rb,
lib/formtastic/inputs/base/options.rb,
lib/formtastic/inputs/base/timeish.rb,
lib/formtastic/inputs/base/database.rb,
lib/formtastic/inputs/base/wrapping.rb,
lib/formtastic/inputs/base/labelling.rb,
lib/formtastic/inputs/base/stringish.rb,
lib/formtastic/inputs/base/collections.rb,
lib/formtastic/inputs/base/placeholder.rb,
lib/formtastic/inputs/base/validations.rb,
lib/formtastic/inputs/base/associations.rb,
lib/formtastic/inputs/base/datetime_pickerish.rb,
lib/formtastic/inputs/base/grouped_collections.rb
Defined Under Namespace
Modules: Associations, Choices, Collections, Database, DatetimePickerish, Errors, Fileish, GroupedCollections, Hints, Html, Labelling, Naming, Numeric, Options, Placeholder, Stringish, Timeish, Validations, Wrapping
Instance Attribute Summary collapse
-
#builder ⇒ Object
Returns the value of attribute builder.
-
#method ⇒ Object
Returns the value of attribute method.
-
#object ⇒ Object
Returns the value of attribute object.
-
#object_name ⇒ Object
Returns the value of attribute object_name.
-
#options ⇒ Object
Returns the value of attribute options.
-
#template ⇒ Object
Returns the value of attribute template.
Instance Method Summary collapse
- #initialize(builder, template, object, object_name, method, options) ⇒ Object
-
#removed_option!(old_option_name) ⇒ Object
Usefull for raising an error on previously supported option.
-
#warn_and_correct_option!(old_option_name, new_option_name) ⇒ Object
Usefull for deprecating options.
-
#warn_deprecated_option!(old_option_name, instructions) ⇒ Object
Usefull for deprecating options.
Methods included from Wrapping
#input_wrapping, #wrapper_classes, #wrapper_classes_raw, #wrapper_dom_id, #wrapper_html_options, #wrapper_html_options_raw
Methods included from Labelling
#label_from_options, #label_html, #label_html_options, #label_text, #localized_label, #render_label?, #requirement_text, #requirement_text_or_proc
Methods included from LocalizedString
Methods included from Associations
#association, #association_primary_key, #belongs_to?, #has_many?, #reflection
Methods included from Fileish
Methods included from Validations
#autofocus?, #column_limit, #limit, #not_required_through_negated_validation!, #not_required_through_negated_validation?, #optional?, #required?, #required_attribute?, #responds_to_global_required?, #validation_integer_only?, #validation_limit, #validation_max, #validation_min, #validation_step, #validations, #validations?, #validator_relevant?
Methods included from Naming
#as, #attributized_method_name, #humanized_method_name, #input_name, #sanitized_method_name, #sanitized_object_name
Methods included from Hints
#hint?, #hint_html, #hint_text, #hint_text_from_options
Methods included from Errors
#error_first_html, #error_html, #error_keys, #error_list_html, #error_none_html, #error_sentence_html, #errors, #errors?
Methods included from Database
Methods included from Options
#formtastic_options, #input_options
Methods included from Html
#dom_id, #dom_index, #input_html_options, #to_html
Instance Attribute Details
#builder ⇒ Object
Returns the value of attribute builder.
5 6 7 |
# File 'lib/formtastic/inputs/base.rb', line 5 def builder @builder end |
#method ⇒ Object
Returns the value of attribute method.
5 6 7 |
# File 'lib/formtastic/inputs/base.rb', line 5 def method @method end |
#object ⇒ Object
Returns the value of attribute object.
5 6 7 |
# File 'lib/formtastic/inputs/base.rb', line 5 def object @object end |
#object_name ⇒ Object
Returns the value of attribute object_name.
5 6 7 |
# File 'lib/formtastic/inputs/base.rb', line 5 def object_name @object_name end |
#options ⇒ Object
Returns the value of attribute options.
5 6 7 |
# File 'lib/formtastic/inputs/base.rb', line 5 def @options end |
#template ⇒ Object
Returns the value of attribute template.
5 6 7 |
# File 'lib/formtastic/inputs/base.rb', line 5 def template @template end |
Instance Method Details
#initialize(builder, template, object, object_name, method, options) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/formtastic/inputs/base.rb', line 7 def initialize(builder, template, object, object_name, method, ) @builder = builder @template = template @object = object @object_name = object_name @method = method @options = .dup warn_deprecated_option!(:value, ":input_html => { :value => '...'}") warn_deprecated_option!(:hint_class, "default_hint_class configuration") warn_deprecated_option!(:error_class, "default_error_class configuration") warn_deprecated_option!(:group_by, ":collection option with a HTML string generated by Rails' grouped_options_for_select()") warn_deprecated_option!(:group_label, ":collection option with a HTML string generated by Rails' grouped_options_for_select()") warn_deprecated_option!(:find_options, "YourModel.find(...)") end |
#removed_option!(old_option_name) ⇒ Object
Usefull for raising an error on previously supported option.
39 40 41 |
# File 'lib/formtastic/inputs/base.rb', line 39 def removed_option!(old_option_name) raise ArgumentError, ":#{old_option_name} is no longer available" if .key?(old_option_name) end |
#warn_and_correct_option!(old_option_name, new_option_name) ⇒ Object
Usefull for deprecating options.
24 25 26 27 28 29 |
# File 'lib/formtastic/inputs/base.rb', line 24 def warn_and_correct_option!(old_option_name, new_option_name) if .key?(old_option_name) ::ActiveSupport::Deprecation.warn("The :#{old_option_name} option is deprecated in favour of :#{new_option_name} and will be removed from Formtastic in the next version") [new_option_name] = .delete(old_option_name) end end |
#warn_deprecated_option!(old_option_name, instructions) ⇒ Object
Usefull for deprecating options.
32 33 34 35 36 |
# File 'lib/formtastic/inputs/base.rb', line 32 def warn_deprecated_option!(old_option_name, instructions) if .key?(old_option_name) ::ActiveSupport::Deprecation.warn("The :#{old_option_name} option is deprecated in favour of `#{instructions}` and will be removed in the next version") end end |