Module: Formular::Element::Modules::Wrapped::InstanceMethods
- Defined in:
- lib/formular/element/modules/wrapped.rb
Instance Method Summary collapse
Instance Method Details
#error ⇒ Object
47 48 49 50 51 52 |
# File 'lib/formular/element/modules/wrapped.rb', line 47 def error return '' unless has_errors? [:content] = error_text builder.error().to_s end |
#hint ⇒ Object
54 55 56 57 58 59 60 |
# File 'lib/formular/element/modules/wrapped.rb', line 54 def hint return '' unless has_hint? hint_opts = .dup hint_opts[:content] = hint_text hint_opts[:id] = hint_id # FIXME: this should work like a standard set_default builder.hint(hint_opts).to_s end |
#label ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/formular/element/modules/wrapped.rb', line 38 def label return '' unless has_label? label_opts = .dup label_opts[:content] = label_text label_opts[:labeled_control] = self builder.label(label_opts).to_s end |
#wrapper(&block) ⇒ Object
33 34 35 36 |
# File 'lib/formular/element/modules/wrapped.rb', line 33 def wrapper(&block) wrapper_element = has_errors? ? :error_wrapper : :wrapper builder.send(wrapper_element, , &block) end |