app/helpers/binco/bootstrap_form_builder.rb in binco-0.0.3 vs app/helpers/binco/bootstrap_form_builder.rb in binco-2.0.1

- old
+ new

@@ -1,7 +1,10 @@ module Binco class BootstrapFormBuilder < ActionView::Helpers::FormBuilder + alias_method :collection_select_original, :collection_select + alias_method :select_original, :select + def text_field(name, options = {}) options = add_class_to_options('form-control', options) super name, options end @@ -29,22 +32,22 @@ end end # Since select2 support multiple choices (checkboxes) def collection_check_boxes2(method, collection, value_method, text_method, options = {}, html_options = {}) - options ||= {} - options[:multiple] = 'multiple' + html_options ||= {} + html_options[:multiple] = 'multiple' collection_select2 method, collection, value_method, text_method, options, html_options end def collection_select(method, collection, value_method, text_method, options = {}, html_options = {}) - html_options = add_class_to_options('form-control', options) + html_options = add_class_to_options('form-control', html_options) super method, collection, value_method, text_method, options, html_options end def collection_select2(method, collection, value_method, text_method, options = {}, html_options = {}, &block) - options = add_class_to_options('select2-rails', options) + html_options = add_class_to_options('select2-rails', html_options) collection_select(method, collection, value_method, text_method, options, html_options) end def email_field(name, options = {}) options = add_class_to_options('form-control', options) @@ -81,9 +84,10 @@ super method, options, checked_value, unchecked_value end def submit(value = nil, options = {}) options = add_class_to_options('btn btn-success', options) + add_data_to_options({ disable_with: 'Enviando' }, options) super value, options end def form_group(options = {}, &block) options = add_class_to_options('form-group', options)