Module: Formular::Element::Modules::WrappedControl::InstanceMethods

Defined in:
lib/formular/element/modules/wrapped_control.rb

Instance Method Summary collapse

Instance Method Details

#errorObject



46
47
48
49
50
51
# File 'lib/formular/element/modules/wrapped_control.rb', line 46

def error
  return '' unless has_errors?

  error_options[:content] = error_text
  builder.error(error_options).to_s
end

#hintObject



53
54
55
56
57
58
59
# File 'lib/formular/element/modules/wrapped_control.rb', line 53

def hint
  return '' unless has_hint?

  hint_options[:content] = hint_text
  hint_options[:id] ||= hint_id
  builder.hint(hint_options).to_s
end

#labelObject



38
39
40
41
42
43
44
# File 'lib/formular/element/modules/wrapped_control.rb', line 38

def label
  return '' unless has_label?

  label_options[:content] = label_text
  label_options[:labeled_control] = self
  builder.label(label_options).to_s
end

#wrapper(&block) ⇒ Object



33
34
35
36
# File 'lib/formular/element/modules/wrapped_control.rb', line 33

def wrapper(&block)
  wrapper_element = has_errors? ? :error_wrapper : :wrapper
  builder.send(wrapper_element, Attributes[options[:wrapper_options]], &block)
end