mirror of
https://github.com/heartcombo/simple_form.git
synced 2022-11-09 12:19:26 -05:00
ebde237bf2
This commit changes Inputs::Base to handle input_html_options on initialization and allows components to return nil.
22 lines
No EOL
480 B
Ruby
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 |