plataformatec/simple_form — Issue #426: More bootstrap integration (mainly checkboxes)
Author: butsjoh
Created: 2012-02-02 14:00:58+00:00
State: open

Hey there,

I am using the new simple form with bootstrap 2 (also using your sample app as a reference) and it is working really well but it would like to give feedback on some things that according to me could be improved. So maybe these are feature requests or bugs, i'll leave that up to you. If you could point me to a solution that's even better :) To make things clear i am using the same config as on the example simple form bootstrap app: https://raw.github.com/rafaelfranca/simple_form-bootstrap/master/config/initializers/simple_form.rb.

#### :wrapper => false always falls back to the default defined wrapper

In previous versions of simple form (without the configurable wrapper) when you did :wrapper => false the surrounding divs around the input where not rendered. This doesn't seem to work anymore because (after small code check) it will always fall back to the default. Is this expected ?

#### When rendering checkboxes in a list not using a collection. Let say i just want 3 independent checkboxes beneath each other (like in bootstrap 2 > Extending form controls) see below code:

```html

Checkboxes

Option one is this and that—be sure to include why it's great

Option two can also be checked and included in form results

Option three can—yes, you guessed it—also be checked and included in form results

Note: Labels surround all the options for much larger click areas and a more usable form.

```

There is no easy way to this with simple form because of the boolean_style configuration and the fact that if you use the boolean input on it's own you cannot insert anything after it. I will demonstrate:

```haml
.control-group.check_boxes
.controls
= f.input :yippie, :wrapper => false, :as => :boolean, :hint => "tester"
```
generates

```html

tester

```
The wrapper false is not doing anything as i would expected that it would not generate the div[class="controls"] around the input and also the hint is placed outside the label input generation (what i expected).

WORKING SOLUTION: This is the only working solution i have currently which also includes defining a wrapper none.

```ruby
config.wrappers :none, :tag => false do |b|
b.use :input
end
```

```haml
.control-group.check_boxes
.controls
%label.checkbox
= f.input :yippie, :wrapper => :none, :as => :boolean, :label => false, :boolean_style => :inline
= "test"
%label.checkbox
= f.input :yippie, :wrapper => :none, :as => :boolean, :label => false, :boolean_style => :inline
= "test"
```

Sorry for all the information but i wanted to make clear what is going on and improvements can be made. Maybe there is a need for a new kind of input that allows you to define a list of checkboxes without using collection for it (grouped_input? which fakes the bootstrap control-group > controls ability) or maybe a new boolean_style (:inline_bootstrap) option that allows for the example above. I will leave this up to you guys to think about it and give feedback and maybe i can then help implementing it.

Thnx for the great effort already.