Module: Formulary::HtmlForm::Labels

Included in:
Formulary::HtmlForm
Defined in:
lib/formulary/html_form/labels.rb

Instance Method Summary collapse

Instance Method Details

#label_for_field(field_name) ⇒ Object



2
3
4
5
6
7
8
9
10
# File 'lib/formulary/html_form/labels.rb', line 2

def label_for_field(field_name)
  fields_for_name = document.css("*[name='#{field_name}']")

  if fields_for_name.length > 1
    labels_for_fieldset(fields_for_name)
  else
    label_for_single_field(fields_for_name.first)
  end
end