Module: SimpleForm::Components::Placeholders

Included in:
Inputs::Base
Defined in:
lib/simple_form/components/placeholders.rb

Instance Method Summary collapse

Instance Method Details

#has_placeholder?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/simple_form/components/placeholders.rb', line 9

def has_placeholder?
  false
end

#placeholderObject



4
5
6
7
# File 'lib/simple_form/components/placeholders.rb', line 4

def placeholder
  input_html_options[:placeholder] ||= placeholder_text if has_placeholder?
  nil
end

#placeholder_present?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/simple_form/components/placeholders.rb', line 13

def placeholder_present?
  options[:placeholder] != false && placeholder_text.present?
end

#placeholder_textObject



17
18
19
# File 'lib/simple_form/components/placeholders.rb', line 17

def placeholder_text
  @placeholder ||= options[:placeholder] || translate(:placeholders)
end