Module: GenericFormFor::Inputs::Base::Hint

Included in:
GenericFormFor::Inputs::Base
Defined in:
lib/generic_form_for/inputs/base/hint.rb

Instance Method Summary collapse

Instance Method Details

#hint_html(config_options = {}) ⇒ Object



6
7
8
9
# File 'lib/generic_form_for/inputs/base/hint.rb', line 6

def hint_html(config_options={})
  return "" unless render_hint?
  template.concat template.(config_options.delete(:tag) || :p, hint_text, hint_html_options(config_options))
end

#hint_html_options(config_options = {}) ⇒ Object



11
12
13
14
15
# File 'lib/generic_form_for/inputs/base/hint.rb', line 11

def hint_html_options(config_options={})
  opts = (options[:hint_html] || {}).dup
  opts[:class] = [*opts[:class], *config_options[:class]].compact.join(' ').strip
  config_options.merge(opts)
end

#hint_textObject



21
22
23
# File 'lib/generic_form_for/inputs/base/hint.rb', line 21

def hint_text
  render_hint? ? translate_hint(options[:hint]) : ""
end

#render_hint?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/generic_form_for/inputs/base/hint.rb', line 17

def render_hint?
  options.key?(:hint)
end