module Formtastic::Inputs::Base::Labelling
Public Instance Methods
label_from_options()
click to toggle source
# File lib/formtastic/inputs/base/labelling.rb, line 36 def label_from_options options[:label] end
label_html()
click to toggle source
# File lib/formtastic/inputs/base/labelling.rb, line 8 def label_html render_label? ? builder.label(input_name, label_text, label_html_options) : "".html_safe end
label_html_options()
click to toggle source
# File lib/formtastic/inputs/base/labelling.rb, line 12 def label_html_options { :for => input_html_options[:id], :class => ['label'], } end
label_text()
click to toggle source
# File lib/formtastic/inputs/base/labelling.rb, line 19 def label_text ((localized_label || humanized_method_name) + requirement_text).html_safe end
localized_label()
click to toggle source
# File lib/formtastic/inputs/base/labelling.rb, line 40 def localized_label localized_string(method, label_from_options || method, :label) end
render_label?()
click to toggle source
# File lib/formtastic/inputs/base/labelling.rb, line 44 def render_label? return false if options[:label] == false true end
requirement_text()
click to toggle source
# File lib/formtastic/inputs/base/labelling.rb, line 28 def requirement_text if requirement_text_or_proc.respond_to?(:call) requirement_text_or_proc.call else requirement_text_or_proc end end
requirement_text_or_proc()
click to toggle source
TODO: why does this need to be memoized in order to make the inputs_spec tests pass?
# File lib/formtastic/inputs/base/labelling.rb, line 24 def requirement_text_or_proc @requirement_text_or_proc ||= required? ? builder.required_string : builder.optional_string end