Module: ActionView::Helpers::FormHelper
- Defined in:
- lib/bootstrap-form/form_helper.rb
Instance Method Summary collapse
- #bootstrap_clearfix_wrap(object_name, method, content, options = {}) ⇒ Object
- #bootstrap_collection_select(object_name, method, collection, value_method, text_method, options = {}, html_options = {}) ⇒ Object
- #bootstrap_file_field(object_name, method, options = {}) ⇒ Object
- #bootstrap_password_field(object_name, method, options = {}) ⇒ Object
- #bootstrap_text_area(object_name, method, options = {}) ⇒ Object
- #bootstrap_text_field(object_name, method, options = {}) ⇒ Object
- #inline_help_tag(messages) ⇒ Object
Instance Method Details
#bootstrap_clearfix_wrap(object_name, method, content, options = {}) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/bootstrap-form/form_helper.rb', line 24 def bootstrap_clearfix_wrap(object_name, method, content, ={}) = [:object].errors[method] clearfix_tag = .empty? ? 'clearfix' : 'clearfix error' content_tag(:div, label(object_name, method) + content_tag(:div, content + inline_help_tag(), :class => 'input'), :class => clearfix_tag) end |
#bootstrap_collection_select(object_name, method, collection, value_method, text_method, options = {}, html_options = {}) ⇒ Object
12 13 14 |
# File 'lib/bootstrap-form/form_helper.rb', line 12 def bootstrap_collection_select(object_name, method, collection, value_method, text_method, = {}, = {}) bootstrap_clearfix_wrap(object_name, method, collection_select(object_name, method, collection, value_method, text_method, .dup, ), ) end |
#bootstrap_file_field(object_name, method, options = {}) ⇒ Object
16 17 18 |
# File 'lib/bootstrap-form/form_helper.rb', line 16 def bootstrap_file_field(object_name, method, ={}) bootstrap_clearfix_wrap(object_name, method, file_field(object_name, method, .dup), ) end |
#bootstrap_password_field(object_name, method, options = {}) ⇒ Object
8 9 10 |
# File 'lib/bootstrap-form/form_helper.rb', line 8 def bootstrap_password_field(object_name, method, ={}) bootstrap_clearfix_wrap(object_name, method, password_field(object_name, method, .dup), ) end |
#bootstrap_text_area(object_name, method, options = {}) ⇒ Object
20 21 22 |
# File 'lib/bootstrap-form/form_helper.rb', line 20 def bootstrap_text_area(object_name, method, ={}) bootstrap_clearfix_wrap(object_name, method, text_area(object_name, method, .dup), ) end |
#bootstrap_text_field(object_name, method, options = {}) ⇒ Object
4 5 6 |
# File 'lib/bootstrap-form/form_helper.rb', line 4 def bootstrap_text_field(object_name, method, ={}) bootstrap_clearfix_wrap(object_name, method, text_field(object_name, method, .dup), ) end |
#inline_help_tag(messages) ⇒ Object
32 33 34 35 |
# File 'lib/bootstrap-form/form_helper.rb', line 32 def inline_help_tag() = ActiveSupport::SafeBuffer.new(" #{.join(',')}") .empty? ? '' : content_tag(:span, , :class => 'help-inline') end |