module Formular::Element::Modules::Wrapped::InstanceMethods
Public Instance Methods
error()
click to toggle source
# File lib/formular/element/modules/wrapped.rb, line 47 def error return '' unless has_errors? error_options[:content] = error_text builder.error(error_options).to_s end
hint()
click to toggle source
# File lib/formular/element/modules/wrapped.rb, line 54 def hint return '' unless has_hint? hint_opts = hint_options.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()
click to toggle source
# File lib/formular/element/modules/wrapped.rb, line 38 def label return '' unless has_label? label_opts = label_options.dup label_opts[:content] = label_text label_opts[:labeled_control] = self builder.label(label_opts).to_s end
wrapper(&block)
click to toggle source
# File lib/formular/element/modules/wrapped.rb, line 33 def wrapper(&block) wrapper_element = has_errors? ? :error_wrapper : :wrapper builder.send(wrapper_element, wrapper_options, &block) end
Private Instance Methods
error_options()
click to toggle source
# File lib/formular/element/modules/wrapped.rb, line 63 def error_options @error_options ||= options[:error_options] || {} end
wrapper_options()
click to toggle source
# File lib/formular/element/modules/wrapped.rb, line 67 def wrapper_options @wrapper_options ||= options[:wrapper_options] || {} end