Sha256: 297099ea8494151305244ce056f987fac04260b9031ffd9fcddf5f9eb39dd09a

Contents?: true

Size: 445 Bytes

Versions: 17

Compression:

Stored size: 445 Bytes

Contents

module SimpleForm
  class PlaceholderFormBuilder < SimpleForm::DefaultFormBuilder
    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

17 entries across 17 versions & 1 rubygems

Version Path
simple_form_bootstrap3-0.3.6 lib/simple_form/placeholder_form_builder.rb
simple_form_bootstrap3-0.3.5 lib/simple_form/placeholder_form_builder.rb
simple_form_bootstrap3-0.3.4 lib/simple_form/placeholder_form_builder.rb
simple_form_bootstrap3-0.3.3 lib/simple_form/placeholder_form_builder.rb
simple_form_bootstrap3-0.3.2 lib/simple_form/placeholder_form_builder.rb
simple_form_bootstrap3-0.3.1 lib/simple_form/placeholder_form_builder.rb
simple_form_bootstrap3-0.3.0 lib/simple_form/placeholder_form_builder.rb
simple_form_bootstrap3-0.2.9 lib/simple_form/placeholder_form_builder.rb
simple_form_bootstrap3-0.2.8 lib/simple_form/placeholder_form_builder.rb
simple_form_bootstrap3-0.2.7 lib/simple_form/placeholder_form_builder.rb
simple_form_bootstrap3-0.2.6 lib/simple_form/placeholder_form_builder.rb
simple_form_bootstrap3-0.2.5 lib/simple_form/placeholder_form_builder.rb
simple_form_bootstrap3-0.2.4 lib/simple_form/placeholder_form_builder.rb
simple_form_bootstrap3-0.2.3 lib/simple_form/placeholder_form_builder.rb
simple_form_bootstrap3-0.2.2 lib/simple_form/placeholder_form_builder.rb
simple_form_bootstrap3-0.2.1 lib/simple_form/placeholder_form_builder.rb
simple_form_bootstrap3-0.2.0 lib/simple_form/placeholder_form_builder.rb