Sha256: 16f5d228e742d29fd4604e6a79f0d43b03732c02c44d40cf5e881ecc7b240438

Contents?: true

Size: 438 Bytes

Versions: 3

Compression:

Stored size: 438 Bytes

Contents

module SimpleForm
  class PlaceholderFormBuilder < SimpleForm::FormBuilder
    def input(attribute_name, options = {}, &block)
      if options[:placeholder].nil?
        options[:placeholder] ||= object.class.respond_to?(:human_attribute_name) ?
          object.class.human_attribute_name(attribute_name.to_s) : attribute_name.to_s.humanize
      end
      options[:label] = false if options[:label].nil?

      super
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
simple_form_bootstrap3-0.1.1 lib/simple_form/placeholder_form_builder.rb
simple_form_bootstrap3-0.1.0 lib/simple_form/placeholder_form_builder.rb
simple_form_bootstrap3-0.0.1 lib/simple_form/placeholder_form_builder.rb