1
0
Fork 0
mirror of https://github.com/heartcombo/simple_form.git synced 2022-11-09 12:19:26 -05:00
heartcombo--simple_form/lib/simple_form/components/placeholders.rb
José Valim ebde237bf2 Move placeholders to a component.
This commit changes Inputs::Base to handle input_html_options on initialization and allows components to return nil.
2010-11-07 10:43:20 +01:00

22 lines
No EOL
480 B
Ruby

module SimpleForm
module Components
module Placeholders
def placeholder
input_html_options[:placeholder] ||= placeholder_text if has_placeholder?
nil
end
def has_placeholder?
false
end
def placeholder_present?
options[:placeholder] != false && placeholder_text.present?
end
def placeholder_text
@placeholder ||= options[:placeholder] || translate(:placeholders)
end
end
end
end