Module: FlexaFormtasticBootstrap::Inputs::Base::Wrapping
- Includes:
- Formtastic::Inputs::Base::Wrapping
- Included in:
- FlexaFormtasticBootstrap::Inputs::Base
- Defined in:
- lib/flexa_formtastic_bootstrap/inputs/base/wrapping.rb
Instance Method Summary collapse
- #clearfix_div_wrapping(&block) ⇒ Object
- #generic_input_wrapping(&block) ⇒ Object
- #inline_inputs_div_wrapping(&block) ⇒ Object
- #input_div_wrapping(inline_or_block_errors = :inline) ⇒ Object
- #prepended_input_wrapping(&block) ⇒ Object
- #wrapper_html_options ⇒ Object
Instance Method Details
#clearfix_div_wrapping(&block) ⇒ Object
23 24 25 26 27 |
# File 'lib/flexa_formtastic_bootstrap/inputs/base/wrapping.rb', line 23 def clearfix_div_wrapping(&block) template.content_tag(:div, ) do yield end end |
#generic_input_wrapping(&block) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/flexa_formtastic_bootstrap/inputs/base/wrapping.rb', line 8 def generic_input_wrapping(&block) clearfix_div_wrapping do label_html << input_div_wrapping do if [:prepend] prepended_input_wrapping do [template.content_tag(:span, [:prepend], :class => 'add-on'), yield].join("\n").html_safe end else yield end end end end |
#inline_inputs_div_wrapping(&block) ⇒ Object
35 36 37 38 39 |
# File 'lib/flexa_formtastic_bootstrap/inputs/base/wrapping.rb', line 35 def inline_inputs_div_wrapping(&block) template.content_tag(:div, :class => "inline-inputs") do yield end end |
#input_div_wrapping(inline_or_block_errors = :inline) ⇒ Object
29 30 31 32 33 |
# File 'lib/flexa_formtastic_bootstrap/inputs/base/wrapping.rb', line 29 def input_div_wrapping(inline_or_block_errors = :inline) template.content_tag(:div, :class => "input") do [yield, error_html(inline_or_block_errors), hint_html(inline_or_block_errors)].join("\n").html_safe end end |
#prepended_input_wrapping(&block) ⇒ Object
59 60 61 62 63 |
# File 'lib/flexa_formtastic_bootstrap/inputs/base/wrapping.rb', line 59 def prepended_input_wrapping(&block) template.content_tag(:div, :class => 'input-prepend') do yield end end |
#wrapper_html_options ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/flexa_formtastic_bootstrap/inputs/base/wrapping.rb', line 41 def opts = [:wrapper_html] || {} opts[:class] ||= [] opts[:class] = [opts[:class].to_s] unless opts[:class].is_a?(Array) opts[:class] << as opts[:class] << "clearfix" # opts[:class] << "input" opts[:class] << "error" if errors? opts[:class] << "optional" if optional? opts[:class] << "required" if required? opts[:class] << "autofocus" if autofocus? opts[:class] = opts[:class].join(' ') opts[:id] ||= wrapper_dom_id opts end |