Module: Fidelity::FormHelper
- Defined in:
- app/fidelity/widgets/form/helpers/form_helper.rb
Instance Method Summary collapse
Instance Method Details
#form_field_with_error(options = {}, &block) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/fidelity/widgets/form/helpers/form_helper.rb', line 23 def form_field_with_error ={}, &block if block_given? if [:error] content = ''.html_safe.tap do |output| capture do output << yield output << content_tag(:small, [:error]) end end content_tag(:div, content, :class => 'form-field error') else content_tag(:div, :class => 'form-field') do yield end end end end |
#with_label(options = {}, &block) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/fidelity/widgets/form/helpers/form_helper.rb', line 4 def with_label ={}, &block uid = "uid_#{.object_id}" label = if [:label] content_tag(:label, [:label], :for => uid) else '' end if block_given? ''.html_safe.tap do |output| capture do output << label output << yield(uid) end end else label end end |