Module: Formtastic::Inputs::Base::Stringish

Included in:
EmailInput, NumberInput, PasswordInput, PhoneInput, SearchInput, StringInput, UrlInput
Defined in:
lib/formtastic/inputs/base/stringish.rb

Instance Method Summary collapse

Instance Method Details

#input_html_optionsObject

Overrides standard ‘input_html_options` to provide a `maxlength` and `size` attribute.



15
16
17
18
19
20
21
# File 'lib/formtastic/inputs/base/stringish.rb', line 15

def input_html_options
  {
    :maxlength => options[:input_html].try(:[], :maxlength) || limit,
    :size => builder.default_text_field_size,
    :placeholder => placeholder_text
  }.merge(super)
end

#placeholder_textObject



23
24
25
# File 'lib/formtastic/inputs/base/stringish.rb', line 23

def placeholder_text
  localized_string(method, options[:placeholder], :placeholder)
end

#to_htmlObject

This method is abstract.

Override this method in your input class to describe how the input should render itself.



7
8
9
10
11
12
# File 'lib/formtastic/inputs/base/stringish.rb', line 7

def to_html
  input_wrapping do
    label_html <<
    builder.text_field(method, input_html_options)
  end
end