Sha256: dc53532b32515ea75ca984763c79f1b011c9df3db66447c3ff6b31898c5793c0

Contents?: true

Size: 968 Bytes

Versions: 5

Compression:

Stored size: 968 Bytes

Contents

class Bootstrap
  class Component
    class Form < Component
      def render_content *args
          form *args, &@build_block
      end

      add_tag_method :form, nil, optional_classes: {
        horizontal: "form-horizontal",
        inline: "form-inline" }
      add_div_method :group, "form-group"
      add_tag_method :label, nil
      add_tag_method :input, "form-control" do |opts, extra_args|
        type, label = extra_args
        prepend { label label, for: opts[:id] } if label
        opts[:type] = type
        opts
      end

      [:text, :password, :datetime, :"datetime-local", :date, :month, :time,
       :week, :number, :email, :url, :search, :tel, :color].each do |tag|
        add_tag_method tag, "form-control", attributes: { type: tag },
                       tag: :input do |opts, extra_args|
          label, = extra_args
          prepend { label label, for: opts[:id] } if label
          opts
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
card-1.20.4 mod/bootstrap/lib/bootstrap/component/form.rb
card-1.20.3 mod/bootstrap/lib/bootstrap/component/form.rb
card-1.20.2 mod/bootstrap/lib/bootstrap/component/form.rb
card-1.20.1 mod/bootstrap/lib/bootstrap/component/form.rb
card-1.20.0 mod/bootstrap/lib/bootstrap/component/form.rb