Sha256: 2db18d63edf62e3ca5f85754c86b369d526cfa39da8f5f9dcd8c01c70fbc0f7c

Contents?: true

Size: 1.56 KB

Versions: 4

Compression:

Stored size: 1.56 KB

Contents

SimpleForm.setup do |config|
  config.wrappers :horizontal, tag: :div, class: 'form-group', error_class: 'has-error',
                  label_html: { class: 'col-sm-2 control-label' } do |b|
    b.use :html5
    b.use :min_max
    b.use :maxlength
    b.use :placeholder

    b.optional :pattern
    b.optional :readonly

    b.use :label
    b.wrapper tag: :div, class: 'col-sm-10' do |i|
      i.use :input
      i.use :error, wrap_with: { tag: :span, class: 'help-block' }
      i.use :hint, wrap_with: { tag: :p, class: 'help-block' }
    end
  end

  config.wrappers :horizontal_checkbox, tag: :div, class: "form-group", error_class: "has-error" do |b|
    b.use :html5
    b.optional :readonly

    b.wrapper tag: :div, class: 'col-sm-offset-2 col-sm-10' do |i|
      i.wrapper tag: :div, class: 'checkbox' do |c|
        c.wrapper tag: :label do |a|
          a.use :input
          a.use :label_text
        end
      end
      i.use :error, wrap_with: { tag: :span, class: "help-block" }
      i.use :hint,  wrap_with: { tag: :p, class: "help-block" }
    end
  end

  config.wrappers :horizontal_radio, tag: :div, class: "form-group", error_class: "has-error" do |b|
    b.use :html5
    b.optional :readonly

    b.wrapper tag: :div, class: 'col-sm-offset-2 col-sm-10' do |i|
      i.wrapper tag: :div, class: 'radio' do |c|
        c.wrapper tag: :label do |a|
          a.use :input
          a.use :label_text
        end
      end
      i.use :error, wrap_with: { tag: :span, class: "help-block" }
      i.use :hint,  wrap_with: { tag: :p, class: "help-block" }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
simple_form_bootstrap3-0.2.0 config/initializers/simple_form_horizontal.rb
simple_form_bootstrap3-0.1.1 config/initializers/simple_form_horizontal.rb
simple_form_bootstrap3-0.1.0 config/initializers/simple_form_horizontal.rb
simple_form_bootstrap3-0.0.1 config/initializers/simple_form_horizontal.rb