Sha256: c4f2a0606ae250794f8e0a43441f7df280b519acfe41bf3f047367c56305d3de

Contents?: true

Size: 670 Bytes

Versions: 47

Compression:

Stored size: 670 Bytes

Contents

module DynamicScaffold
  module Form
    module Item
      class SingleOption < Base
        def initialize(config, type, *args)
          name = args.shift
          html_attributes = args.extract_options!
          @args = args
          super(config, type, name, html_attributes)
        end

        def render(_view, form, classnames = nil)
          html_attributes = build_html_attributes(classnames)
          # Retain the value of the password field on error.
          html_attributes[:value] = form.object.public_send(@name) if @type == :password_field
          form.public_send(@type, @name, *@args, html_attributes)
        end
      end
    end
  end
end

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
dynamic_scaffold-0.3.0 lib/dynamic_scaffold/form/item/single_option.rb
dynamic_scaffold-0.2.0 lib/dynamic_scaffold/form/item/single_option.rb
dynamic_scaffold-0.1.4 lib/dynamic_scaffold/form/item/single_option.rb
dynamic_scaffold-0.1.3 lib/dynamic_scaffold/form/item/single_option.rb
dynamic_scaffold-0.1.2 lib/dynamic_scaffold/form/item/single_option.rb
dynamic_scaffold-0.1.1 lib/dynamic_scaffold/form/item/single_option.rb
dynamic_scaffold-0.1.0 lib/dynamic_scaffold/form/item/single_option.rb