Sha256: 54303b20bf5475d184bd6cfc65e2d9144b351940a97432aac945ddb9677f19f9
Contents?: true
Size: 1.37 KB
Versions: 1
Compression:
Stored size: 1.37 KB
Contents
module Formtastic module Inputs module Base module Labelling include Formtastic::LocalizedString def label_html render_label? ? builder.label(input_name, label_text, label_html_options) : "".html_safe end def label_html_options # opts = options_for_label(options) # TODO opts = {} opts[:for] ||= input_html_options[:id] opts end def label_text ((localized_label || humanized_method_name) << requirement_text).html_safe end # TODO: why does this need to be memoized in order to make the inputs_spec tests pass? def requirement_text_or_proc @requirement_text_or_proc ||= required? ? builder.required_string : builder.optional_string end def requirement_text if requirement_text_or_proc.respond_to?(:call) requirement_text_or_proc.call else requirement_text_or_proc end end def label_from_options options[:label] end def localized_label localized_string(method, label_from_options || method, :label) end def render_label? return false if options[:label] == false true end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nuatt-formtastic-0.2.3 | lib/formtastic/inputs/base/labelling.rb |